1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00
This commit is contained in:
TheBusyBiscuit 2021-03-31 18:30:04 +02:00
commit 61f0fa5d0d
7 changed files with 50 additions and 33 deletions

View File

@ -32,6 +32,7 @@
* Added Armor Forge Auto-Crafter * Added Armor Forge Auto-Crafter
* Auto-Crafters can now be turned on and off * Auto-Crafters can now be turned on and off
* Added Produce Collector to automate Milk and Mushroom Stew * Added Produce Collector to automate Milk and Mushroom Stew
* Added a new message when constructing a Multiblock successfully
* Block Placers can now place down cake * Block Placers can now place down cake
#### Changes #### Changes
@ -53,6 +54,7 @@
* Fixed Auto-Crafters swallowing buckets when crafting cake * Fixed Auto-Crafters swallowing buckets when crafting cake
* Fixed Multimeter not working on Auto-Crafters * Fixed Multimeter not working on Auto-Crafters
* Fixed #2650 * Fixed #2650
* Fixed Slimefun items applying damage to items with an `unbreakable` tag
## Release Candidate 21 (14 Mar 2021) ## Release Candidate 21 (14 Mar 2021)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21 https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21

View File

@ -347,7 +347,7 @@
<dependency> <dependency>
<groupId>com.github.seeseemelk</groupId> <groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.16</artifactId> <artifactId>MockBukkit-v1.16</artifactId>
<version>0.32.1</version> <version>0.32.2</version>
<scope>test</scope> <scope>test</scope>
<exclusions> <exclusions>
@ -420,7 +420,7 @@
<dependency> <dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.1.182</version> <version>2.1.183</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>

View File

@ -3,7 +3,6 @@ package io.github.thebusybiscuit.slimefun4.core.attributes;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -47,7 +46,7 @@ public interface DamageableItem extends ItemAttribute {
* The {@link ItemStack} to damage * The {@link ItemStack} to damage
*/ */
default void damageItem(@Nonnull Player p, @Nullable ItemStack item) { default void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
if (isDamageable() && item != null && item.getType() != Material.AIR && item.getAmount() > 0) { if (isDamageable() && item != null && !item.getType().isAir() && item.getAmount() > 0) {
int unbreakingLevel = item.getEnchantmentLevel(Enchantment.DURABILITY); int unbreakingLevel = item.getEnchantmentLevel(Enchantment.DURABILITY);
if (unbreakingLevel > 0 && Math.random() * 100 <= (60 + Math.floorDiv(40, (unbreakingLevel + 1)))) { if (unbreakingLevel > 0 && Math.random() * 100 <= (60 + Math.floorDiv(40, (unbreakingLevel + 1)))) {
@ -55,6 +54,8 @@ public interface DamageableItem extends ItemAttribute {
} }
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (!meta.isUnbreakable()) {
Damageable damageable = (Damageable) meta; Damageable damageable = (Damageable) meta;
if (damageable.getDamage() >= item.getType().getMaxDurability()) { if (damageable.getDamage() >= item.getType().getMaxDurability()) {
@ -66,5 +67,6 @@ public interface DamageableItem extends ItemAttribute {
} }
} }
} }
}
} }

View File

@ -51,9 +51,13 @@ public class ArmorForge extends AbstractCraftingTable {
} }
} }
if (inv.isEmpty()) {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.inventory-empty", true);
} else {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true); SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
} }
} }
}
private boolean isCraftable(Inventory inv, ItemStack[] recipe) { private boolean isCraftable(Inventory inv, ItemStack[] recipe) {
for (int j = 0; j < inv.getContents().length; j++) { for (int j = 0; j < inv.getContents().length; j++) {

View File

@ -50,9 +50,13 @@ public class EnhancedCraftingTable extends AbstractCraftingTable {
} }
} }
if (inv.isEmpty()) {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.inventory-empty", true);
} else {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true); SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
} }
} }
}
private void craft(Inventory inv, Block dispenser, Player p, Block b, ItemStack output) { private void craft(Inventory inv, Block dispenser, Player p, Block b, ItemStack output) {
Inventory fakeInv = createVirtualInventory(inv); Inventory fakeInv = createVirtualInventory(inv);

View File

@ -57,9 +57,13 @@ public class MagicWorkbench extends AbstractCraftingTable {
} }
} }
if (inv.isEmpty()) {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.inventory-empty", true);
} else {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true); SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
} }
} }
}
private void craft(Inventory inv, Block dispenser, Player p, Block b, ItemStack output) { private void craft(Inventory inv, Block dispenser, Player p, Block b, ItemStack output) {
Inventory fakeInv = createVirtualInventory(inv); Inventory fakeInv = createVirtualInventory(inv);

View File

@ -243,6 +243,7 @@ machines:
full-inventory: '&eSorry, my inventory is too full!' full-inventory: '&eSorry, my inventory is too full!'
in-use: '&cThis Block''s inventory is currently opened by a different Player.' in-use: '&cThis Block''s inventory is currently opened by a different Player.'
ignition-chamber-no-flint: '&cIgnition Chamber is missing Flint and Steel.' ignition-chamber-no-flint: '&cIgnition Chamber is missing Flint and Steel.'
inventory-empty: '&6You have successfully constructed this Multiblock. Proceed by placing items inside the dispenser and click me again to craft the item you want!'
ANCIENT_ALTAR: ANCIENT_ALTAR:
not-enough-pedestals: '&4The Altar is not surrounded by the needed amount of Pedestals &c(%pedestals% / 8)' not-enough-pedestals: '&4The Altar is not surrounded by the needed amount of Pedestals &c(%pedestals% / 8)'