mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Work-in-progress 1.19.80 support. Doesn't work yet
This commit is contained in:
parent
27fcc932c7
commit
51566a963f
7 changed files with 11292 additions and 23 deletions
|
@ -28,12 +28,12 @@ package org.geysermc.geyser.network;
|
|||
import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
|
||||
import com.github.steveice10.mc.protocol.codec.PacketCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v554.Bedrock_v554;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v557.Bedrock_v557;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v560.Bedrock_v560;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v567.Bedrock_v567;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v568.Bedrock_v568;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v575.Bedrock_v575;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v582.Bedrock_v582;
|
||||
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
|
@ -49,9 +49,7 @@ public final class GameProtocol {
|
|||
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
||||
* release of the game that Geyser supports.
|
||||
*/
|
||||
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = Bedrock_v575.CODEC.toBuilder()
|
||||
.minecraftVersion("1.19.73")
|
||||
.build();
|
||||
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = Bedrock_v582.CODEC;
|
||||
/**
|
||||
* A list of all supported Bedrock versions that can join Geyser
|
||||
*/
|
||||
|
@ -64,9 +62,6 @@ public final class GameProtocol {
|
|||
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
|
||||
|
||||
static {
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v554.CODEC.toBuilder()
|
||||
.minecraftVersion("1.19.30/1.19.31")
|
||||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v557.CODEC.toBuilder()
|
||||
.minecraftVersion("1.19.40/1.19.41")
|
||||
.build());
|
||||
|
@ -75,9 +70,10 @@ public final class GameProtocol {
|
|||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v567.CODEC);
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v568.CODEC);
|
||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v575.CODEC.toBuilder()
|
||||
.minecraftVersion("1.19.70/1.19.71/1.19.73")
|
||||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.cloudburstmc.protocol.bedrock.codec.v544.Bedrock_v544;
|
|||
import org.cloudburstmc.protocol.bedrock.codec.v560.Bedrock_v560;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v567.Bedrock_v567;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v575.Bedrock_v575;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v582.Bedrock_v582;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
@ -69,20 +70,40 @@ public final class BlockRegistryPopulator {
|
|||
}
|
||||
|
||||
private static void registerBedrockBlocks() {
|
||||
BiFunction<String, NbtMapBuilder, String> woolMapper = (bedrockIdentifier, statesBuilder) -> {
|
||||
if (bedrockIdentifier.equals("minecraft:wool")) {
|
||||
String color = (String) statesBuilder.remove("color");
|
||||
if ("silver".equals(color)) {
|
||||
color = "light_gray";
|
||||
}
|
||||
return "minecraft:" + color + "_wool";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
BiFunction<String, NbtMapBuilder, String> emptyMapper = (bedrockIdentifier, statesBuilder) -> null;
|
||||
ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> blockMappers = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
||||
.put(ObjectIntPair.of("1_19_20", Bedrock_v544.CODEC.getProtocolVersion()), emptyMapper)
|
||||
.put(ObjectIntPair.of("1_19_50", Bedrock_v560.CODEC.getProtocolVersion()), emptyMapper)
|
||||
.put(ObjectIntPair.of("1_19_60", Bedrock_v567.CODEC.getProtocolVersion()), emptyMapper)
|
||||
.put(ObjectIntPair.of("1_19_70", Bedrock_v575.CODEC.getProtocolVersion()), (bedrockIdentifier, statesBuilder) -> {
|
||||
if (bedrockIdentifier.equals("minecraft:wool")) {
|
||||
String color = (String) statesBuilder.remove("color");
|
||||
if ("silver".equals(color)) {
|
||||
color = "light_gray";
|
||||
}
|
||||
return "minecraft:" + color + "_wool";
|
||||
.put(ObjectIntPair.of("1_19_70", Bedrock_v575.CODEC.getProtocolVersion()), woolMapper)
|
||||
.put(ObjectIntPair.of("1_19_80", Bedrock_v582.CODEC.getProtocolVersion()), (bedrockIdentifier, statesBuilder) -> {
|
||||
String identifier = woolMapper.apply(bedrockIdentifier, statesBuilder);
|
||||
if (identifier != null) {
|
||||
return identifier;
|
||||
}
|
||||
switch (bedrockIdentifier) {
|
||||
case "minecraft:log", "minecraft:log2" -> {
|
||||
String woodType = (String) statesBuilder.remove(bedrockIdentifier.equals("minecraft:log") ? "old_log_type" : "new_log_type");
|
||||
return "minecraft:" + woodType + "_log";
|
||||
}
|
||||
case "minecraft:fence" -> {
|
||||
String woodType = (String) statesBuilder.remove("wood_type");
|
||||
return "minecraft:" + woodType + "_fence";
|
||||
}
|
||||
default -> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.build();
|
||||
|
||||
|
@ -108,6 +129,7 @@ public final class BlockRegistryPopulator {
|
|||
for (int i = 0; i < blocksTag.size(); i++) {
|
||||
NbtMapBuilder builder = blocksTag.get(i).toBuilder();
|
||||
builder.remove("name_hash"); // Quick workaround - was added in 1.19.20
|
||||
builder.remove("network_id"); // Added in 1.19.80 - ????
|
||||
builder.putCompound("states", statesInterner.intern((NbtMap) builder.remove("states")));
|
||||
NbtMap tag = builder.build();
|
||||
if (blockStateOrderedMap.containsKey(tag)) {
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.cloudburstmc.protocol.bedrock.codec.v544.Bedrock_v544;
|
|||
import org.cloudburstmc.protocol.bedrock.codec.v560.Bedrock_v560;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v567.Bedrock_v567;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v575.Bedrock_v575;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v582.Bedrock_v582;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.SimpleItemDefinition;
|
||||
|
@ -78,6 +79,7 @@ public class ItemRegistryPopulator {
|
|||
paletteVersions.put("1_19_50", new PaletteVersion(Bedrock_v560.CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||
paletteVersions.put("1_19_60", new PaletteVersion(Bedrock_v567.CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||
paletteVersions.put("1_19_70", new PaletteVersion(Bedrock_v575.CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||
paletteVersions.put("1_19_80", new PaletteVersion(Bedrock_v582.CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||
|
||||
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
||||
|
||||
|
@ -198,18 +200,19 @@ public class ItemRegistryPopulator {
|
|||
mappingItem = entry.getValue();
|
||||
}
|
||||
|
||||
// 1.19.70+
|
||||
if (palette.getValue().protocolVersion() >= Bedrock_v575.CODEC.getProtocolVersion() && mappingItem.getBedrockIdentifier().equals("minecraft:wool")) {
|
||||
mappingItem.setBedrockIdentifier(javaItem.javaIdentifier());
|
||||
}
|
||||
|
||||
if (customItemsAllowed && javaItem == Items.FURNACE_MINECART) {
|
||||
// Will be added later
|
||||
mappings.add(null);
|
||||
continue;
|
||||
}
|
||||
|
||||
String bedrockIdentifier = mappingItem.getBedrockIdentifier();
|
||||
String bedrockIdentifier;
|
||||
// 1.19.70+
|
||||
if (palette.getValue().protocolVersion() >= Bedrock_v575.CODEC.getProtocolVersion() && mappingItem.getBedrockIdentifier().equals("minecraft:wool")) {
|
||||
bedrockIdentifier = javaItem.javaIdentifier();
|
||||
} else {
|
||||
bedrockIdentifier = mappingItem.getBedrockIdentifier();
|
||||
}
|
||||
ItemDefinition definition = definitions.get(bedrockIdentifier);
|
||||
if (definition == null) {
|
||||
throw new RuntimeException("Missing Bedrock ItemDefinition in mappings: " + bedrockIdentifier);
|
||||
|
|
|
@ -36,7 +36,6 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCl
|
|||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.GameRuleData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.LevelEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.data.LevelEventType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.*;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
|
|
BIN
core/src/main/resources/bedrock/block_palette.1_19_80.nbt
Normal file
BIN
core/src/main/resources/bedrock/block_palette.1_19_80.nbt
Normal file
Binary file not shown.
6183
core/src/main/resources/bedrock/creative_items.1_19_80.json
Normal file
6183
core/src/main/resources/bedrock/creative_items.1_19_80.json
Normal file
File diff suppressed because it is too large
Load diff
5066
core/src/main/resources/bedrock/runtime_item_states.1_19_80.json
Normal file
5066
core/src/main/resources/bedrock/runtime_item_states.1_19_80.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue