#877: Improve and simplify CraftBlockState

By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
CraftBukkit/Spigot
2021-09-29 18:56:16 +10:00
parent 65625f410c
commit f27c8f74f8
47 changed files with 591 additions and 977 deletions

View File

@@ -1,18 +1,19 @@
--- a/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -17,6 +17,11 @@
@@ -17,6 +17,12 @@
import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypes;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlockState;
+import org.bukkit.craftbukkit.block.CraftBlockStates;
+import org.bukkit.event.block.CauldronLevelChangeEvent;
+// CraftBukkit end
+
public class LayeredCauldronBlock extends AbstractCauldronBlock {
public static final int MIN_FILL_LEVEL = 1;
@@ -56,10 +61,14 @@
@@ -56,10 +62,14 @@
@Override
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!world.isClientSide && entity.isBurning() && this.a(iblockdata, blockposition, entity)) {
@@ -29,7 +30,7 @@
}
}
@@ -69,15 +78,38 @@
@@ -69,15 +79,38 @@
}
public static void e(IBlockData iblockdata, World world, BlockPosition blockposition) {
@@ -46,7 +47,7 @@
+ // CraftBukkit start
+ public static boolean changeLevel(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
+ CraftBlockState newState = CraftBlockState.getBlockState(world, blockposition);
+ CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition);
+ newState.setData(newBlock);
+
+ CauldronLevelChangeEvent event = new CauldronLevelChangeEvent(
@@ -70,7 +71,7 @@
}
}
@@ -94,7 +126,11 @@
@@ -94,7 +127,11 @@
@Override
protected void a(IBlockData iblockdata, World world, BlockPosition blockposition, FluidType fluidtype) {
if (!this.c(iblockdata)) {