Access world manager instead of chunk cache to fix particles on Bukkit version

This commit is contained in:
RednedEpic 2020-04-29 15:56:41 -05:00
parent 364aac7e1a
commit 4d32f6ab70
3 changed files with 4 additions and 4 deletions

View file

@ -116,7 +116,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
session.getDownstream().getSession().send(useItemPacket);
break;
case 2:
BlockState blockState = session.getChunkCache().getBlockAt(new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()));
BlockState blockState = session.getConnector().getWorldManager().getBlockAt(session, packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ());
double blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(blockState.getId());
if (session.getGameMode() == GameMode.CREATIVE || (session.getConnector().getConfig().isCacheChunks() && blockHardness == 0)) {
session.setLastBlockPlacedId(null);

View file

@ -112,7 +112,7 @@ public class DoubleChestInventoryTranslator extends BaseInventoryTranslator {
public void closeInventory(GeyserSession session, Inventory inventory) {
Vector3i holderPos = inventory.getHolderPosition();
Position pos = new Position(holderPos.getX(), holderPos.getY(), holderPos.getZ());
BlockState realBlock = session.getChunkCache().getBlockAt(pos);
BlockState realBlock = session.getConnector().getWorldManager().getBlockAt(session, pos.getX(), pos.getY(), pos.getZ());
UpdateBlockPacket blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(holderPos);
@ -121,7 +121,7 @@ public class DoubleChestInventoryTranslator extends BaseInventoryTranslator {
holderPos = holderPos.add(Vector3i.UNIT_X);
pos = new Position(holderPos.getX(), holderPos.getY(), holderPos.getZ());
realBlock = session.getChunkCache().getBlockAt(pos);
realBlock = session.getConnector().getWorldManager().getBlockAt(session, pos.getX(), pos.getY(), pos.getZ());
blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(holderPos);

View file

@ -82,7 +82,7 @@ public class BlockInventoryHolder extends InventoryHolder {
public void closeInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) {
Vector3i holderPos = inventory.getHolderPosition();
Position pos = new Position(holderPos.getX(), holderPos.getY(), holderPos.getZ());
BlockState realBlock = session.getChunkCache().getBlockAt(pos);
BlockState realBlock = session.getConnector().getWorldManager().getBlockAt(session, pos.getX(), pos.getY(), pos.getZ());
UpdateBlockPacket blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(holderPos);