Drop <1.20.50

This commit is contained in:
Konicai 2023-11-27 07:37:29 -05:00
parent a89aa4e064
commit f38d82c19c
11 changed files with 10 additions and 16152 deletions

View file

@ -29,13 +29,8 @@ import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
import com.github.steveice10.mc.protocol.codec.PacketCodec;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589;
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
import org.cloudburstmc.protocol.bedrock.codec.v618.Bedrock_v618;
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
import org.geysermc.geyser.session.GeyserSession;
import java.util.ArrayList;
import java.util.List;
@ -63,18 +58,11 @@ public final class GameProtocol {
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
static {
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v589.CODEC.toBuilder()
.minecraftVersion("1.20.0/1.20.1")
.build());
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v594.CODEC.toBuilder()
.minecraftVersion("1.20.10/1.20.15")
.build());
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v618.CODEC.toBuilder()
.minecraftVersion("1.20.30/1.20.32")
.build());
/*
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v622.CODEC.toBuilder()
.minecraftVersion("1.20.40/1.20.41")
.build());
*/
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
}
@ -94,18 +82,6 @@ public final class GameProtocol {
/* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */
public static boolean isPre1_20_10(GeyserSession session) {
return session.getUpstream().getProtocolVersion() < Bedrock_v594.CODEC.getProtocolVersion();
}
/**
* @param session the session to check
* @return true if the session needs an experiment for recipe unlocking
*/
public static boolean isUsingExperimentalRecipeUnlocking(GeyserSession session) {
return session.getUpstream().getProtocolVersion() == Bedrock_v594.CODEC.getProtocolVersion();
}
/**
* Gets the {@link PacketCodec} for Minecraft: Java Edition.
*

View file

@ -122,17 +122,9 @@ public final class BlockRegistryPopulator {
}
private static void registerBedrockBlocks() {
Remapper mapper594 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE);
Remapper mapper618 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE, BlockStateUpdater_1_20_30.INSTANCE);
Remapper mapper622 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE, BlockStateUpdater_1_20_30.INSTANCE, BlockStateUpdater_1_20_40.INSTANCE);
Remapper mapper630 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE, BlockStateUpdater_1_20_30.INSTANCE, BlockStateUpdater_1_20_40.INSTANCE, BlockStateUpdater_1_20_50.INSTANCE);
var blockMappers = ImmutableMap.<ObjectIntPair<String>, Remapper>builder()
.put(ObjectIntPair.of("1_20_0", Bedrock_v589.CODEC.getProtocolVersion()), tag -> tag)
.put(ObjectIntPair.of("1_20_10", Bedrock_v594.CODEC.getProtocolVersion()), mapper594)
.put(ObjectIntPair.of("1_20_30", Bedrock_v618.CODEC.getProtocolVersion()), mapper618)
.put(ObjectIntPair.of("1_20_40", Bedrock_v622.CODEC.getProtocolVersion()), mapper622)
.put(ObjectIntPair.of("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()), mapper630)
//.put(ObjectIntPair.of("1_20_40", Bedrock_v622.CODEC.getProtocolVersion()), mapper622)
.put(ObjectIntPair.of("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()), tag -> tag)
.build();
// We can keep this strong as nothing should be garbage collected

View file

@ -89,34 +89,8 @@ public class ItemRegistryPopulator {
}
public static void populate() {
// Forward-map 1.20 mappings to 1.20.10
Remapper remapper594 = (item, mapping) -> {
// 1.20.10+ received parity for concrete and shulker boxes
String id = item.javaIdentifier();
if (id.endsWith("_concrete") || id.endsWith("_shulker_box")) {
// the first underscore in "_shulker_box" accounts for ignoring "minecraft:shulker_box"
// which is mapped to "minecraft:undyed_shulker_box"
return mapping.withBedrockIdentifier(id);
}
return mapping;
};
// 1.20 to 1.20.30
Remapper remapper618 = (item, mapping) -> {
mapping = remapper594.remap(item, mapping); // apply 1.20.10 remapper first
String id = item.javaIdentifier();
if (id.endsWith("concrete_powder") || id.contains("stained_glass") || (id.endsWith("_terracotta") && !id.contains("glazed"))) {
// parity: concrete powder, stained-glass blocks and panes, and coloured terracotta
// 1. 'minecraft:terracotta' is still 'minecraft:hardened_clay'
// 2. there were no changes for glazed, but it doesn't have full parity, so ignore it.
return mapping.withBedrockIdentifier(id);
}
return mapping;
};
/*
Remapper remapper630 = (item, mapping) -> {
mapping = remapper618.remap(item, mapping); // apply 1.20.30 remapper first
String id = item.javaIdentifier();
// 1.20.50 replaced stone & planks to individual stone types
// E.g.: granite, diorite, andesite, polished variants, dark_oak_planks etc
@ -126,13 +100,11 @@ public class ItemRegistryPopulator {
return mapping;
};
*/
List<PaletteVersion> paletteVersions = new ArrayList<>(3);
paletteVersions.add(new PaletteVersion("1_20_0", Bedrock_v589.CODEC.getProtocolVersion()));
paletteVersions.add(new PaletteVersion("1_20_10", Bedrock_v594.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper594));
paletteVersions.add(new PaletteVersion("1_20_30", Bedrock_v618.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper618));
paletteVersions.add(new PaletteVersion("1_20_40", Bedrock_v622.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper618)); // NO item changes between 1.20.30 and 1.20.40
paletteVersions.add(new PaletteVersion("1_20_50", Bedrock_v630.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper630));
//paletteVersions.add(new PaletteVersion("1_20_40", Bedrock_v622.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper618)); // NO item changes between 1.20.30 and 1.20.40
paletteVersions.add(new PaletteVersion("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()));
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();

View file

@ -129,7 +129,6 @@ import org.geysermc.geyser.item.Items;
import org.geysermc.geyser.level.JavaDimension;
import org.geysermc.geyser.level.WorldManager;
import org.geysermc.geyser.level.physics.CollisionManager;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.network.netty.LocalSession;
import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.registry.type.BlockMappings;
@ -699,10 +698,8 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
gamerulePacket.getGameRules().add(new GameRuleData<>("keepinventory", true));
// Ensure client doesn't try and do anything funky; the server handles this for us
gamerulePacket.getGameRules().add(new GameRuleData<>("spawnradius", 0));
// Recipe unlocking - only needs to be added if 1. it isn't already on via an experiment, or 2. the client is on pre 1.20.10
if (!GameProtocol.isPre1_20_10(this) && !GameProtocol.isUsingExperimentalRecipeUnlocking(this)) {
gamerulePacket.getGameRules().add(new GameRuleData<>("recipesunlock", true));
}
// Recipe unlocking
gamerulePacket.getGameRules().add(new GameRuleData<>("recipesunlock", true));
upstream.sendPacket(gamerulePacket);
}
@ -1561,10 +1558,6 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
startGamePacket.setRewindHistorySize(0);
startGamePacket.setServerAuthoritativeBlockBreaking(false);
if (GameProtocol.isUsingExperimentalRecipeUnlocking(this)) {
startGamePacket.getExperiments().add(new ExperimentData("recipe_unlocking", true));
}
upstream.sendPacket(startGamePacket);
}

View file

@ -40,11 +40,6 @@ public class JavaClientboundRecipesTranslator extends PacketTranslator<Clientbou
@Override
public void translate(GeyserSession session, ClientboundRecipePacket packet) {
// recipe unlocking does not exist pre 1.20.10
if (GameProtocol.isPre1_20_10(session)) {
return;
}
UnlockedRecipesPacket recipesPacket = new UnlockedRecipesPacket();
switch (packet.getAction()) {
case INIT -> {

File diff suppressed because it is too large Load diff