Skip to content

Commit

Permalink
Don't use dim change enum pre 1.20.70
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Castle <[email protected]>
  • Loading branch information
Kas-tle committed Mar 11, 2024
1 parent 9ac44f1 commit ce08afd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public static boolean isPre1_20_50(GeyserSession session) {
return session.getUpstream().getProtocolVersion() < Bedrock_v630.CODEC.getProtocolVersion();
}

public static boolean isPre1_20_70(GeyserSession session) {
return session.getUpstream().getProtocolVersion() < Bedrock_v662.CODEC.getProtocolVersion();
}

public static boolean is1_20_60orHigher(int protocolVersion) {
return protocolVersion >= Bedrock_v649.CODEC.getProtocolVersion();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.level.block.BlockStateValues;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.registry.type.BlockMapping;
import org.geysermc.geyser.registry.type.ItemMapping;
Expand Down Expand Up @@ -333,6 +334,10 @@ public void translate(GeyserSession session, PlayerActionPacket packet) {
session.sendDownstreamGamePacket(new ServerboundPlayerAbilitiesPacket(false));
break;
case DIMENSION_CHANGE_REQUEST_OR_CREATIVE_DESTROY_BLOCK: // Used by client to get book from lecterns and items from item frame in creative mode since 1.20.70
if (GameProtocol.isPre1_20_70(session)) {
break;
}

int interactedBlock = session.getGeyser().getWorldManager().getBlockAt(session, vector);

if (BlockStateValues.getLecternBookStates().getOrDefault(interactedBlock, false)) {
Expand Down

0 comments on commit ce08afd

Please sign in to comment.