This commit is contained in:
BuildTools 2023-09-21 15:30:32 +05:00
parent f5109635ff
commit fe8108ca62
11 changed files with 26 additions and 24 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>3.5.6</version>
<version>3.5.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -81,27 +81,27 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_17_R1</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_18_R2</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_19_R3</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_20_R1</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
</dependencies>

View File

@ -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;
}

View File

@ -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();

View File

@ -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) {

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>3.5.6</version>
<version>3.5.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>3.5.6</version>
<version>3.5.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -26,7 +26,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>3.5.6</version>
<version>3.5.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -26,7 +26,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>3.5.6</version>
<version>3.5.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -26,7 +26,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>3.5.6</version>
<version>3.5.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -26,7 +26,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>3.5.6</version>
<version>3.5.7</version>
</dependency>
</dependencies>

View File

@ -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);
}

View File

@ -7,7 +7,7 @@
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>ExcellentEnchants</artifactId>
<packaging>pom</packaging>
<version>3.5.6</version>
<version>3.5.7</version>
<modules>
<module>Core</module>
<module>NMS</module>