SPIGOT-5293: Sponge behaviour differs from Vanilla

This commit is contained in:
md_5 2019-08-28 20:10:04 +10:00
parent e91fd75e19
commit 8d4bc54183
2 changed files with 24 additions and 2 deletions

View File

@ -21,7 +21,16 @@
while (!queue.isEmpty()) { while (!queue.isEmpty()) {
Tuple<BlockPosition, Integer> tuple = (Tuple) queue.poll(); Tuple<BlockPosition, Integer> tuple = (Tuple) queue.poll();
@@ -51,22 +58,24 @@ @@ -46,27 +53,31 @@
for (int l = 0; l < k; ++l) {
EnumDirection enumdirection = aenumdirection[l];
BlockPosition blockposition2 = blockposition1.shift(enumdirection);
- IBlockData iblockdata = world.getType(blockposition2);
- Fluid fluid = world.getFluid(blockposition2);
+ // CraftBukkit start
+ IBlockData iblockdata = blockList.getType(blockposition2);
+ Fluid fluid = blockList.getFluid(blockposition2);
+ // CraftBukkit end
Material material = iblockdata.getMaterial(); Material material = iblockdata.getMaterial();
if (fluid.a(TagsFluid.WATER)) { if (fluid.a(TagsFluid.WATER)) {
@ -51,7 +60,7 @@
++i; ++i;
if (j < 6) { if (j < 6) {
queue.add(new Tuple<>(blockposition2, j + 1)); queue.add(new Tuple<>(blockposition2, j + 1));
@@ -79,6 +88,39 @@ @@ -79,6 +90,39 @@
break; break;
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import net.minecraft.server.BlockPosition; import net.minecraft.server.BlockPosition;
import net.minecraft.server.Fluid;
import net.minecraft.server.IBlockData; import net.minecraft.server.IBlockData;
import net.minecraft.server.World; import net.minecraft.server.World;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -23,6 +24,18 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
this.list = list; this.list = list;
} }
@Override
public IBlockData getType(BlockPosition bp) {
CraftBlockState state = list.get(bp);
return (state != null) ? state.getHandle() : world.getType(bp);
}
@Override
public Fluid getFluid(BlockPosition bp) {
CraftBlockState state = list.get(bp);
return (state != null) ? state.getHandle().p() : world.getFluid(bp);
}
@Override @Override
public boolean setTypeAndData(BlockPosition position, IBlockData data, int flag) { public boolean setTypeAndData(BlockPosition position, IBlockData data, int flag) {
CraftBlockState state = CraftBlockState.getBlockState(world, position, flag); CraftBlockState state = CraftBlockState.getBlockState(world, position, flag);