Minor cleanup upon initial block remap

This commit is contained in:
RednedEpic 2019-09-10 18:45:46 -05:00 committed by RednedEpic
parent 72589fabcd
commit 6cb80dea28
2 changed files with 5 additions and 7 deletions

View file

@ -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;
} }

View file

@ -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"));