mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Remove block tag adding to villager trading
Fixes sugar cane being untradeable.
This commit is contained in:
parent
3035527be2
commit
8a1799e0e3
3 changed files with 2 additions and 27 deletions
|
@ -132,7 +132,6 @@ public class BlockRegistryPopulator {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new AssertionError("Unable to get blocks from runtime block states", e);
|
throw new AssertionError("Unable to get blocks from runtime block states", e);
|
||||||
}
|
}
|
||||||
Map<String, NbtMap> javaIdentifierToBedrockTag = new Object2ObjectOpenHashMap<>(blocksTag.size());
|
|
||||||
// New since 1.16.100 - find the block runtime ID by the order given to us in the block palette,
|
// New since 1.16.100 - find the block runtime ID by the order given to us in the block palette,
|
||||||
// as we no longer send a block palette
|
// as we no longer send a block palette
|
||||||
Object2IntMap<NbtMap> blockStateOrderedMap = new Object2IntOpenHashMap<>(blocksTag.size());
|
Object2IntMap<NbtMap> blockStateOrderedMap = new Object2IntOpenHashMap<>(blocksTag.size());
|
||||||
|
@ -202,10 +201,6 @@ public class BlockRegistryPopulator {
|
||||||
flowerPotBlocks.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId));
|
flowerPotBlocks.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cleanJavaIdentifier.equals(entry.getValue().get("bedrock_identifier").asText())) {
|
|
||||||
javaIdentifierToBedrockTag.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId));
|
|
||||||
}
|
|
||||||
|
|
||||||
javaToBedrockBlocks[javaRuntimeId] = bedrockRuntimeId;
|
javaToBedrockBlocks[javaRuntimeId] = bedrockRuntimeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +235,6 @@ public class BlockRegistryPopulator {
|
||||||
|
|
||||||
BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion)
|
BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion)
|
||||||
.javaToBedrockBlocks(javaToBedrockBlocks)
|
.javaToBedrockBlocks(javaToBedrockBlocks)
|
||||||
.javaIdentifierToBedrockTag(javaIdentifierToBedrockTag)
|
|
||||||
.itemFrames(itemFrames)
|
.itemFrames(itemFrames)
|
||||||
.flowerPotBlocks(flowerPotBlocks)
|
.flowerPotBlocks(flowerPotBlocks)
|
||||||
.jigsawStateIds(jigsawStateIds)
|
.jigsawStateIds(jigsawStateIds)
|
||||||
|
|
|
@ -47,12 +47,6 @@ public class BlockMappings {
|
||||||
|
|
||||||
NbtList<NbtMap> bedrockBlockStates;
|
NbtList<NbtMap> bedrockBlockStates;
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains a map of Java blocks to their respective Bedrock block tag, if the Java identifier is different from Bedrock.
|
|
||||||
* Required to fix villager trades with these blocks.
|
|
||||||
*/
|
|
||||||
Map<String, NbtMap> javaIdentifierToBedrockTag;
|
|
||||||
|
|
||||||
int commandBlockRuntimeId;
|
int commandBlockRuntimeId;
|
||||||
|
|
||||||
Object2IntMap<NbtMap> itemFrames;
|
Object2IntMap<NbtMap> itemFrames;
|
||||||
|
@ -74,13 +68,4 @@ public class BlockMappings {
|
||||||
public boolean isItemFrame(int bedrockBlockRuntimeId) {
|
public boolean isItemFrame(int bedrockBlockRuntimeId) {
|
||||||
return this.itemFrames.values().contains(bedrockBlockRuntimeId);
|
return this.itemFrames.values().contains(bedrockBlockRuntimeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param cleanJavaIdentifier the clean Java identifier of the block to look up
|
|
||||||
*
|
|
||||||
* @return the block tag of the block name mapped from Java to Bedrock.
|
|
||||||
*/
|
|
||||||
public NbtMap getBedrockBlockNbt(String cleanJavaIdentifier) {
|
|
||||||
return this.javaIdentifierToBedrockTag.get(cleanJavaIdentifier);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -178,12 +178,8 @@ public class JavaMerchantOffersTranslator extends PacketTranslator<ClientboundMe
|
||||||
builder.put("tag", tag);
|
builder.put("tag", tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
NbtMap blockTag = session.getBlockMappings().getBedrockBlockNbt(mapping.getJavaIdentifier());
|
// Implementation note: previously we added a block tag to fix some blocks (black concrete?) that wouldn't stack
|
||||||
if (blockTag != null) {
|
// after buying. This no longer seems to be an issue as of Bedrock 1.18.30, and including it breaks sugar canes.
|
||||||
// This fixes certain blocks being unable to stack after grabbing one
|
|
||||||
builder.putCompound("Block", blockTag);
|
|
||||||
builder.putShort("Damage", (short) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue