#877: Improve and simplify CraftBlockState
By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFire.java
|
||||
@@ -28,6 +28,13 @@
|
||||
@@ -28,6 +28,14 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlockStates;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.block.BlockBurnEvent;
|
||||
+import org.bukkit.event.block.BlockFadeEvent;
|
||||
@@ -14,7 +15,7 @@
|
||||
public class BlockFire extends BlockFireAbstract {
|
||||
|
||||
public static final int MAX_AGE = 15;
|
||||
@@ -93,7 +100,24 @@
|
||||
@@ -93,7 +101,24 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
@@ -25,7 +26,7 @@
|
||||
+ if (!(generatoraccess instanceof World)) {
|
||||
+ return Blocks.AIR.getBlockData();
|
||||
+ }
|
||||
+ CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition);
|
||||
+ CraftBlockState blockState = CraftBlockStates.getBlockState(generatoraccess, blockposition);
|
||||
+ blockState.setData(Blocks.AIR.getBlockData());
|
||||
+
|
||||
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||
@@ -40,7 +41,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,7 +166,7 @@
|
||||
@@ -142,7 +167,7 @@
|
||||
worldserver.getBlockTickList().a(blockposition, this, a(worldserver.random));
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||
if (!iblockdata.canPlace(worldserver, blockposition)) {
|
||||
@@ -49,7 +50,7 @@
|
||||
}
|
||||
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition.down());
|
||||
@@ -150,7 +174,7 @@
|
||||
@@ -150,7 +175,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockFire.AGE);
|
||||
|
||||
if (!flag && worldserver.isRaining() && this.a((World) worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
|
||||
@@ -58,7 +59,7 @@
|
||||
} else {
|
||||
int j = Math.min(15, i + random.nextInt(3) / 2);
|
||||
|
||||
@@ -164,14 +188,14 @@
|
||||
@@ -164,14 +189,14 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
|
||||
if (!worldserver.getType(blockposition1).d(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
|
||||
@@ -75,7 +76,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -179,12 +203,14 @@
|
||||
@@ -179,12 +204,14 @@
|
||||
boolean flag1 = worldserver.u(blockposition);
|
||||
int k = flag1 ? -50 : 0;
|
||||
|
||||
@@ -96,7 +97,7 @@
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
|
||||
for (int l = -1; l <= 1; ++l) {
|
||||
@@ -210,7 +236,15 @@
|
||||
@@ -210,7 +237,15 @@
|
||||
if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.a((World) worldserver, (BlockPosition) blockposition_mutableblockposition))) {
|
||||
int j2 = Math.min(15, i + random.nextInt(5) / 4);
|
||||
|
||||
@@ -113,7 +114,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,12 +268,24 @@
|
||||
@@ -234,12 +269,24 @@
|
||||
return iblockdata.b(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.get(BlockProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(iblockdata.getBlock());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user