mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
use a different method for dropping lapis, closes #1692
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/EnchantingTableBlock.java
|
||||
+++ b/net/minecraft/world/level/block/EnchantingTableBlock.java
|
||||
@@ -119,4 +_,16 @@
|
||||
protected boolean isPathfindable(BlockState state, PathComputationType pathComputationType) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Enchantment Table Persists Lapis
|
||||
+ @Override
|
||||
+ protected void affectNeighborsAfterRemoval(BlockState state, net.minecraft.server.level.ServerLevel level, BlockPos pos, boolean movedByPiston) {
|
||||
+ BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||
+
|
||||
+ if (level.purpurConfig.enchantmentTableLapisPersists && blockEntity instanceof EnchantingTableBlockEntity enchantmentTable) {
|
||||
+ net.minecraft.world.Containers.dropItemStack(level, pos.getX(), pos.getY(), pos.getZ(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.LAPIS_LAZULI, enchantmentTable.getLapis()));
|
||||
+ net.minecraft.world.Containers.updateNeighboursAfterDestroy(state, level, pos);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Enchantment Table Persists Lapis
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
public static void bookAnimationTick(Level level, BlockPos pos, BlockState state, EnchantingTableBlockEntity enchantingTable) {
|
||||
@@ -136,4 +_,14 @@
|
||||
@@ -136,4 +_,22 @@
|
||||
public void removeComponentsFromTag(ValueOutput output) {
|
||||
output.discard("CustomName");
|
||||
}
|
||||
@@ -36,5 +36,13 @@
|
||||
+ public void setLapis(int lapis) {
|
||||
+ this.lapis = lapis;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void preRemoveSideEffects(BlockPos pos, BlockState state) {
|
||||
+ super.preRemoveSideEffects(pos, state);
|
||||
+ if (this.level != null && this.level.purpurConfig.enchantmentTableLapisPersists) {
|
||||
+ net.minecraft.world.Containers.dropItemStack(this.level, pos.getX(), pos.getY(), pos.getZ(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.LAPIS_LAZULI, this.getLapis()));
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Enchantment Table Persists Lapis
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user