3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01:00

Minor cleanup upon initial block remap

Dieser Commit ist enthalten in:
RednedEpic 2019-09-10 18:45:46 -05:00 committet von RednedEpic
Ursprung 72589fabcd
Commit 6cb80dea28
2 geänderte Dateien mit 5 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -99,7 +99,7 @@ public class ItemTranslator {
public BedrockItem getBedrockBlock(BlockState state) { public BedrockItem getBedrockBlock(BlockState state) {
BedrockItem bedrockItem = Remapper.BLOCK_REMAPPER.convertToBedrock(new ItemStack(state.getId())); BedrockItem bedrockItem = Remapper.BLOCK_REMAPPER.convertToBedrock(new ItemStack(state.getId()));
if (bedrockItem == null) { if (bedrockItem == null) {
//GeyserLogger.DEFAULT.debug("Missing mapping for java item " + state.getId()); // GeyserLogger.DEFAULT.debug("Missing mapping for java block " + state.getId());
return BedrockItem.AIR; return BedrockItem.AIR;
} }

Datei anzeigen

@ -31,15 +31,13 @@ public class Toolbox {
Map<String, BedrockItem> bedrockBlocks = new HashMap<>(); Map<String, BedrockItem> bedrockBlocks = new HashMap<>();
Map<String, BedrockItem> bedrockItems = new HashMap<>(); Map<String, BedrockItem> bedrockItems = new HashMap<>();
for (Map<String, Object> e : entries) {
BedrockItem bedrockItem = new BedrockItem((String) e.get("name"), (int) e.get("id"), (int) e.get("data"));
bedrockBlocks.put(bedrockItem.getIdentifier(), bedrockItem);
bedrockItems.put(bedrockItem.getIdentifier() + ":" + bedrockItem.getData(), bedrockItem);
}
ByteBuf b = Unpooled.buffer(); ByteBuf b = Unpooled.buffer();
VarInts.writeUnsignedInt(b, entries.size()); VarInts.writeUnsignedInt(b, entries.size());
for (Map<String, Object> e : entries) { for (Map<String, Object> e : entries) {
BedrockItem bedrockItem = new BedrockItem((String) e.get("name"), (int) e.get("id"), (int) e.get("data"));
bedrockItems.put(bedrockItem.getIdentifier() + ":" + bedrockItem.getData(), bedrockItem);
bedrockBlocks.put(bedrockItem.getIdentifier() + ":" + bedrockItem.getData(), bedrockItem);
GlobalBlockPalette.registerMapping((int) e.get("id") << 4 | (int) e.get("data")); GlobalBlockPalette.registerMapping((int) e.get("id") << 4 | (int) e.get("data"));
BedrockUtils.writeString(b, (String) e.get("name")); BedrockUtils.writeString(b, (String) e.get("name"));
b.writeShortLE((int) e.get("data")); b.writeShortLE((int) e.get("data"));