Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Yeet 1.18.30 and old palette stuff
Dieser Commit ist enthalten in:
Ursprung
c5de293373
Commit
66a7efaa96
@ -29,7 +29,6 @@ import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
|
|||||||
import com.github.steveice10.mc.protocol.codec.PacketCodec;
|
import com.github.steveice10.mc.protocol.codec.PacketCodec;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
||||||
import com.nukkitx.protocol.bedrock.beta.BedrockBeta;
|
import com.nukkitx.protocol.bedrock.beta.BedrockBeta;
|
||||||
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -57,10 +56,6 @@ public final class MinecraftProtocol {
|
|||||||
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
|
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v503.V503_CODEC.toBuilder()
|
|
||||||
.minecraftVersion("1.18.30/1.18.31")
|
|
||||||
.build());
|
|
||||||
|
|
||||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
||||||
.minecraftVersion("1.19.0")
|
.minecraftVersion("1.19.0")
|
||||||
.build());
|
.build());
|
||||||
|
@ -29,7 +29,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.nukkitx.nbt.*;
|
import com.nukkitx.nbt.*;
|
||||||
import com.nukkitx.protocol.bedrock.beta.BedrockBeta;
|
import com.nukkitx.protocol.bedrock.beta.BedrockBeta;
|
||||||
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
@ -60,93 +59,8 @@ public class BlockRegistryPopulator {
|
|||||||
private static final ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> BLOCK_MAPPERS;
|
private static final ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> BLOCK_MAPPERS;
|
||||||
private static final BiFunction<String, NbtMapBuilder, String> EMPTY_MAPPER = (bedrockIdentifier, statesBuilder) -> null;
|
private static final BiFunction<String, NbtMapBuilder, String> EMPTY_MAPPER = (bedrockIdentifier, statesBuilder) -> null;
|
||||||
|
|
||||||
private static final BiFunction<String, NbtMapBuilder, String> V503_MAPPER = (bedrockIdentifier, statesBuilder) -> {
|
|
||||||
// TODO some new blocks exist in the block palette, but don't properly work in game (mangrove leaves + mud stuff)
|
|
||||||
if (bedrockIdentifier.contains("stone_block_slab")) {
|
|
||||||
return bedrockIdentifier.replace("stone_block_slab", "stone_slab");
|
|
||||||
}
|
|
||||||
switch (bedrockIdentifier) {
|
|
||||||
case "minecraft:mangrove_planks" -> {
|
|
||||||
statesBuilder.putString("wood_type", "jungle");
|
|
||||||
return "minecraft:planks";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_log" -> {
|
|
||||||
statesBuilder.putString("old_log_type", "jungle");
|
|
||||||
return "minecraft:log";
|
|
||||||
}
|
|
||||||
case "minecraft:stripped_mangrove_log" -> {
|
|
||||||
return "minecraft:stripped_jungle_log";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_roots", "minecraft:muddy_mangrove_roots", "minecraft:mangrove_wood" -> {
|
|
||||||
statesBuilder.putString("wood_type", "jungle");
|
|
||||||
statesBuilder.putBoolean("stripped_bit", false);
|
|
||||||
statesBuilder.putString("pillar_axis", "x");
|
|
||||||
return "minecraft:wood";
|
|
||||||
}
|
|
||||||
case "minecraft:stripped_mangrove_wood" -> {
|
|
||||||
statesBuilder.putString("wood_type", "jungle");
|
|
||||||
statesBuilder.putBoolean("stripped_bit", true);
|
|
||||||
return "minecraft:wood";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_standing_sign" -> {
|
|
||||||
return "minecraft:jungle_standing_sign";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_wall_sign" -> {
|
|
||||||
return "minecraft:jungle_wall_sign";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_pressure_plate" -> {
|
|
||||||
return "minecraft:jungle_pressure_plate";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_trapdoor" -> {
|
|
||||||
return "minecraft:jungle_trapdoor";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_button" -> {
|
|
||||||
return "minecraft:jungle_button";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_stairs" -> {
|
|
||||||
return "minecraft:jungle_stairs";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_slab" -> {
|
|
||||||
statesBuilder.putString("wood_type", "jungle");
|
|
||||||
return "minecraft:wooden_slab";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_double_slab" -> {
|
|
||||||
statesBuilder.putString("wood_type", "jungle");
|
|
||||||
return "minecraft:double_wooden_slab";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_fence_gate" -> {
|
|
||||||
return "minecraft:jungle_fence_gate";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_fence" -> {
|
|
||||||
statesBuilder.putString("wood_type", "jungle");
|
|
||||||
return "minecraft:fence";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_door" -> {
|
|
||||||
return "minecraft:jungle_door";
|
|
||||||
}
|
|
||||||
case "minecraft:mangrove_propagule" -> {
|
|
||||||
statesBuilder.put("growth", statesBuilder.get("propagule_stage"));
|
|
||||||
statesBuilder.remove("propagule_stage");
|
|
||||||
|
|
||||||
statesBuilder.putInt("facing_direction", 0);
|
|
||||||
|
|
||||||
if ((Byte) statesBuilder.remove("hanging") == 1) {
|
|
||||||
return "minecraft:mangrove_propagule_hanging";
|
|
||||||
} else {
|
|
||||||
return "minecraft:mangrove_propagule";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "minecraft:sculk_shrieker" -> {
|
|
||||||
statesBuilder.remove("can_summon");
|
|
||||||
return bedrockIdentifier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ImmutableMap.Builder<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> stateMapperBuilder = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
ImmutableMap.Builder<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> stateMapperBuilder = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
||||||
.put(ObjectIntPair.of("1_18_30", Bedrock_v503.V503_CODEC.getProtocolVersion()), V503_MAPPER)
|
|
||||||
.put(ObjectIntPair.of("1_19_0", BedrockBeta.BETA_CODEC.getProtocolVersion()), EMPTY_MAPPER);
|
.put(ObjectIntPair.of("1_19_0", BedrockBeta.BETA_CODEC.getProtocolVersion()), EMPTY_MAPPER);
|
||||||
|
|
||||||
BLOCK_MAPPERS = stateMapperBuilder.build();
|
BLOCK_MAPPERS = stateMapperBuilder.build();
|
||||||
|
@ -36,9 +36,6 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
|||||||
import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
|
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
|
||||||
import com.nukkitx.protocol.bedrock.v475.Bedrock_v475;
|
|
||||||
import com.nukkitx.protocol.bedrock.v486.Bedrock_v486;
|
|
||||||
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
@ -67,7 +64,6 @@ public class ItemRegistryPopulator {
|
|||||||
|
|
||||||
public static void populate() {
|
public static void populate() {
|
||||||
Map<String, PaletteVersion> paletteVersions = new Object2ObjectOpenHashMap<>();
|
Map<String, PaletteVersion> paletteVersions = new Object2ObjectOpenHashMap<>();
|
||||||
paletteVersions.put("1_18_30", new PaletteVersion(Bedrock_v503.V503_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
|
||||||
paletteVersions.put("1_19_0", new PaletteVersion(BedrockBeta.BETA_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
paletteVersions.put("1_19_0", new PaletteVersion(BedrockBeta.BETA_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||||
|
|
||||||
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
||||||
@ -230,18 +226,6 @@ public class ItemRegistryPopulator {
|
|||||||
mappingItem = entry.getValue();
|
mappingItem = entry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
String bedrockIdentifier;
|
|
||||||
if (javaIdentifier.equals("minecraft:globe_banner_pattern") && palette.getValue().protocolVersion() < Bedrock_v486.V486_CODEC.getProtocolVersion()) {
|
|
||||||
bedrockIdentifier = "minecraft:banner_pattern";
|
|
||||||
} else {
|
|
||||||
bedrockIdentifier = mappingItem.getBedrockIdentifier();
|
|
||||||
if (palette.getValue().protocolVersion() >= Bedrock_v503.V503_CODEC.getProtocolVersion()) {
|
|
||||||
if (bedrockIdentifier.equals("minecraft:sealantern")) {
|
|
||||||
bedrockIdentifier = "minecraft:sea_lantern";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usingFurnaceMinecart && javaIdentifier.equals("minecraft:furnace_minecart")) {
|
if (usingFurnaceMinecart && javaIdentifier.equals("minecraft:furnace_minecart")) {
|
||||||
javaFurnaceMinecartId = itemIndex;
|
javaFurnaceMinecartId = itemIndex;
|
||||||
itemIndex++;
|
itemIndex++;
|
||||||
@ -250,11 +234,10 @@ public class ItemRegistryPopulator {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String bedrockIdentifier = mappingItem.getBedrockIdentifier();
|
||||||
int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier);
|
int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier);
|
||||||
if (bedrockId == Short.MIN_VALUE) {
|
if (bedrockId == Short.MIN_VALUE) {
|
||||||
bedrockId = 0;
|
throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier);
|
||||||
//TODO remove
|
|
||||||
//throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier);
|
|
||||||
}
|
}
|
||||||
int stackSize = mappingItem.getStackSize();
|
int stackSize = mappingItem.getStackSize();
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.AutoCraft
|
|||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
|
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
|
||||||
import com.nukkitx.protocol.bedrock.v486.Bedrock_v486;
|
|
||||||
import org.geysermc.geyser.entity.type.Entity;
|
import org.geysermc.geyser.entity.type.Entity;
|
||||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||||
import org.geysermc.geyser.inventory.Inventory;
|
import org.geysermc.geyser.inventory.Inventory;
|
||||||
@ -140,10 +139,6 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
if (session.getUpstream().getProtocolVersion() < Bedrock_v486.V486_CODEC.getProtocolVersion()) {
|
|
||||||
return super.translateCraftingRequest(session, inventory, request);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Behavior as of 1.18.10.
|
// Behavior as of 1.18.10.
|
||||||
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
|
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
|
||||||
// store a map of net ID to trade index on our end.
|
// store a map of net ID to trade index on our end.
|
||||||
@ -153,12 +148,6 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
if (session.getUpstream().getProtocolVersion() < Bedrock_v486.V486_CODEC.getProtocolVersion()) {
|
|
||||||
// We're not crafting here
|
|
||||||
// Called at least by consoles when pressing a trade option button
|
|
||||||
return translateRequest(session, inventory, request);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1.18.10 update - seems impossible to call without consoles/controller input
|
// 1.18.10 update - seems impossible to call without consoles/controller input
|
||||||
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
|
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
|
||||||
// store a map of net ID to trade index on our end.
|
// store a map of net ID to trade index on our end.
|
||||||
|
@ -38,7 +38,6 @@ import com.nukkitx.nbt.NbtMap;
|
|||||||
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
|
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket;
|
import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket;
|
||||||
import com.nukkitx.protocol.bedrock.v486.Bedrock_v486;
|
|
||||||
import it.unimi.dsi.fastutil.ints.*;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -82,8 +81,6 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
|
|||||||
// Get the last known network ID (first used for the pregenerated recipes) and increment from there.
|
// Get the last known network ID (first used for the pregenerated recipes) and increment from there.
|
||||||
int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1;
|
int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1;
|
||||||
|
|
||||||
boolean applySmithingRecipes = session.getUpstream().getProtocolVersion() >= Bedrock_v486.V486_CODEC.getProtocolVersion();
|
|
||||||
|
|
||||||
Int2ObjectMap<GeyserRecipe> recipeMap = new Int2ObjectOpenHashMap<>(Registries.RECIPES.forVersion(session.getUpstream().getProtocolVersion()));
|
Int2ObjectMap<GeyserRecipe> recipeMap = new Int2ObjectOpenHashMap<>(Registries.RECIPES.forVersion(session.getUpstream().getProtocolVersion()));
|
||||||
Int2ObjectMap<List<StoneCuttingRecipeData>> unsortedStonecutterData = new Int2ObjectOpenHashMap<>();
|
Int2ObjectMap<List<StoneCuttingRecipeData>> unsortedStonecutterData = new Int2ObjectOpenHashMap<>();
|
||||||
CraftingDataPacket craftingDataPacket = new CraftingDataPacket();
|
CraftingDataPacket craftingDataPacket = new CraftingDataPacket();
|
||||||
@ -138,10 +135,6 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
|
|||||||
}
|
}
|
||||||
case SMITHING -> {
|
case SMITHING -> {
|
||||||
// Required to translate these as of 1.18.10, or else they cannot be crafted
|
// Required to translate these as of 1.18.10, or else they cannot be crafted
|
||||||
if (!applySmithingRecipes) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SmithingRecipeData recipeData = (SmithingRecipeData) recipe.getData();
|
SmithingRecipeData recipeData = (SmithingRecipeData) recipe.getData();
|
||||||
ItemData output = ItemTranslator.translateToBedrock(session, recipeData.getResult());
|
ItemData output = ItemTranslator.translateToBedrock(session, recipeData.getResult());
|
||||||
for (ItemStack base : recipeData.getBase().getOptions()) {
|
for (ItemStack base : recipeData.getBase().getOptions()) {
|
||||||
|
Binäre Datei nicht angezeigt.
Binäre Datei nicht angezeigt.
Binäre Datei nicht angezeigt.
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren