mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-01-03 17:52:15 +01:00
Deprecate Bedrock 1.20.70 and below
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
parent
3826b1f65f
commit
ab007d98df
16 changed files with 88 additions and 849 deletions
|
@ -14,7 +14,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
|
|||
|
||||
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!
|
||||
|
||||
### Currently supporting Minecraft Bedrock 1.20.40 - 1.20.80/81 and Minecraft Java 1.20.5/1.20.6
|
||||
### Currently supporting Minecraft Bedrock 1.20.80 - 1.21.0 and Minecraft Java 1.20.5/1.20.6
|
||||
|
||||
## Setting Up
|
||||
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.
|
||||
|
|
|
@ -236,6 +236,7 @@ class CodecProcessor {
|
|||
.updateSerializer(PurchaseReceiptPacket.class, ILLEGAL_SERIALIZER)
|
||||
// Illegal unused serverbound packets that are deprecated
|
||||
.updateSerializer(ClientCheatAbilityPacket.class, ILLEGAL_SERIALIZER)
|
||||
.updateSerializer(CraftingEventPacket.class, ILLEGAL_SERIALIZER)
|
||||
// Illegal unusued serverbound packets that relate to unused features
|
||||
.updateSerializer(PlayerAuthInputPacket.class, ILLEGAL_SERIALIZER)
|
||||
.updateSerializer(ClientCacheBlobStatusPacket.class, ILLEGAL_SERIALIZER)
|
||||
|
@ -243,7 +244,6 @@ class CodecProcessor {
|
|||
.updateSerializer(SubChunkRequestPacket.class, ILLEGAL_SERIALIZER)
|
||||
.updateSerializer(GameTestRequestPacket.class, ILLEGAL_SERIALIZER)
|
||||
// Ignored serverbound packets
|
||||
.updateSerializer(CraftingEventPacket.class, IGNORED_SERIALIZER) // Make illegal when 1.20.40 is removed
|
||||
.updateSerializer(ClientToServerHandshakePacket.class, IGNORED_SERIALIZER)
|
||||
.updateSerializer(EntityFallPacket.class, IGNORED_SERIALIZER)
|
||||
.updateSerializer(MapCreateLockedCopyPacket.class, IGNORED_SERIALIZER)
|
||||
|
@ -273,11 +273,6 @@ class CodecProcessor {
|
|||
.updateSerializer(SimpleEventPacket.class, IGNORED_SERIALIZER)
|
||||
.updateSerializer(MultiplayerSettingsPacket.class, IGNORED_SERIALIZER);
|
||||
|
||||
if (codec.getProtocolVersion() < 662) {
|
||||
// Ignored only when serverbound
|
||||
codecBuilder.updateSerializer(SetEntityMotionPacket.class, SET_ENTITY_MOTION_SERIALIZER_V291);
|
||||
}
|
||||
|
||||
if (codec.getProtocolVersion() < 685) {
|
||||
// Ignored bidirectional packets
|
||||
codecBuilder.updateSerializer(TickSyncPacket.class, IGNORED_SERIALIZER);
|
||||
|
|
|
@ -27,10 +27,6 @@ package org.geysermc.geyser.network;
|
|||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v685.Bedrock_v685;
|
||||
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
|
||||
|
@ -67,18 +63,6 @@ public final class GameProtocol {
|
|||
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
|
||||
|
||||
static {
|
||||
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(Bedrock_v622.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.40/1.20.41")
|
||||
.build()));
|
||||
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(Bedrock_v630.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.50/1.20.51")
|
||||
.build()));
|
||||
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(Bedrock_v649.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.60/1.20.62")
|
||||
.build()));
|
||||
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(Bedrock_v662.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.70/1.20.73")
|
||||
.build()));
|
||||
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(Bedrock_v671.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.80/1.20.81")
|
||||
.build()));
|
||||
|
@ -103,16 +87,8 @@ public final class GameProtocol {
|
|||
|
||||
/* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */
|
||||
|
||||
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();
|
||||
public static boolean isPre1_21_0(GeyserSession session) {
|
||||
return session.getUpstream().getProtocolVersion() < Bedrock_v685.CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,10 +38,6 @@ import it.unimi.dsi.fastutil.objects.*;
|
|||
import org.cloudburstmc.blockstateupdater.BlockStateUpdater;
|
||||
import org.cloudburstmc.blockstateupdater.util.tagupdater.CompoundTagUpdaterContext;
|
||||
import org.cloudburstmc.nbt.*;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v685.Bedrock_v685;
|
||||
import org.cloudburstmc.protocol.bedrock.data.BlockPropertyData;
|
||||
|
@ -126,11 +122,6 @@ public final class BlockRegistryPopulator {
|
|||
|
||||
private static void registerBedrockBlocks() {
|
||||
var blockMappers = ImmutableMap.<ObjectIntPair<String>, Remapper>builder()
|
||||
.put(ObjectIntPair.of("1_20_40", Bedrock_v622.CODEC.getProtocolVersion()), Conversion630_622::remapBlock)
|
||||
.put(ObjectIntPair.of("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()), Conversion649_630::remapBlock)
|
||||
// Only changes in 1.20.60 are hard_stained_glass (an EDU only block)
|
||||
.put(ObjectIntPair.of("1_20_60", Bedrock_v649.CODEC.getProtocolVersion()), Conversion662_649::remapBlock)
|
||||
.put(ObjectIntPair.of("1_20_70", Bedrock_v662.CODEC.getProtocolVersion()), Conversion671_662::remapBlock)
|
||||
.put(ObjectIntPair.of("1_20_80", Bedrock_v671.CODEC.getProtocolVersion()), Conversion685_671::remapBlock)
|
||||
.put(ObjectIntPair.of("1_21_0", Bedrock_v685.CODEC.getProtocolVersion()), tag -> tag)
|
||||
.build();
|
||||
|
|
|
@ -1,217 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Backwards-maps the blocks and items of 1.20.50 (630) to 1.20.40 (622)
|
||||
*/
|
||||
class Conversion630_622 {
|
||||
|
||||
private static final List<String> NEW_STONES = List.of("minecraft:stone", "minecraft:granite", "minecraft:polished_granite", "minecraft:diorite", "minecraft:polished_diorite", "minecraft:andesite", "minecraft:polished_andesite");
|
||||
private static final List<String> NEW_WOODS = List.of("minecraft:oak_planks", "minecraft:spruce_planks", "minecraft:birch_planks", "minecraft:jungle_planks", "minecraft:acacia_planks", "minecraft:dark_oak_planks");
|
||||
|
||||
private static final Map<String, String> ITEMS = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
static {
|
||||
ITEMS.put("minecraft:acacia_planks", "minecraft:planks");
|
||||
ITEMS.put("minecraft:birch_planks", "minecraft:planks");
|
||||
ITEMS.put("minecraft:dark_oak_planks", "minecraft:planks");
|
||||
ITEMS.put("minecraft:jungle_planks", "minecraft:planks");
|
||||
ITEMS.put("minecraft:oak_planks", "minecraft:planks");
|
||||
ITEMS.put("minecraft:spruce_planks", "minecraft:planks");
|
||||
|
||||
ITEMS.put("minecraft:diorite", "minecraft:stone");
|
||||
ITEMS.put("minecraft:andesite", "minecraft:stone");
|
||||
ITEMS.put("minecraft:granite", "minecraft:stone");
|
||||
ITEMS.put("minecraft:polished_andesite", "minecraft:stone");
|
||||
ITEMS.put("minecraft:polished_diorite", "minecraft:stone");
|
||||
ITEMS.put("minecraft:polished_granite", "minecraft:stone");
|
||||
|
||||
ITEMS.put("minecraft:chiseled_tuff", "minecraft:chiseled_deepslate");
|
||||
ITEMS.put("minecraft:chiseled_tuff_bricks", "minecraft:chiseled_deepslate");
|
||||
ITEMS.put("minecraft:polished_tuff", "minecraft:polished_deepslate");
|
||||
ITEMS.put("minecraft:polished_tuff_double_slab", "minecraft:polished_deepslate_double_slab");
|
||||
ITEMS.put("minecraft:polished_tuff_slab", "minecraft:polished_deepslate_slab");
|
||||
ITEMS.put("minecraft:polished_tuff_stairs", "minecraft:polished_deepslate_stairs");
|
||||
ITEMS.put("minecraft:polished_tuff_wall", "minecraft:polished_deepslate_wall");
|
||||
ITEMS.put("minecraft:tuff_brick_double_slab", "minecraft:deepslate_brick_double_slab");
|
||||
ITEMS.put("minecraft:tuff_brick_slab", "minecraft:deepslate_brick_slab");
|
||||
ITEMS.put("minecraft:tuff_brick_stairs", "minecraft:deepslate_brick_stairs");
|
||||
ITEMS.put("minecraft:tuff_brick_wall", "minecraft:deepslate_brick_wall");
|
||||
ITEMS.put("minecraft:tuff_bricks", "minecraft:deepslate_bricks");
|
||||
ITEMS.put("minecraft:tuff_double_slab", "minecraft:cobbled_deepslate_double_slab");
|
||||
ITEMS.put("minecraft:tuff_slab", "minecraft:cobbled_deepslate_slab");
|
||||
ITEMS.put("minecraft:tuff_stairs", "minecraft:cobbled_deepslate_stairs");
|
||||
ITEMS.put("minecraft:tuff_wall", "minecraft:cobbled_deepslate_wall");
|
||||
|
||||
ITEMS.put("minecraft:chiseled_copper", "minecraft:copper_block");
|
||||
ITEMS.put("minecraft:copper_bulb", "minecraft:copper_block");
|
||||
ITEMS.put("minecraft:copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
ITEMS.put("minecraft:exposed_chiseled_copper", "minecraft:exposed_copper");
|
||||
ITEMS.put("minecraft:exposed_copper_bulb", "minecraft:exposed_copper");
|
||||
ITEMS.put("minecraft:exposed_copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:exposed_copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:exposed_copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
ITEMS.put("minecraft:oxidized_chiseled_copper", "minecraft:oxidized_copper");
|
||||
ITEMS.put("minecraft:oxidized_copper_bulb", "minecraft:oxidized_copper");
|
||||
ITEMS.put("minecraft:oxidized_copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:oxidized_copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:oxidized_copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
ITEMS.put("minecraft:waxed_chiseled_copper", "minecraft:waxed_copper");
|
||||
ITEMS.put("minecraft:waxed_copper_bulb", "minecraft:waxed_copper");
|
||||
ITEMS.put("minecraft:waxed_copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:waxed_copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:waxed_copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
ITEMS.put("minecraft:waxed_exposed_chiseled_copper", "minecraft:waxed_exposed_copper");
|
||||
ITEMS.put("minecraft:waxed_exposed_copper_bulb", "minecraft:waxed_exposed_copper");
|
||||
ITEMS.put("minecraft:waxed_exposed_copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:waxed_exposed_copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:waxed_exposed_copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
ITEMS.put("minecraft:waxed_oxidized_chiseled_copper", "minecraft:waxed_oxidized_copper");
|
||||
ITEMS.put("minecraft:waxed_oxidized_copper_bulb", "minecraft:waxed_oxidized_copper");
|
||||
ITEMS.put("minecraft:waxed_oxidized_copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:waxed_oxidized_copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:waxed_oxidized_copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
ITEMS.put("minecraft:waxed_weathered_chiseled_copper", "minecraft:waxed_weathered_copper");
|
||||
ITEMS.put("minecraft:waxed_weathered_copper_bulb", "minecraft:waxed_weathered_copper");
|
||||
ITEMS.put("minecraft:waxed_weathered_copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:waxed_weathered_copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:waxed_weathered_copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
ITEMS.put("minecraft:weathered_chiseled_copper", "minecraft:weathered_copper");
|
||||
ITEMS.put("minecraft:weathered_copper_bulb", "minecraft:weathered_copper");
|
||||
ITEMS.put("minecraft:weathered_copper_door", "minecraft:iron_door");
|
||||
ITEMS.put("minecraft:weathered_copper_grate", "minecraft:raw_iron_block");
|
||||
ITEMS.put("minecraft:weathered_copper_trapdoor", "minecraft:iron_trapdoor");
|
||||
|
||||
ITEMS.put("minecraft:crafter", "minecraft:crafting_table");
|
||||
}
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
mapping = Conversion649_630.remapItem(item, mapping);
|
||||
|
||||
String replacement = ITEMS.get(mapping.getBedrockIdentifier());
|
||||
if (replacement == null) {
|
||||
return mapping;
|
||||
} else {
|
||||
return mapping.withBedrockIdentifier(replacement);
|
||||
}
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
tag = Conversion649_630.remapBlock(tag);
|
||||
|
||||
final String name = tag.getString("name");
|
||||
|
||||
String replacement;
|
||||
if (NEW_STONES.contains(name) || NEW_WOODS.contains(name)) {
|
||||
|
||||
String typeKey;
|
||||
String type = name.substring(10);
|
||||
if (NEW_STONES.contains(name)) {
|
||||
replacement = "minecraft:stone";
|
||||
typeKey = "stone_type";
|
||||
if (type.startsWith("polished_")) {
|
||||
type = type.substring(9) + "_smooth";
|
||||
}
|
||||
} else {
|
||||
replacement = "minecraft:planks";
|
||||
typeKey = "wood_type";
|
||||
type = type.substring(0, type.indexOf("_planks"));
|
||||
}
|
||||
|
||||
return tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.putCompound("states", NbtMap.builder().putString(typeKey, type).build())
|
||||
.build();
|
||||
} else if (name.contains("tuff") && !name.equals("minecraft:tuff")) {
|
||||
|
||||
if (name.contains("brick") || name.contains("polished") || name.contains("chiseled")) {
|
||||
replacement = name.replace("tuff", "deepslate");
|
||||
|
||||
if (name.contains("chiseled")) {
|
||||
// chiseled deepslate bricks don't exist. just use chiseled deepslate instead
|
||||
replacement = replacement.replace("_bricks", "");
|
||||
}
|
||||
} else {
|
||||
replacement = name.replace("tuff", "cobbled_deepslate");
|
||||
}
|
||||
|
||||
return tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.build();
|
||||
} else if (name.contains("copper")) {
|
||||
|
||||
boolean removeStates = false;
|
||||
if (name.contains("chiseled")) {
|
||||
replacement = name.replace("_chiseled", ""); // special chiseled
|
||||
replacement = replacement.replace("chiseled_", ""); // plain chiseled
|
||||
} else if (name.endsWith("bulb")) {
|
||||
replacement = name.replace("_bulb", "");
|
||||
removeStates = true;
|
||||
} else if (name.endsWith("grate")) {
|
||||
replacement = "minecraft:raw_iron_block";
|
||||
} else if (name.endsWith("door")) {
|
||||
if (name.contains("trap")) {
|
||||
replacement = "minecraft:iron_trapdoor";
|
||||
} else {
|
||||
replacement = "minecraft:iron_door";
|
||||
}
|
||||
} else {
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (replacement.endsWith(":copper")) {
|
||||
// case for plain chiseled copper and plain bulb
|
||||
replacement = replacement + "_block";
|
||||
}
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.putString("name", replacement);
|
||||
if (removeStates) {
|
||||
builder.putCompound("states", NbtMap.EMPTY);
|
||||
}
|
||||
return builder.build();
|
||||
} else if (name.equals("minecraft:crafter")) {
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.put("name", "minecraft:crafting_table");
|
||||
builder.put("states", NbtMap.EMPTY);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
|
||||
public class Conversion649_630 {
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
mapping = Conversion662_649.remapItem(item, mapping);
|
||||
|
||||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
||||
switch (identifer) {
|
||||
case "minecraft:armadillo_scute", "minecraft:turtle_scute" -> { return mapping.withBedrockIdentifier("minecraft:scute"); }
|
||||
case "minecraft:armadillo_spawn_egg" -> { return mapping.withBedrockIdentifier("minecraft:rabbit_spawn_egg"); }
|
||||
case "minecraft:trial_spawner" -> { return mapping.withBedrockIdentifier("minecraft:mob_spawner"); }
|
||||
case "minecraft:trial_key" -> { return mapping.withBedrockIdentifier("minecraft:echo_shard"); }
|
||||
case "minecraft:wolf_armor" -> { return mapping.withBedrockIdentifier("minecraft:leather_horse_armor"); }
|
||||
default -> { return mapping; }
|
||||
}
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
tag = Conversion662_649.remapBlock(tag);
|
||||
|
||||
final String name = tag.getString("name");
|
||||
|
||||
if (name.equals("minecraft:trial_spawner")) {
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", "minecraft:mob_spawner")
|
||||
.putCompound("states", NbtMap.EMPTY);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
|
@ -1,187 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Conversion662_649 {
|
||||
|
||||
private static final List<String> NEW_MISC = List.of("minecraft:grass_block", "minecraft:vault");
|
||||
private static final List<String> NEW_WOODS = List.of("minecraft:oak_wood", "minecraft:spruce_wood", "minecraft:birch_wood", "minecraft:jungle_wood", "minecraft:acacia_wood", "minecraft:dark_oak_wood", "minecraft:stripped_oak_wood", "minecraft:stripped_spruce_wood", "minecraft:stripped_birch_wood", "minecraft:stripped_jungle_wood", "minecraft:stripped_acacia_wood", "minecraft:stripped_dark_oak_wood");
|
||||
private static final List<String> NEW_LEAVES = List.of("minecraft:oak_leaves", "minecraft:spruce_leaves", "minecraft:birch_leaves", "minecraft:jungle_leaves");
|
||||
private static final List<String> NEW_LEAVES2 = List.of("minecraft:acacia_leaves", "minecraft:dark_oak_leaves");
|
||||
private static final List<String> NEW_SLABS = List.of("minecraft:oak_slab", "minecraft:spruce_slab", "minecraft:birch_slab", "minecraft:jungle_slab", "minecraft:acacia_slab", "minecraft:dark_oak_slab", "minecraft:oak_double_slab", "minecraft:spruce_double_slab", "minecraft:birch_double_slab", "minecraft:jungle_double_slab", "minecraft:acacia_double_slab", "minecraft:dark_oak_double_slab");
|
||||
private static final List<String> NEW_BLOCKS = Stream.of(NEW_WOODS, NEW_LEAVES, NEW_LEAVES2, NEW_SLABS, NEW_MISC).flatMap(List::stream).toList();
|
||||
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
mapping = Conversion671_662.remapItem(item, mapping);
|
||||
|
||||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
||||
switch (identifer) {
|
||||
case "minecraft:bogged_spawn_egg" -> { return mapping.withBedrockIdentifier("minecraft:creeper_spawn_egg"); }
|
||||
case "minecraft:grass_block" -> { return mapping.withBedrockIdentifier("minecraft:grass"); }
|
||||
case "minecraft:vault" -> { return mapping.withBedrockIdentifier("minecraft:trial_spawner"); }
|
||||
case "minecraft:wind_charge" -> { return mapping.withBedrockIdentifier("minecraft:snowball"); }
|
||||
};
|
||||
|
||||
if (NEW_WOODS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(0); }
|
||||
case "minecraft:spruce_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(1); }
|
||||
case "minecraft:birch_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(2); }
|
||||
case "minecraft:jungle_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(3); }
|
||||
case "minecraft:acacia_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(4); }
|
||||
case "minecraft:dark_oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(5); }
|
||||
case "minecraft:stripped_oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(8); }
|
||||
case "minecraft:stripped_spruce_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(9); }
|
||||
case "minecraft:stripped_birch_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(10); }
|
||||
case "minecraft:stripped_jungle_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(11); }
|
||||
case "minecraft:stripped_acacia_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(12); }
|
||||
case "minecraft:stripped_dark_oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(13); }
|
||||
}
|
||||
}
|
||||
|
||||
if (NEW_SLABS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:oak_slab" -> { return mapping.withBedrockIdentifier("minecraft:wooden_slab").withBedrockData(0); }
|
||||
case "minecraft:spruce_slab" -> { return mapping.withBedrockIdentifier("minecraft:wooden_slab").withBedrockData(1); }
|
||||
case "minecraft:birch_slab" -> { return mapping.withBedrockIdentifier("minecraft:wooden_slab").withBedrockData(2); }
|
||||
case "minecraft:jungle_slab" -> { return mapping.withBedrockIdentifier("minecraft:wooden_slab").withBedrockData(3); }
|
||||
case "minecraft:acacia_slab" -> { return mapping.withBedrockIdentifier("minecraft:wooden_slab").withBedrockData(4); }
|
||||
case "minecraft:dark_oak_slab" -> { return mapping.withBedrockIdentifier("minecraft:wooden_slab").withBedrockData(5); }
|
||||
}
|
||||
}
|
||||
|
||||
if (NEW_LEAVES.contains(identifer) || NEW_LEAVES2.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:oak_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(0); }
|
||||
case "minecraft:spruce_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(1); }
|
||||
case "minecraft:birch_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(2); }
|
||||
case "minecraft:jungle_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(3); }
|
||||
case "minecraft:acacia_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves2").withBedrockData(0); }
|
||||
case "minecraft:dark_oak_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves2").withBedrockData(1); }
|
||||
}
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
tag = Conversion671_662.remapBlock(tag);
|
||||
|
||||
final String name = tag.getString("name");
|
||||
|
||||
if (!NEW_BLOCKS.contains(name)) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
String replacement;
|
||||
|
||||
if (name.equals("minecraft:grass_block")) {
|
||||
replacement = "minecraft:grass";
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.putString("name", replacement);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (name.equals("minecraft:vault")) {
|
||||
replacement = "minecraft:trial_spawner";
|
||||
|
||||
NbtMapBuilder statesBuilder = NbtMap.builder()
|
||||
.putInt("trial_spawner_state", 0);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.putString("name", replacement);
|
||||
builder.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (NEW_WOODS.contains(name)) {
|
||||
replacement = "minecraft:wood";
|
||||
|
||||
NbtMap states = tag.getCompound("states");
|
||||
boolean stripped = name.startsWith("minecraft:stripped_");
|
||||
String woodType = name.replaceAll("minecraft:|_wood|stripped_", "");
|
||||
|
||||
NbtMapBuilder statesBuilder = states.toBuilder()
|
||||
.putString("wood_type", woodType)
|
||||
.putBoolean("stripped_bit", stripped);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (NEW_LEAVES.contains(name) || NEW_LEAVES2.contains(name)) {
|
||||
boolean leaves2 = NEW_LEAVES2.contains(name);
|
||||
replacement = leaves2 ? "minecraft:leaves2" : "minecraft:leaves";
|
||||
|
||||
NbtMap states = tag.getCompound("states");
|
||||
String leafType = name.replaceAll("minecraft:|_leaves", "");
|
||||
|
||||
NbtMapBuilder statesBuilder = states.toBuilder()
|
||||
.putString(leaves2 ? "new_leaf_type" : "old_leaf_type", leafType);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
if (NEW_SLABS.contains(name)) {
|
||||
replacement = name.contains("double") ? "minecraft:double_wooden_slab" : "minecraft:wooden_slab";
|
||||
|
||||
NbtMap states = tag.getCompound("states");
|
||||
String woodType = name.replaceAll("minecraft:|_double|_slab", "");
|
||||
|
||||
NbtMapBuilder statesBuilder = states.toBuilder()
|
||||
.putString("wood_type", woodType);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
|
@ -1,209 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Conversion671_662 {
|
||||
private static final List<String> NEW_MISC = List.of("minecraft:heavy_core", "minecraft:mace", "minecraft:flow_banner_pattern", "minecraft:guster_banner_pattern", "minecraft:flow_armor_trim_smithing_template", "minecraft:bolt_armor_trim_smithing_template", "minecraft:flow_pottery_sherd", "minecraft:guster_pottery_sherd", "minecraft:scrape_pottery_sherd", "minecraft:breeze_rod");
|
||||
private static final List<String> NEW_CORAL_FANS = List.of("minecraft:tube_coral_fan", "minecraft:brain_coral_fan", "minecraft:bubble_coral_fan", "minecraft:fire_coral_fan", "minecraft:horn_coral_fan");
|
||||
private static final List<String> NEW_DEAD_CORAL_FANS = List.of("minecraft:dead_tube_coral_fan", "minecraft:dead_brain_coral_fan", "minecraft:dead_bubble_coral_fan", "minecraft:dead_fire_coral_fan", "minecraft:dead_horn_coral_fan");
|
||||
private static final List<String> NEW_FLOWERS = List.of("minecraft:poppy", "minecraft:blue_orchid", "minecraft:allium", "minecraft:azure_bluet", "minecraft:red_tulip", "minecraft:orange_tulip", "minecraft:white_tulip", "minecraft:pink_tulip", "minecraft:oxeye_daisy", "minecraft:cornflower", "minecraft:lily_of_the_valley");
|
||||
private static final List<String> NEW_SAPLINGS = List.of("minecraft:oak_sapling", "minecraft:spruce_sapling", "minecraft:birch_sapling", "minecraft:jungle_sapling", "minecraft:acacia_sapling", "minecraft:dark_oak_sapling", "minecraft:bamboo_sapling");
|
||||
private static final List<String> NEW_BLOCKS = Stream.of(NEW_MISC, NEW_CORAL_FANS, NEW_DEAD_CORAL_FANS, NEW_FLOWERS, NEW_SAPLINGS).flatMap(List::stream).toList();
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
mapping = Conversion685_671.remapItem(item, mapping);
|
||||
|
||||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
||||
if (!NEW_BLOCKS.contains(identifer)) {
|
||||
return mapping;
|
||||
}
|
||||
|
||||
switch (identifer) {
|
||||
case "minecraft:bolt_armor_trim_smithing_template" -> { return mapping.withBedrockIdentifier("minecraft:wayfinder_armor_trim_smithing_template"); }
|
||||
case "minecraft:breeze_rod" -> { return mapping.withBedrockIdentifier("minecraft:blaze_rod"); }
|
||||
case "minecraft:flow_armor_trim_smithing_template" -> { return mapping.withBedrockIdentifier("minecraft:spire_armor_trim_smithing_template"); }
|
||||
case "minecraft:flow_banner_pattern", "minecraft:guster_banner_pattern" -> { return mapping.withBedrockIdentifier("minecraft:globe_banner_pattern"); }
|
||||
case "minecraft:flow_pottery_sherd" -> { return mapping.withBedrockIdentifier("minecraft:skull_pottery_sherd"); }
|
||||
case "minecraft:guster_pottery_sherd" -> { return mapping.withBedrockIdentifier("minecraft:shelter_pottery_sherd"); }
|
||||
case "minecraft:scrape_pottery_sherd" -> { return mapping.withBedrockIdentifier("minecraft:heartbreak_pottery_sherd"); }
|
||||
case "minecraft:heavy_core" -> { return mapping.withBedrockIdentifier("minecraft:conduit"); }
|
||||
case "minecraft:mace" -> { return mapping.withBedrockIdentifier("minecraft:netherite_axe"); }
|
||||
}
|
||||
|
||||
if (NEW_FLOWERS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:poppy" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(0); }
|
||||
case "minecraft:blue_orchid" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(1); }
|
||||
case "minecraft:allium" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(2); }
|
||||
case "minecraft:azure_bluet" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(3); }
|
||||
case "minecraft:red_tulip" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(4); }
|
||||
case "minecraft:orange_tulip" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(5); }
|
||||
case "minecraft:white_tulip" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(6); }
|
||||
case "minecraft:pink_tulip" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(7); }
|
||||
case "minecraft:oxeye_daisy" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(8); }
|
||||
case "minecraft:cornflower" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(9); }
|
||||
case "minecraft:lily_of_the_valley" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(10); }
|
||||
}
|
||||
}
|
||||
|
||||
if (NEW_SAPLINGS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:oak_sapling" -> { return mapping.withBedrockIdentifier("minecraft:sapling").withBedrockData(0); }
|
||||
case "minecraft:spruce_sapling" -> { return mapping.withBedrockIdentifier("minecraft:sapling").withBedrockData(1); }
|
||||
case "minecraft:birch_sapling" -> { return mapping.withBedrockIdentifier("minecraft:sapling").withBedrockData(2); }
|
||||
case "minecraft:jungle_sapling" -> { return mapping.withBedrockIdentifier("minecraft:sapling").withBedrockData(3); }
|
||||
case "minecraft:acacia_sapling" -> { return mapping.withBedrockIdentifier("minecraft:sapling").withBedrockData(4); }
|
||||
case "minecraft:dark_oak_sapling" -> { return mapping.withBedrockIdentifier("minecraft:sapling").withBedrockData(5); }
|
||||
}
|
||||
}
|
||||
|
||||
if (NEW_CORAL_FANS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:tube_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan").withBedrockData(0); }
|
||||
case "minecraft:brain_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan").withBedrockData(1); }
|
||||
case "minecraft:bubble_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan").withBedrockData(2); }
|
||||
case "minecraft:fire_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan").withBedrockData(3); }
|
||||
case "minecraft:horn_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan").withBedrockData(4); }
|
||||
}
|
||||
}
|
||||
|
||||
if (NEW_DEAD_CORAL_FANS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:dead_tube_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan_dead").withBedrockData(0); }
|
||||
case "minecraft:dead_brain_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan_dead").withBedrockData(1); }
|
||||
case "minecraft:dead_bubble_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan_dead").withBedrockData(2); }
|
||||
case "minecraft:dead_fire_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan_dead").withBedrockData(3); }
|
||||
case "minecraft:dead_horn_coral_fan" -> { return mapping.withBedrockIdentifier("minecraft:coral_fan_dead").withBedrockData(4); }
|
||||
}
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
tag = Conversion685_671.remapBlock(tag);
|
||||
|
||||
final String name = tag.getString("name");
|
||||
|
||||
if (!NEW_BLOCKS.contains(name)) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (name.equals("minecraft:bamboo_sapling")) {
|
||||
NbtMap states = tag.getCompound("states")
|
||||
.toBuilder()
|
||||
.putString("sapling_type", "oak")
|
||||
.build();
|
||||
|
||||
return tag.toBuilder().putCompound("states", states).build();
|
||||
}
|
||||
|
||||
String replacement;
|
||||
|
||||
if (name.equals("minecraft:heavy_core")) {
|
||||
replacement = "minecraft:conduit";
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.putString("name", replacement);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (NEW_SAPLINGS.contains(name)) {
|
||||
replacement = "minecraft:sapling";
|
||||
String saplingType = name.replaceAll("minecraft:|_sapling", "");;
|
||||
|
||||
NbtMap states = tag.getCompound("states")
|
||||
.toBuilder()
|
||||
.putString("sapling_type", saplingType)
|
||||
.build();
|
||||
|
||||
return tag.toBuilder().putString("name", replacement).putCompound("states", states).build();
|
||||
}
|
||||
|
||||
if (NEW_FLOWERS.contains(name)) {
|
||||
replacement = "minecraft:red_flower";
|
||||
String flowerType;
|
||||
|
||||
switch (name) {
|
||||
case "minecraft:poppy" -> flowerType = "poppy";
|
||||
case "minecraft:blue_orchid" -> flowerType = "orchid";
|
||||
case "minecraft:allium" -> flowerType = "allium";
|
||||
case "minecraft:azure_bluet" -> flowerType = "houstonia";
|
||||
case "minecraft:red_tulip" -> flowerType = "tulip_red";
|
||||
case "minecraft:orange_tulip" -> flowerType = "tulip_orange";
|
||||
case "minecraft:white_tulip" -> flowerType = "tulip_white";
|
||||
case "minecraft:pink_tulip" -> flowerType = "tulip_pink";
|
||||
case "minecraft:oxeye_daisy" -> flowerType = "oxeye";
|
||||
case "minecraft:cornflower" -> flowerType = "cornflower";
|
||||
case "minecraft:lily_of_the_valley" -> flowerType = "lily_of_the_valley";
|
||||
default -> throw new IllegalStateException("Unexpected value: " + name);
|
||||
}
|
||||
|
||||
NbtMap states = tag.getCompound("states")
|
||||
.toBuilder()
|
||||
.putString("flower_type", flowerType)
|
||||
.build();
|
||||
|
||||
return tag.toBuilder().putString("name", replacement).putCompound("states", states).build();
|
||||
}
|
||||
|
||||
boolean isLiveCoralFan = NEW_CORAL_FANS.contains(name);
|
||||
boolean isDeadCoralFan = NEW_DEAD_CORAL_FANS.contains(name);
|
||||
|
||||
if (isLiveCoralFan || isDeadCoralFan) {
|
||||
replacement = isLiveCoralFan ? "minecraft:coral_fan" : "minecraft:coral_fan_dead";
|
||||
String coralColor;
|
||||
|
||||
switch (name) {
|
||||
case "minecraft:tube_coral_fan", "minecraft:dead_tube_coral_fan" -> coralColor = "blue";
|
||||
case "minecraft:brain_coral_fan", "minecraft:dead_brain_coral_fan" -> coralColor = "pink";
|
||||
case "minecraft:bubble_coral_fan", "minecraft:dead_bubble_coral_fan" -> coralColor = "purple";
|
||||
case "minecraft:fire_coral_fan", "minecraft:dead_fire_coral_fan" -> coralColor = "yellow";
|
||||
case "minecraft:horn_coral_fan", "minecraft:dead_horn_coral_fan" -> coralColor = "red";
|
||||
default -> throw new IllegalStateException("Unexpected value: " + name);
|
||||
}
|
||||
|
||||
NbtMap states = tag.getCompound("states")
|
||||
.toBuilder()
|
||||
.putString("coral_color", coralColor)
|
||||
.build();
|
||||
|
||||
return tag.toBuilder().putString("name", replacement).putCompound("states", states).build();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
|
|
|
@ -53,7 +53,6 @@ import org.geysermc.geyser.level.block.GeyserCustomBlockData;
|
|||
import org.geysermc.geyser.level.block.GeyserCustomBlockState;
|
||||
import org.geysermc.geyser.level.block.GeyserGeometryComponent;
|
||||
import org.geysermc.geyser.level.block.GeyserMaterialInstance;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.registry.mappings.MappingsConfigReader;
|
||||
import org.geysermc.geyser.registry.type.CustomSkull;
|
||||
|
@ -325,13 +324,11 @@ public class CustomBlockRegistryPopulator {
|
|||
// meaning of this version is unknown, but it's required for tags to work and should probably be checked periodically
|
||||
.putInt("molangVersion", 1)
|
||||
.putList("permutations", NbtType.COMPOUND, permutations)
|
||||
.putList("properties", NbtType.COMPOUND, properties);
|
||||
|
||||
if (GameProtocol.is1_20_60orHigher(protocolVersion)) {
|
||||
propertyTag.putCompound("vanilla_block_data", NbtMap.builder()
|
||||
.putList("properties", NbtType.COMPOUND, properties)
|
||||
.putCompound("vanilla_block_data", NbtMap.builder()
|
||||
.putInt("block_id", BLOCK_ID.getAndIncrement())
|
||||
.build());
|
||||
}
|
||||
|
||||
return new BlockPropertyData(customBlock.identifier(), propertyTag.build());
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ import org.geysermc.geyser.item.GeyserCustomMappingData;
|
|||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.components.WearableSlot;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.mappings.MappingsConfigReader;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
|
@ -260,18 +259,11 @@ public class CustomItemRegistryPopulator {
|
|||
}
|
||||
|
||||
private static void setupBasicItemInfo(int maxDamage, int stackSize, boolean displayHandheld, CustomItemData customItemData, NbtMapBuilder itemProperties, NbtMapBuilder componentBuilder, int protocolVersion) {
|
||||
NbtMap iconMap;
|
||||
if (GameProtocol.is1_20_60orHigher(protocolVersion)) {
|
||||
iconMap = NbtMap.builder()
|
||||
.putCompound("textures", NbtMap.builder()
|
||||
.putString("default", customItemData.icon())
|
||||
.build())
|
||||
.build();
|
||||
} else {
|
||||
iconMap = NbtMap.builder()
|
||||
.putString("texture", customItemData.icon())
|
||||
.build();
|
||||
}
|
||||
NbtMap iconMap = NbtMap.builder()
|
||||
.putCompound("textures", NbtMap.builder()
|
||||
.putString("default", customItemData.icon())
|
||||
.build())
|
||||
.build();
|
||||
itemProperties.putCompound("minecraft:icon", iconMap);
|
||||
|
||||
if (customItemData.creativeCategory().isPresent()) {
|
||||
|
@ -427,64 +419,56 @@ public class CustomItemRegistryPopulator {
|
|||
// Make bows, tridents, and crossbows enchantable
|
||||
itemProperties.putInt("enchantable_value", 1);
|
||||
|
||||
if (GameProtocol.is1_20_60orHigher(protocolVersion)) {
|
||||
componentBuilder.putCompound("minecraft:use_modifiers", NbtMap.builder()
|
||||
.putFloat("use_duration", 100F)
|
||||
.putFloat("movement_modifier", 0.35F)
|
||||
.build());
|
||||
componentBuilder.putCompound("minecraft:use_modifiers", NbtMap.builder()
|
||||
.putFloat("use_duration", 100F)
|
||||
.putFloat("movement_modifier", 0.35F)
|
||||
.build());
|
||||
|
||||
switch (mapping) {
|
||||
case "minecraft:bow" -> {
|
||||
itemProperties.putString("enchantable_slot", "bow");
|
||||
itemProperties.putInt("frame_count", 3);
|
||||
switch (mapping) {
|
||||
case "minecraft:bow" -> {
|
||||
itemProperties.putString("enchantable_slot", "bow");
|
||||
itemProperties.putInt("frame_count", 3);
|
||||
|
||||
componentBuilder.putCompound("minecraft:shooter", NbtMap.builder()
|
||||
.putList("ammunition", NbtType.COMPOUND, List.of(
|
||||
NbtMap.builder()
|
||||
.putCompound("item", NbtMap.builder()
|
||||
.putString("name", "minecraft:arrow")
|
||||
.build())
|
||||
.putBoolean("use_offhand", true)
|
||||
.putBoolean("search_inventory", true)
|
||||
.build()
|
||||
))
|
||||
.putFloat("max_draw_duration", 0f)
|
||||
.putBoolean("charge_on_draw", true)
|
||||
.putBoolean("scale_power_by_draw_duration", true)
|
||||
.build());
|
||||
componentBuilder.putInt("minecraft:use_duration", 999);
|
||||
}
|
||||
case "minecraft:trident" -> {
|
||||
itemProperties.putString("enchantable_slot", "trident");
|
||||
componentBuilder.putInt("minecraft:use_duration", 999);
|
||||
}
|
||||
case "minecraft:crossbow" -> {
|
||||
itemProperties.putString("enchantable_slot", "crossbow");
|
||||
itemProperties.putInt("frame_count", 10);
|
||||
|
||||
componentBuilder.putCompound("minecraft:shooter", NbtMap.builder()
|
||||
.putList("ammunition", NbtType.COMPOUND, List.of(
|
||||
NbtMap.builder()
|
||||
.putCompound("item", NbtMap.builder()
|
||||
.putString("name", "minecraft:arrow")
|
||||
.build())
|
||||
.putBoolean("use_offhand", true)
|
||||
.putBoolean("search_inventory", true)
|
||||
.build()
|
||||
))
|
||||
.putFloat("max_draw_duration", 1f)
|
||||
.putBoolean("charge_on_draw", true)
|
||||
.putBoolean("scale_power_by_draw_duration", true)
|
||||
.build());
|
||||
componentBuilder.putInt("minecraft:use_duration", 999);
|
||||
}
|
||||
componentBuilder.putCompound("minecraft:shooter", NbtMap.builder()
|
||||
.putList("ammunition", NbtType.COMPOUND, List.of(
|
||||
NbtMap.builder()
|
||||
.putCompound("item", NbtMap.builder()
|
||||
.putString("name", "minecraft:arrow")
|
||||
.build())
|
||||
.putBoolean("use_offhand", true)
|
||||
.putBoolean("search_inventory", true)
|
||||
.build()
|
||||
))
|
||||
.putFloat("max_draw_duration", 0f)
|
||||
.putBoolean("charge_on_draw", true)
|
||||
.putBoolean("scale_power_by_draw_duration", true)
|
||||
.build());
|
||||
componentBuilder.putInt("minecraft:use_duration", 999);
|
||||
}
|
||||
} else {
|
||||
// ensure client moves at slow speed while charging (note: this was calculated by hand as the movement modifer value does not seem to scale linearly)
|
||||
componentBuilder.putCompound("minecraft:chargeable", NbtMap.builder().putFloat("movement_modifier", 0.35F).build());
|
||||
case "minecraft:trident" -> {
|
||||
itemProperties.putString("enchantable_slot", "trident");
|
||||
componentBuilder.putInt("minecraft:use_duration", 999);
|
||||
}
|
||||
case "minecraft:crossbow" -> {
|
||||
itemProperties.putString("enchantable_slot", "crossbow");
|
||||
itemProperties.putInt("frame_count", 10);
|
||||
|
||||
// keep item enchantable; also works on 1.20.50
|
||||
itemProperties.putString("enchantable_slot", mapping.replace("minecraft:", ""));
|
||||
componentBuilder.putCompound("minecraft:shooter", NbtMap.builder()
|
||||
.putList("ammunition", NbtType.COMPOUND, List.of(
|
||||
NbtMap.builder()
|
||||
.putCompound("item", NbtMap.builder()
|
||||
.putString("name", "minecraft:arrow")
|
||||
.build())
|
||||
.putBoolean("use_offhand", true)
|
||||
.putBoolean("search_inventory", true)
|
||||
.build()
|
||||
))
|
||||
.putFloat("max_draw_duration", 1f)
|
||||
.putBoolean("charge_on_draw", true)
|
||||
.putBoolean("scale_power_by_draw_duration", true)
|
||||
.build());
|
||||
componentBuilder.putInt("minecraft:use_duration", 999);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v685.Bedrock_v685;
|
||||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
||||
|
@ -63,7 +59,6 @@ import org.geysermc.geyser.inventory.item.StoredItemMappings;
|
|||
import org.geysermc.geyser.item.GeyserCustomMappingData;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.registry.type.*;
|
||||
|
@ -92,10 +87,6 @@ public class ItemRegistryPopulator {
|
|||
|
||||
public static void populate() {
|
||||
List<PaletteVersion> paletteVersions = new ArrayList<>(3);
|
||||
paletteVersions.add(new PaletteVersion("1_20_40", Bedrock_v622.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion630_622::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_50", Bedrock_v630.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion649_630::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_60", Bedrock_v649.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion662_649::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_70", Bedrock_v662.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion671_662::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_80", Bedrock_v671.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion685_671::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_21_0", Bedrock_v685.CODEC.getProtocolVersion()));
|
||||
|
||||
|
@ -604,18 +595,11 @@ public class ItemRegistryPopulator {
|
|||
NbtMapBuilder componentBuilder = NbtMap.builder();
|
||||
// Conveniently, as of 1.16.200, the furnace minecart has a texture AND translation string already.
|
||||
// Not so conveniently, the way to set an icon changed in 1.20.60
|
||||
NbtMap iconMap;
|
||||
if (GameProtocol.is1_20_60orHigher(protocolVersion)) {
|
||||
iconMap = NbtMap.builder()
|
||||
.putCompound("textures", NbtMap.builder()
|
||||
.putString("default", "minecart_furnace")
|
||||
.build())
|
||||
.build();
|
||||
} else {
|
||||
iconMap = NbtMap.builder()
|
||||
.putString("texture", "minecart_furnace")
|
||||
.build();
|
||||
}
|
||||
NbtMap iconMap = NbtMap.builder()
|
||||
.putCompound("textures", NbtMap.builder()
|
||||
.putString("default", "minecart_furnace")
|
||||
.build())
|
||||
.build();
|
||||
itemProperties.putCompound("minecraft:icon", iconMap);
|
||||
componentBuilder.putCompound("minecraft:display_name", NbtMap.builder().putString("value", "item.minecartFurnace.name").build());
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.geysermc.geyser.GeyserImpl;
|
|||
import org.geysermc.geyser.inventory.*;
|
||||
import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.util.BlockEntityUtils;
|
||||
import org.geysermc.geyser.util.InventoryUtils;
|
||||
|
@ -44,7 +43,6 @@ import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponen
|
|||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.WritableBookContent;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.WrittenBookContent;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
|
@ -152,13 +150,6 @@ public class LecternInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||
} else if (lecternContainer.getBlockEntityTag() == null) {
|
||||
Vector3i position = lecternContainer.isUsingRealBlock() ? session.getLastInteractionBlockPosition() : inventory.getHolderPosition();
|
||||
|
||||
// If shouldExpectLecternHandled returns true, this is already handled for us
|
||||
// shouldRefresh means that we should boot out the client on our side because their lectern GUI isn't updated yet
|
||||
// TODO: yeet after 1.20.60 is minimum supported version
|
||||
boolean shouldRefresh = !session.getGeyser().getWorldManager().shouldExpectLecternHandled(session)
|
||||
&& !session.getLecternCache().contains(position)
|
||||
&& !GameProtocol.is1_20_60orHigher(session.getUpstream().getProtocolVersion());
|
||||
|
||||
NbtMap blockEntityTag;
|
||||
if (book.getComponents() != null) {
|
||||
int pages = 0;
|
||||
|
@ -205,16 +196,6 @@ public class LecternInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||
lecternContainer.setPosition(position);
|
||||
|
||||
BlockEntityUtils.updateBlockEntity(session, blockEntityTag, position);
|
||||
|
||||
if (shouldRefresh) {
|
||||
// the lectern cache doesn't always exist; only when we must refresh
|
||||
session.getLecternCache().add(position);
|
||||
|
||||
// Close the window - we will reopen it once the client has this data synced
|
||||
ServerboundContainerClosePacket closeWindowPacket = new ServerboundContainerClosePacket(lecternContainer.getJavaId());
|
||||
session.sendDownstreamGamePacket(closeWindowPacket);
|
||||
InventoryUtils.closeInventory(session, inventory.getJavaId(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.geysermc.geyser.level.block.Blocks;
|
|||
import org.geysermc.geyser.level.block.property.Properties;
|
||||
import org.geysermc.geyser.level.block.type.Block;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
@ -331,10 +330,6 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
|
|||
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;
|
||||
}
|
||||
|
||||
BlockState state = session.getGeyser().getWorldManager().blockAt(session, vector);
|
||||
|
||||
if (state.getValue(Properties.HAS_BOOK, false)) {
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.geysermc.geyser.inventory.GeyserItemStack;
|
|||
import org.geysermc.geyser.inventory.Inventory;
|
||||
import org.geysermc.geyser.inventory.LecternContainer;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.inventory.InventoryTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
|
@ -61,11 +60,6 @@ public class JavaOpenBookTranslator extends PacketTranslator<ClientboundOpenBook
|
|||
return;
|
||||
}
|
||||
|
||||
// Only post 1.20.60 is it possible to tell the client to open a lectern.
|
||||
if (!GameProtocol.is1_20_60orHigher(session.getUpstream().getProtocolVersion())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stack.asItem().equals(Items.WRITTEN_BOOK)) {
|
||||
Inventory openInventory = session.getOpenInventory();
|
||||
if (openInventory != null) {
|
||||
|
|
|
@ -30,9 +30,7 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.C
|
|||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.translator.inventory.InventoryTranslator;
|
||||
import org.geysermc.geyser.translator.inventory.OldSmithingTableTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
|
@ -57,10 +55,6 @@ public class JavaOpenScreenTranslator extends PacketTranslator<ClientboundOpenSc
|
|||
// Hack: ViaVersion translates the old (pre 1.20) smithing table to a furnace (does not work for Bedrock). We can detect this and translate it back to a smithing table.
|
||||
if (session.isOldSmithingTable() && packet.getType() == ContainerType.FURNACE && packet.getTitle().equals(SMITHING_TABLE_COMPONENT)) {
|
||||
newTranslator = OldSmithingTableTranslator.INSTANCE;
|
||||
} else if (packet.getType() == ContainerType.CRAFTER_3x3 && GameProtocol.isPre1_20_50(session)) {
|
||||
// Hack 2: Crafters are only supported by 1.20.50 and above. If 1.20.40 tries to open one, they'll get locked out of all inventories.
|
||||
newTranslator = null; // close immediately below
|
||||
session.sendMessage(ChatColor.RED + "Update your Bedrock Edition client to 1.20.50 or above to gain access to the Crafter.");
|
||||
} else {
|
||||
newTranslator = InventoryTranslator.inventoryTranslator(packet.getType());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue