Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public enum BlockEntityVersion {
MINECRAFT_1_21_4(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_4)),
MINECRAFT_1_21_5(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_5)),
MINECRAFT_1_21_6(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_6)),
MINECRAFT_1_21_7(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_7));
MINECRAFT_1_21_7(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_7)),
MINECRAFT_1_21_9(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_9));

private static final EnumMap<ProtocolVersion, BlockEntityVersion> MC_VERSION_TO_ITEM_VERSIONS = new EnumMap<>(ProtocolVersion.class);
private static final Map<String, BlockEntityVersion> KEY_LOOKUP = Map.copyOf(EnumUniverse.createProtocolLookup(values()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public enum WorldVersion {
MINECRAFT_1_21_4(ProtocolVersion.MINECRAFT_1_21_4),
MINECRAFT_1_21_5(ProtocolVersion.MINECRAFT_1_21_5),
MINECRAFT_1_21_6(ProtocolVersion.MINECRAFT_1_21_6),
MINECRAFT_1_21_7(EnumSet.range(ProtocolVersion.MINECRAFT_1_21_7, ProtocolVersion.MAXIMUM_VERSION));
MINECRAFT_1_21_7(ProtocolVersion.MINECRAFT_1_21_7),
MINECRAFT_1_21_9(EnumSet.range(ProtocolVersion.MINECRAFT_1_21_9, ProtocolVersion.MAXIMUM_VERSION));

private static final EnumMap<ProtocolVersion, WorldVersion> MC_VERSION_TO_ITEM_VERSIONS = new EnumMap<>(ProtocolVersion.class);
private static final Map<String, WorldVersion> KEY_LOOKUP = Map.copyOf(EnumUniverse.createProtocolLookup(values()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public interface PacketFactory {

Object createDefaultSpawnPositionPacket(int posX, int posY, int posZ, float angle);

Object createDefaultSpawnPositionPacket(String dimension, int posX, int posY, int posZ, float yaw, float pitch);

Object createMapDataPacket(int mapID, byte scale, MapData mapData);

/**
Expand Down
10 changes: 7 additions & 3 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ enum MinecraftVersion {
MINECRAFT_1_21_4(769),
MINECRAFT_1_21_5(770),
MINECRAFT_1_21_6(771),
MINECRAFT_1_21_7(772)
MINECRAFT_1_21_7(772),
MINECRAFT_1_21_9(773)

public static final List<MinecraftVersion> WORLD_VERSIONS = List.of(
MINECRAFT_1_13,
Expand All @@ -153,7 +154,8 @@ enum MinecraftVersion {
MINECRAFT_1_21_4,
MINECRAFT_1_21_5,
MINECRAFT_1_21_6,
MINECRAFT_1_21_7
MINECRAFT_1_21_7,
MINECRAFT_1_21_9
)

public static final MinecraftVersion MINIMUM_VERSION = MINECRAFT_1_7_2
Expand Down Expand Up @@ -212,7 +214,9 @@ File downloadVersionManifest(String version) {
this.println("> Downloading ${version} manifest...")

Object manifest = new JsonSlurper().parse(versionManifestFile)
def optional = manifest.versions.stream().filter({ it.id == version }).findFirst()

// TODO: remove
def optional = manifest.versions.stream().filter({ version == "1.21.9" ? it.id == version + "-rc1" : it.id == version }).findFirst()
if (optional.empty()) {
throw new RuntimeException("Couldn't find version: ${version}")
}
Expand Down
64 changes: 64 additions & 0 deletions plugin/mapping/fallbackdata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,68 @@
{
"MINECRAFT_1_21_7": {
"minecraft:acacia_shelf": "minecraft:acacia_planks",
"minecraft:bamboo_shelf": "minecraft:bamboo_planks",
"minecraft:birch_shelf": "minecraft:birch_planks",
"minecraft:cherry_shelf": "minecraft:cherry_planks",
"minecraft:crimson_shelf": "minecraft:crimson_planks",
"minecraft:dark_oak_shelf": "minecraft:dark_oak_planks",
"minecraft:jungle_shelf": "minecraft:jungle_planks",
"minecraft:mangrove_shelf": "minecraft:mangrove_planks",
"minecraft:oak_shelf": "minecraft:oak_planks",
"minecraft:pale_oak_shelf": "minecraft:oak_planks",
"minecraft:spruce_shelf": "minecraft:spruce_planks",
"minecraft:warped_shelf": "minecraft:warped_planks",
"minecraft:copper_chest": "minecraft:chest",
"minecraft:exposed_copper_chest": "minecraft:chest",
"minecraft:weathered_copper_chest": "minecraft:chest",
"minecraft:oxidized_copper_chest": "minecraft:chest",
"minecraft:waxed_copper_chest": "minecraft:chest",
"minecraft:waxed_exposed_copper_chest": "minecraft:chest",
"minecraft:waxed_weathered_copper_chest": "minecraft:chest",
"minecraft:waxed_oxidized_copper_chest": "minecraft:chest",
"minecraft:copper_golem_statue": "minecraft:copper_block",
"minecraft:exposed_copper_golem_statue": "minecraft:copper_block",
"minecraft:weathered_copper_golem_statue": "minecraft:copper_block",
"minecraft:oxidized_copper_golem_statue": "minecraft:copper_block",
"minecraft:waxed_copper_golem_statue": "minecraft:copper_block",
"minecraft:waxed_exposed_copper_golem_statue": "minecraft:copper_block",
"minecraft:waxed_weathered_copper_golem_statue": "minecraft:copper_block",
"minecraft:waxed_oxidized_copper_golem_statue": "minecraft:copper_block",
"minecraft:exposed_lightning_rod": "minecraft:lightning_rod",
"minecraft:weathered_lightning_rod": "minecraft:lightning_rod",
"minecraft:oxidized_lightning_rod": "minecraft:lightning_rod",
"minecraft:waxed_lightning_rod": "minecraft:lightning_rod",
"minecraft:waxed_exposed_lightning_rod": "minecraft:lightning_rod",
"minecraft:waxed_weathered_lightning_rod": "minecraft:lightning_rod",
"minecraft:waxed_oxidized_lightning_rod": "minecraft:lightning_rod",
"minecraft:copper_torch": "minecraft:soul_torch",
"minecraft:copper_wall_torch": "minecraft:soul_wall_torch",
"minecraft:copper_bars": "minecraft:iron_bars",
"minecraft:exposed_copper_bars": "minecraft:iron_bars",
"minecraft:weathered_copper_bars": "minecraft:iron_bars",
"minecraft:oxidized_copper_bars": "minecraft:iron_bars",
"minecraft:waxed_copper_bars": "minecraft:iron_bars",
"minecraft:waxed_exposed_copper_bars": "minecraft:iron_bars",
"minecraft:waxed_weathered_copper_bars": "minecraft:iron_bars",
"minecraft:waxed_oxidized_copper_bars": "minecraft:iron_bars",
"minecraft:copper_chain": "minecraft:chain",
"minecraft:exposed_copper_chain": "minecraft:chain",
"minecraft:weathered_copper_chain": "minecraft:chain",
"minecraft:oxidized_copper_chain": "minecraft:chain",
"minecraft:waxed_copper_chain": "minecraft:chain",
"minecraft:waxed_exposed_copper_chain": "minecraft:chain",
"minecraft:waxed_weathered_copper_chain": "minecraft:chain",
"minecraft:waxed_oxidized_copper_chain": "minecraft:chain",
"minecraft:copper_lantern": "minecraft:soul_lantern",
"minecraft:exposed_copper_lantern": "minecraft:soul_lantern",
"minecraft:weathered_copper_lantern": "minecraft:soul_lantern",
"minecraft:oxidized_copper_lantern": "minecraft:soul_lantern",
"minecraft:waxed_copper_lantern": "minecraft:soul_lantern",
"minecraft:waxed_exposed_copper_lantern": "minecraft:soul_lantern",
"minecraft:waxed_weathered_copper_lantern": "minecraft:soul_lantern",
"minecraft:waxed_oxidized_copper_lantern": "minecraft:soul_lantern",
"minecraft:iron_chain": "minecraft:chain"
},
"MINECRAFT_1_21_5": {
"minecraft:dried_ghast": "minecraft:chorus_plant"
},
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/java/net/elytrium/limboapi/LimboAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
@SuppressFBWarnings("MS_EXPOSE_REP")
public class LimboAPI implements LimboFactory {

private static final int SUPPORTED_MAXIMUM_PROTOCOL_VERSION_NUMBER = 772;
private static final int SUPPORTED_MAXIMUM_PROTOCOL_VERSION_NUMBER = 773;

@MonotonicNonNull
private static Logger LOGGER;
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/java/net/elytrium/limboapi/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static class MAIN {
"1_7_2, 1_7_6, 1_8, 1_9, 1_9_1, 1_9_2, 1_9_4, 1_10, 1_11, 1_11_1, 1_12, 1_12_1, 1_12_2,",
"1_13, 1_13_1, 1_13_2, 1_14, 1_14_1, 1_14_2, 1_14_3, 1_14_4, 1_15, 1_15_1, 1_15_2,",
"1_16, 1_16_1, 1_16_2, 1_16_3, 1_16_4, 1_17, 1_17_1, 1_18, 1_18_2, 1_19, 1_19_1, 1_19_3,",
"1_20, 1_20_2, 1_20_3, 1_20_5, 1_21, 1_21_2, 1_21_4, 1_21_5, 1_21_6, 1_21_7, LATEST"
"1_20, 1_20_2, 1_20_3, 1_20_5, 1_21, 1_21_2, 1_21_4, 1_21_5, 1_21_6, 1_21_7, 1_21_9, LATEST"
})
public String PREPARE_MIN_VERSION = "1_7_2";
public String PREPARE_MAX_VERSION = "LATEST";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ public static void init() throws Throwable {
createMapping(0x20, ProtocolVersion.MINECRAFT_1_20_2, true),
createMapping(0x22, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x23, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x22, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x22, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x26, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
ChunkDataPacket.class, ChunkDataPacket::new,
Expand All @@ -216,7 +217,8 @@ public static void init() throws Throwable {
createMapping(0x25, ProtocolVersion.MINECRAFT_1_20_2, true),
createMapping(0x27, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x28, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x27, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x27, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x2C, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
ChunkUnloadPacket.class, ChunkUnloadPacket::new,
Expand All @@ -236,7 +238,8 @@ public static void init() throws Throwable {
createMapping(0x1F, ProtocolVersion.MINECRAFT_1_20_2, true),
createMapping(0x21, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x22, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x21, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x21, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x25, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
DefaultSpawnPositionPacket.class, DefaultSpawnPositionPacket::new,
Expand All @@ -257,7 +260,8 @@ public static void init() throws Throwable {
createMapping(0x54, ProtocolVersion.MINECRAFT_1_20_3, true),
createMapping(0x56, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x5B, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x5A, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x5A, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x5F, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
MapDataPacket.class, MapDataPacket::new,
Expand All @@ -275,7 +279,8 @@ public static void init() throws Throwable {
createMapping(0x2A, ProtocolVersion.MINECRAFT_1_20_2, true),
createMapping(0x2C, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x2D, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x2C, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x2C, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x31, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
PlayerAbilitiesPacket.class, PlayerAbilitiesPacket::new,
Expand All @@ -295,7 +300,8 @@ public static void init() throws Throwable {
createMapping(0x36, ProtocolVersion.MINECRAFT_1_20_2, true),
createMapping(0x38, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x3A, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x39, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x39, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x3E, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
PositionRotationPacket.class, PositionRotationPacket::new,
Expand All @@ -315,7 +321,8 @@ public static void init() throws Throwable {
createMapping(0x3E, ProtocolVersion.MINECRAFT_1_20_2, true),
createMapping(0x40, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x42, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x41, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x41, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x46, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
SetExperiencePacket.class, SetExperiencePacket::new,
Expand All @@ -334,7 +341,8 @@ public static void init() throws Throwable {
createMapping(0x5A, ProtocolVersion.MINECRAFT_1_20_3, true),
createMapping(0x5C, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x61, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x60, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x60, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x65, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
SetSlotPacket.class, SetSlotPacket::new,
Expand Down Expand Up @@ -371,7 +379,8 @@ public static void init() throws Throwable {
createMapping(0x62, ProtocolVersion.MINECRAFT_1_20_3, true),
createMapping(0x64, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x6B, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x6A, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x6A, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x6F, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
UpdateViewPositionPacket.class, UpdateViewPositionPacket::new, // ViewCentre, ChunkRenderDistanceCenter
Expand All @@ -387,7 +396,8 @@ public static void init() throws Throwable {
createMapping(0x52, ProtocolVersion.MINECRAFT_1_20_3, true),
createMapping(0x54, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x58, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x57, ProtocolVersion.MINECRAFT_1_21_5, true)
createMapping(0x57, ProtocolVersion.MINECRAFT_1_21_5, true),
createMapping(0x5C, ProtocolVersion.MINECRAFT_1_21_9, true)
);
register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND,
UpdateTagsPacket.class, UpdateTagsPacket::new,
Expand All @@ -404,7 +414,8 @@ public static void init() throws Throwable {
createMapping(0x70, ProtocolVersion.MINECRAFT_1_20_2, true),
createMapping(0x74, ProtocolVersion.MINECRAFT_1_20_3, true),
createMapping(0x78, ProtocolVersion.MINECRAFT_1_20_5, true),
createMapping(0x7F, ProtocolVersion.MINECRAFT_1_21_2, true)
createMapping(0x7F, ProtocolVersion.MINECRAFT_1_21_2, true),
createMapping(0x84, ProtocolVersion.MINECRAFT_1_21_9, true)
);

register(LIMBO_STATE_REGISTRY, PacketDirection.SERVERBOUND,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public Object createChunkUnloadPacket(int posX, int posZ) {

@Override
public Object createDefaultSpawnPositionPacket(int posX, int posY, int posZ, float angle) {
return new DefaultSpawnPositionPacket(posX, posY, posZ, angle);
return new DefaultSpawnPositionPacket(Dimension.OVERWORLD.getKey(), posX, posY, posZ, angle, 0);
}

@Override
public Object createDefaultSpawnPositionPacket(String dimension, int posX, int posY, int posZ, float yaw, float pitch) {
return new DefaultSpawnPositionPacket(dimension, posX, posY, posZ, yaw, pitch);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@

public class DefaultSpawnPositionPacket implements MinecraftPacket {

private final String dimension;
private final int posX;
private final int posY;
private final int posZ;
private final float angle;
private final float yaw;
private final float pitch;

public DefaultSpawnPositionPacket(int posX, int posY, int posZ, float angle) {
public DefaultSpawnPositionPacket(String dimension, int posX, int posY, int posZ, float yaw, float pitch) {
this.dimension = dimension;
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.angle = angle;
this.yaw = yaw;
this.pitch = pitch;
}

public DefaultSpawnPositionPacket() {
Expand All @@ -48,7 +52,12 @@ public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersi

@Override
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) {
if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_21_9)) {
ProtocolUtils.writeString(buf, this.dimension);
buf.writeLong(((this.posX & 0x3FFFFFFL) << 38) | ((this.posZ & 0x3FFFFFFL) << 12) | (this.posY & 0xFFFL));
buf.writeFloat(this.yaw);
buf.writeFloat(this.pitch);
} else if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) {
buf.writeInt(this.posX);
buf.writeInt(this.posY);
buf.writeInt(this.posZ);
Expand All @@ -63,7 +72,7 @@ public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersi
buf.writeLong(location);

if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0) {
buf.writeFloat(this.angle);
buf.writeFloat(this.yaw);
}
}
}
Expand All @@ -75,11 +84,13 @@ public boolean handle(MinecraftSessionHandler handler) {

@Override
public String toString() {
return "DefaultSpawnPosition{"
+ "posX=" + this.posX
return "DefaultSpawnPositionPacket{"
+ "dimension='" + this.dimension + '\''
+ ", posX=" + this.posX
+ ", posY=" + this.posY
+ ", posZ=" + this.posZ
+ ", angle=" + this.angle
+ "}";
+ ", yaw=" + this.yaw
+ ", pitch=" + this.pitch
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,8 @@ private JoinGamePacket createLegacyJoinGamePacket() {
}

private DefaultSpawnPositionPacket createDefaultSpawnPositionPacket() {
return new DefaultSpawnPositionPacket((int) this.world.getSpawnX(), (int) this.world.getSpawnY(), (int) this.world.getSpawnZ(), 0.0F);
return new DefaultSpawnPositionPacket(this.world.getDimension().getKey(),
(int) this.world.getSpawnX(), (int) this.world.getSpawnY(), (int) this.world.getSpawnZ(), 0.0F, 0.0f);
}

private TimeUpdatePacket createWorldTicksPacket() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ public short getID(ProtocolVersion version) {

@Override
public short getID(WorldVersion version) {
return this.versionIDs.get(version);
Short result = this.versionIDs.get(version);
if (result == null) {
throw new IllegalArgumentException("Item " + this.modernId + " does not exists on " + version);
}

return result;
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion plugin/src/main/resources/mapping/modern_block_id_remap.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"minecraft:grass": "minecraft:short_grass"
"minecraft:grass": "minecraft:short_grass",
"minecraft:chain": "minecraft:iron_chain"
}