Misc 1.20 fixes (#3828)

* Update mappings

diff: f69b4db9a6...2989dbd7e1

* 1.20 boat entity variants and remove old check in UpstreamPacketHandler
This commit is contained in:
Konicai 2023-06-08 10:23:27 -04:00 committed by GitHub
parent 8b8d6ddb9e
commit 4ab9eb4920
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 16 deletions

View file

@ -125,8 +125,8 @@ public class BoatEntity extends Entity {
public void setVariant(IntEntityMetadata entityMetadata) { public void setVariant(IntEntityMetadata entityMetadata) {
variant = entityMetadata.getPrimitiveValue(); variant = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityDataTypes.VARIANT, switch (variant) { dirtyMetadata.put(EntityDataTypes.VARIANT, switch (variant) {
case 6, 7 -> variant - 1; // Dark oak and mangrove case 6, 7, 8 -> variant - 1; // dark_oak, mangrove, bamboo
case 5, 8 -> 0; // TODO temp until 1.20. Cherry and bamboo case 5 -> 8; // cherry
default -> variant; default -> variant;
}); });
} }

View file

@ -85,8 +85,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
return translateAndDefault(packet); return translateAndDefault(packet);
} }
private boolean newProtocol = false; // TEMPORARY
private boolean setCorrectCodec(int protocolVersion) { private boolean setCorrectCodec(int protocolVersion) {
BedrockCodec packetCodec = GameProtocol.getBedrockCodec(protocolVersion); BedrockCodec packetCodec = GameProtocol.getBedrockCodec(protocolVersion);
if (packetCodec == null) { if (packetCodec == null) {
@ -125,9 +123,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
@Override @Override
public PacketSignal handle(RequestNetworkSettingsPacket packet) { public PacketSignal handle(RequestNetworkSettingsPacket packet) {
if (setCorrectCodec(packet.getProtocolVersion())) { if (!setCorrectCodec(packet.getProtocolVersion())) {
newProtocol = true;
} else {
return PacketSignal.HANDLED; return PacketSignal.HANDLED;
} }
@ -152,14 +148,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
return PacketSignal.HANDLED; return PacketSignal.HANDLED;
} }
// session.getUpstream().getSession().getCodec() == null
if (!newProtocol) {
if (!setCorrectCodec(loginPacket.getProtocolVersion())) { // REMOVE WHEN ONLY 1.19.30 IS SUPPORTED OR 1.20
return PacketSignal.HANDLED;
}
}
// Set the block translation based off of version // Set the block translation based off of version
session.setBlockMappings(BlockRegistries.BLOCKS.forVersion(loginPacket.getProtocolVersion())); session.setBlockMappings(BlockRegistries.BLOCKS.forVersion(loginPacket.getProtocolVersion()));
session.setItemMappings(Registries.ITEMS.forVersion(loginPacket.getProtocolVersion())); session.setItemMappings(Registries.ITEMS.forVersion(loginPacket.getProtocolVersion()));

@ -1 +1 @@
Subproject commit f69b4db9a6f0e8fff8b29564195c76074210b924 Subproject commit 7800f07692d8636a58ac8611ae6fa7b8d3d3a3b3