mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-25 18:09:28 +00:00
3.5.7
This commit is contained in:
@@ -2660,6 +2660,9 @@ public class ItemManagerImpl implements ItemManager {
|
||||
Pot currentPot = getPotByBlock(block);
|
||||
if (currentPot != pot) {
|
||||
plugin.getWorldManager().removePotAt(SimpleLocation.of(location));
|
||||
if (currentPot != null) {
|
||||
plugin.getWorldManager().addPotAt(new MemoryPot(SimpleLocation.of(location), currentPot.getKey()), SimpleLocation.of(location));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pot.isVanillaBlock()) {
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ItemUtils {
|
||||
public static void increaseDurability(ItemStack itemStack, int amount) {
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR)
|
||||
return;
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack);
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack.clone());
|
||||
int damage = Math.max(item.damage().orElse(0) - amount, 0);
|
||||
item.damage(damage);
|
||||
itemStack.setItemMeta(item.load().getItemMeta());
|
||||
@@ -104,7 +104,7 @@ public class ItemUtils {
|
||||
if (Math.random() > (double) 1 / (unBreakingLevel + 1)) {
|
||||
return;
|
||||
}
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack);
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack.clone());
|
||||
int damage = item.damage().orElse(0) + amount;
|
||||
if (damage > item.maxDamage().orElse((int) itemStack.getType().getMaxDurability())) {
|
||||
itemStack.setAmount(0);
|
||||
|
||||
Reference in New Issue
Block a user