diff --git a/Core/pom.xml b/Core/pom.xml
index 85b949f..2d2e185 100644
--- a/Core/pom.xml
+++ b/Core/pom.xml
@@ -5,7 +5,7 @@
ExcellentEnchants
su.nightexpress.excellentenchants
- 3.5.6
+ 3.5.7
4.0.0
@@ -81,27 +81,27 @@
su.nightexpress.excellentenchants
NMS
- 3.5.6
+ 3.5.7
su.nightexpress.excellentenchants
V1_17_R1
- 3.5.6
+ 3.5.7
su.nightexpress.excellentenchants
V1_18_R2
- 3.5.6
+ 3.5.7
su.nightexpress.excellentenchants
V1_19_R3
- 3.5.6
+ 3.5.7
su.nightexpress.excellentenchants
V1_20_R1
- 3.5.6
+ 3.5.7
diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java
index 434afc0..f00a733 100644
--- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java
+++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java
@@ -141,18 +141,16 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha
// Добавляем в сундук обратно предметы из дроп листа, кроме самого сундука.
event.getItems().removeIf(drop -> drop.getItemStack().getType() == state.getType() && drop.getItemStack().getAmount() == 1);
chest.getBlockInventory().addItem(event.getItems().stream().map(Item::getItemStack).toList().toArray(new ItemStack[0]));
+ event.getItems().clear();
if (chest.getBlockInventory().isEmpty()) {
EnchantUtils.popResource(event, new ItemStack(chest.getType()));
return false;
}
- // Добавляем кастомный сундук в кастомный дроп лист.
EnchantUtils.popResource(event, this.getSilkChest(chest));
- // Очищаем инвентарь сундука и дефолтный дроп лист.
chest.getBlockInventory().clear();
- event.getItems().clear();
return true;
}
diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java
index 34aa611..4572fed 100644
--- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java
+++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java
@@ -89,8 +89,7 @@ public class EnchantSmelter extends ExcellentEnchant implements Chanced, BlockDr
@Override
public boolean onDrop(@NotNull BlockDropItemEvent event, @NotNull Player player, @NotNull ItemStack item, int level) {
- // TODO Use furnace recipes
- // TODO Re-add smelted items instead of setType
+ // TODO Use furnace recipes & Re-add smelted items instead of setType
if (event.getBlockState() instanceof Container) return false;
if (!this.isAvailableToUse(player)) return false;
@@ -99,7 +98,11 @@ public class EnchantSmelter extends ExcellentEnchant implements Chanced, BlockDr
event.getItems().forEach(drop -> {
Material material = this.smeltingTable.get(drop.getItemStack().getType());
- if (material != null) drop.getItemStack().setType(material);
+ if (material != null) {
+ ItemStack stack = drop.getItemStack();
+ stack.setType(material);
+ drop.setItemStack(stack);
+ }
});
Block block = event.getBlockState().getBlock();
diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/util/EnchantUtils.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/util/EnchantUtils.java
index c781005..c039999 100644
--- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/util/EnchantUtils.java
+++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/util/EnchantUtils.java
@@ -347,7 +347,7 @@ public class EnchantUtils {
public static void consumeCharges(@NotNull ItemStack item, @NotNull ExcellentEnchant enchant, int level) {
int has = getCharges(item, enchant);
int use = enchant.getChargesConsumeAmount(level);
- setCharges(item, enchant, level,has - use);
+ setCharges(item, enchant, level,has < use ? 0 : has - use);
}
/*public static void restoreCharges(@NotNull ItemStack item, @NotNull ExcellentEnchant enchant) {
diff --git a/NMS/pom.xml b/NMS/pom.xml
index f54595a..1d7f568 100644
--- a/NMS/pom.xml
+++ b/NMS/pom.xml
@@ -5,7 +5,7 @@
ExcellentEnchants
su.nightexpress.excellentenchants
- 3.5.6
+ 3.5.7
4.0.0
diff --git a/V1_17_R1/pom.xml b/V1_17_R1/pom.xml
index 75bb700..e8ecc1c 100644
--- a/V1_17_R1/pom.xml
+++ b/V1_17_R1/pom.xml
@@ -5,7 +5,7 @@
ExcellentEnchants
su.nightexpress.excellentenchants
- 3.5.6
+ 3.5.7
4.0.0
@@ -26,7 +26,7 @@
su.nightexpress.excellentenchants
NMS
- 3.5.6
+ 3.5.7
diff --git a/V1_18_R2/pom.xml b/V1_18_R2/pom.xml
index cbdb8ee..81b4e3c 100644
--- a/V1_18_R2/pom.xml
+++ b/V1_18_R2/pom.xml
@@ -5,7 +5,7 @@
ExcellentEnchants
su.nightexpress.excellentenchants
- 3.5.6
+ 3.5.7
4.0.0
@@ -26,7 +26,7 @@
su.nightexpress.excellentenchants
NMS
- 3.5.6
+ 3.5.7
diff --git a/V1_19_R3/pom.xml b/V1_19_R3/pom.xml
index 5069b45..83f488a 100644
--- a/V1_19_R3/pom.xml
+++ b/V1_19_R3/pom.xml
@@ -5,7 +5,7 @@
ExcellentEnchants
su.nightexpress.excellentenchants
- 3.5.6
+ 3.5.7
4.0.0
@@ -26,7 +26,7 @@
su.nightexpress.excellentenchants
NMS
- 3.5.6
+ 3.5.7
diff --git a/V1_20_R1/pom.xml b/V1_20_R1/pom.xml
index 92dc538..d2cec44 100644
--- a/V1_20_R1/pom.xml
+++ b/V1_20_R1/pom.xml
@@ -5,7 +5,7 @@
ExcellentEnchants
su.nightexpress.excellentenchants
- 3.5.6
+ 3.5.7
4.0.0
@@ -26,7 +26,7 @@
su.nightexpress.excellentenchants
NMS
- 3.5.6
+ 3.5.7
diff --git a/V1_20_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_20_R1/V1_20_R1.java b/V1_20_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_20_R1/V1_20_R1.java
index ee8f237..a8acb5c 100644
--- a/V1_20_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_20_R1/V1_20_R1.java
+++ b/V1_20_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_20_R1/V1_20_R1.java
@@ -3,6 +3,7 @@ package su.nightexpress.excellentenchants.nms.v1_20_R1;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
import net.minecraft.server.level.ServerLevel;
+import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -40,7 +41,7 @@ public class V1_20_R1 implements EnchantNMS {
@Override
public void sendAttackPacket(@NotNull Player player, int id) {
CraftPlayer craftPlayer = (CraftPlayer) player;
- Entity entity = craftPlayer.getHandle();
+ ServerPlayer entity = craftPlayer.getHandle();
ClientboundAnimatePacket packet = new ClientboundAnimatePacket(entity, id);
craftPlayer.getHandle().connection.send(packet);
}
diff --git a/pom.xml b/pom.xml
index 48acfd6..1c9ab8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
su.nightexpress.excellentenchants
ExcellentEnchants
pom
- 3.5.6
+ 3.5.7
Core
NMS