3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-08 17:20:20 +01:00
Dieser Commit ist enthalten in:
AJ Ferguson 2019-12-23 17:00:31 -09:00
Ursprung 8061e2d76d
Commit 46205600dd
8 geänderte Dateien mit 19 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -183,9 +183,9 @@ public class TranslatorsInit {
inventoryTranslators.put(WindowType.BLAST_FURNACE, furnace);
inventoryTranslators.put(WindowType.SMOKER, furnace);
inventoryTranslators.put(WindowType.GENERIC_3X3, new BlockInventoryTranslator(9, 23 << 4, ContainerType.DISPENSER));
inventoryTranslators.put(WindowType.HOPPER, new BlockInventoryTranslator(5, 154 << 4, ContainerType.HOPPER));
inventoryTranslators.put(WindowType.SHULKER_BOX, new BlockInventoryTranslator(27, 205 << 4, ContainerType.CONTAINER));
//inventoryTranslators.put(WindowType.BEACON, new BlockInventoryTranslator(1, 138 << 4, ContainerType.BEACON)); //TODO
inventoryTranslators.put(WindowType.GENERIC_3X3, new BlockInventoryTranslator(9, "minecraft:dispenser[facing=north,triggered=false]", ContainerType.DISPENSER));
inventoryTranslators.put(WindowType.HOPPER, new BlockInventoryTranslator(5, "minecraft:hopper[enabled=false,facing=down]", ContainerType.HOPPER));
inventoryTranslators.put(WindowType.SHULKER_BOX, new BlockInventoryTranslator(27, "minecraft:shulker_box[facing=north]", ContainerType.CONTAINER));
//inventoryTranslators.put(WindowType.BEACON, new BlockInventoryTranslator(1, "minecraft:beacon", ContainerType.BEACON)); //TODO
}
}

Datei anzeigen

@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.InventoryAction;
public class AnvilInventoryTranslator extends BlockInventoryTranslator {
public AnvilInventoryTranslator() {
super(3, 145 << 4, ContainerType.ANVIL);
super(3, "minecraft:anvil[facing=north]", ContainerType.ANVIL);
}
@Override

Datei anzeigen

@ -34,16 +34,16 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.TranslatorsInit;
import org.geysermc.connector.network.translators.block.BlockEntry;
import org.geysermc.connector.world.GlobalBlockPalette;
public class BlockInventoryTranslator extends ContainerInventoryTranslator {
final int blockId;
private final ContainerType containerType;
public BlockInventoryTranslator(int size, int blockId, ContainerType containerType) {
public BlockInventoryTranslator(int size, String javaBlockIdentifier, ContainerType containerType) {
super(size);
this.blockId = blockId;
this.blockId = TranslatorsInit.getBlockTranslator().getBlockEntry(javaBlockIdentifier).getBedrockRuntimeId();
this.containerType = containerType;
}
@ -54,7 +54,7 @@ public class BlockInventoryTranslator extends ContainerInventoryTranslator {
UpdateBlockPacket blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(position);
blockPacket.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(blockId));
blockPacket.setRuntimeId(blockId);
blockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY);
session.getUpstream().sendPacket(blockPacket);
inventory.setHolderPosition(position);
@ -88,7 +88,7 @@ public class BlockInventoryTranslator extends ContainerInventoryTranslator {
UpdateBlockPacket blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(holderPos);
blockPacket.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(realBlock.getBedrockId() << 4 | realBlock.getBedrockData()));
blockPacket.setRuntimeId(realBlock.getBedrockRuntimeId());
session.getUpstream().sendPacket(blockPacket);
}
}

Datei anzeigen

@ -33,7 +33,7 @@ import org.geysermc.connector.network.session.GeyserSession;
public class BrewingStandInventoryTranslator extends BlockInventoryTranslator {
public BrewingStandInventoryTranslator() {
super(5, 117 << 4, ContainerType.BREWING_STAND);
super(5, "minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=false,has_bottle_2=false]", ContainerType.BREWING_STAND);
}
@Override

Datei anzeigen

@ -37,11 +37,10 @@ import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.TranslatorsInit;
import org.geysermc.connector.network.translators.block.BlockEntry;
import org.geysermc.connector.world.GlobalBlockPalette;
public class DoubleChestInventoryTranslator extends BlockInventoryTranslator {
public DoubleChestInventoryTranslator(int size) {
super(size, 54 << 4, ContainerType.CONTAINER);
super(size, "minecraft:chest[facing=north,type=single,waterlogged=false]", ContainerType.CONTAINER);
}
@Override
@ -51,7 +50,7 @@ public class DoubleChestInventoryTranslator extends BlockInventoryTranslator {
UpdateBlockPacket blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(position);
blockPacket.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(blockId));
blockPacket.setRuntimeId(blockId);
blockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY);
session.getUpstream().sendPacket(blockPacket);
@ -71,7 +70,7 @@ public class DoubleChestInventoryTranslator extends BlockInventoryTranslator {
blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(pairPosition);
blockPacket.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(blockId));
blockPacket.setRuntimeId(blockId);
blockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY);
session.getUpstream().sendPacket(blockPacket);
@ -99,7 +98,7 @@ public class DoubleChestInventoryTranslator extends BlockInventoryTranslator {
UpdateBlockPacket blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(holderPos);
blockPacket.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(realBlock.getBedrockId() << 4 | realBlock.getBedrockData()));
blockPacket.setRuntimeId(realBlock.getBedrockRuntimeId());
session.getUpstream().sendPacket(blockPacket);
holderPos = holderPos.add(Vector3i.UNIT_X);
@ -108,7 +107,7 @@ public class DoubleChestInventoryTranslator extends BlockInventoryTranslator {
blockPacket = new UpdateBlockPacket();
blockPacket.setDataLayer(0);
blockPacket.setBlockPosition(holderPos);
blockPacket.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(realBlock.getBedrockId() << 4 | realBlock.getBedrockData()));
blockPacket.setRuntimeId(realBlock.getBedrockRuntimeId());
session.getUpstream().sendPacket(blockPacket);
}

Datei anzeigen

@ -31,7 +31,7 @@ import org.geysermc.connector.network.session.GeyserSession;
public class EnchantmentInventoryTranslator extends BlockInventoryTranslator {
public EnchantmentInventoryTranslator() {
super(2, 116 << 4, ContainerType.ENCHANTMENT);
super(2, "minecraft:enchanting_table", ContainerType.ENCHANTMENT);
}
@Override

Datei anzeigen

@ -33,7 +33,7 @@ import org.geysermc.connector.network.session.GeyserSession;
public class FurnaceInventoryTranslator extends BlockInventoryTranslator {
public FurnaceInventoryTranslator() {
super(3, 61 << 4, ContainerType.FURNACE);
super(3, "minecraft:furnace[facing=north,lit=false]", ContainerType.FURNACE);
}
@Override

Datei anzeigen

@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.TranslatorsInit;
public class SingleChestInventoryTranslator extends BlockInventoryTranslator {
public SingleChestInventoryTranslator(int size) {
super(size, 54 << 4, ContainerType.CONTAINER);
super(size, "minecraft:chest[facing=north,type=single,waterlogged=false]", ContainerType.CONTAINER);
}
@Override