PaperMC/Spigot-Server-Patches/Extend-BlockStateListPopulator.patch
Shane Freeder 4d266118e2 Extend BlockStateListPopulator
extends BlockStateListPopulator to suppport checking block types in the
physical world it's representing, allowing for blocks making modifications
to the world to maintain proper state.
2018-11-08 05:37:12 +00:00

59 lines
No EOL
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 8 Nov 2018 04:53:00 +0000
Subject: [PATCH] Extend BlockStateListPopulator
extends BlockStateListPopulator to suppport checking block types in the
physical world it's representing, allowing for blocks making modifications
to the world to maintain proper state.
diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java
index 987af9c3de..6e52d46952 100644
--- a/src/main/java/net/minecraft/server/BlockSponge.java
+++ b/src/main/java/net/minecraft/server/BlockSponge.java
@@ -0,0 +0,0 @@ public class BlockSponge extends Block {
linkedlist.add(new Tuple(blockposition2, Integer.valueOf(j + 1)));
}
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
- // iblockdata.a(world, blockposition2, 0);
+ iblockdata.a(blockList, blockposition2, 0); // Paper
blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); // CraftBukkit
++i;
if (j < 6) {
@@ -0,0 +0,0 @@ public class BlockSponge extends Block {
for (CraftBlockState block : blocks) {
BlockPosition blockposition2 = new BlockPosition(block.getX(), block.getY(), block.getZ());
+ /* // Paper start
IBlockData iblockdata = world.getType(blockposition2);
Material material = iblockdata.getMaterial();
if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
iblockdata.a(world, blockposition2, 0);
}
+ */ // Paper end
world.setTypeAndData(blockposition2, block.getHandle(), block.getFlag());
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
index 165843ddfe..c5612b2f43 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
@@ -0,0 +0,0 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
public World getWorld() {
return world;
}
+
+ // Paper start
+ @Override
+ public IBlockData getType(BlockPosition bp) {
+ CraftBlockState craftState = list.get(bp);
+ if (craftState != null) {
+ return craftState.getHandle();
+ } else {
+ return world.getType(bp);
+ }
+ }
+ // paper end
}
--