62 lines
2.8 KiB
Diff
62 lines
2.8 KiB
Diff
|
From f63c14ecabe179632247452f7f7e8e97c141dfc7 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
|
||
|
@@ -68,7 +68,7 @@ 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) {
|
||
|
@@ -96,12 +96,14 @@ 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
|
||
|
@@ -45,4 +45,16 @@ 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
|
||
|
}
|
||
|
--
|
||
|
2.19.1
|
||
|
|