diff --git a/connector/pom.xml b/connector/pom.xml index ae81ffab5..6849066d9 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -58,7 +58,7 @@ com.github.CloudburstMC.Protocol bedrock-v448 - ddfa38b + 690a545d compile diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java index ceb528650..e59c33520 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java @@ -33,6 +33,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlags; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; +import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.entity.player.PlayerEntity; @@ -290,14 +291,16 @@ public class CollisionManager { boolean flagsChanged; boolean isSneakingWithScaffolding = (touchingScaffolding || onScaffolding) && session.isSneaking(); - flagsChanged = flags.getFlag(EntityFlag.FALL_THROUGH_SCAFFOLDING) != isSneakingWithScaffolding; - flagsChanged |= flags.getFlag(EntityFlag.OVER_SCAFFOLDING) != isSneakingWithScaffolding; + if (session.getUpstream().getProtocolVersion() < Bedrock_v448.V448_CODEC.getProtocolVersion()) { + // Now no longer sent with BDS as of 1.17.10 + flagsChanged = flags.setFlag(EntityFlag.FALL_THROUGH_SCAFFOLDING, isSneakingWithScaffolding); + } else { + flagsChanged = flags.setFlag(EntityFlag.OVER_DESCENDABLE_BLOCK, onScaffolding); + flagsChanged |= flags.setFlag(EntityFlag.IN_ASCENDABLE_BLOCK, touchingScaffolding); + } + flagsChanged |= flags.setFlag(EntityFlag.OVER_SCAFFOLDING, isSneakingWithScaffolding); - flags.setFlag(EntityFlag.FALL_THROUGH_SCAFFOLDING, isSneakingWithScaffolding); - flags.setFlag(EntityFlag.OVER_SCAFFOLDING, isSneakingWithScaffolding); - - flagsChanged |= flags.getFlag(EntityFlag.IN_SCAFFOLDING) != touchingScaffolding; - flags.setFlag(EntityFlag.IN_SCAFFOLDING, touchingScaffolding); + flagsChanged |= flags.setFlag(EntityFlag.IN_SCAFFOLDING, touchingScaffolding); if (flagsChanged && updateMetadata) { session.getPlayerEntity().updateBedrockMetadata(session); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java index 2ca80041b..5c7a08834 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java @@ -550,6 +550,7 @@ public abstract class InventoryTranslator { switch (action.getType()) { case CRAFT_RECIPE_AUTO: { AutoCraftRecipeStackRequestActionData autoCraftAction = (AutoCraftRecipeStackRequestActionData) action; + // TODO autoCraftAction#getTimesCrafted 1.17.10 ??? if (craftState != CraftState.START) { return rejectRequest(request); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java index daefae827..3be8752dd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java @@ -93,8 +93,13 @@ public class BlockStateValues { return; } - if (javaId.contains("potted_") || javaId.contains("flower_pot")) { - FLOWER_POT_VALUES.put(javaBlockState, javaId.replace("potted_", "")); + if (javaId.startsWith("minecraft:potted_") || javaId.equals("minecraft:flower_pot")) { + String name = javaId.replace("potted_", ""); + if (name.contains("azalea")) { + // Exception to the rule + name = name.replace("_bush", ""); + } + FLOWER_POT_VALUES.put(javaBlockState, name); return; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java index 97a5e90db..22e31240d 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java @@ -30,17 +30,16 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.connector.network.translators.world.block.entity.FlowerPotBlockEntityTranslator; import org.geysermc.connector.registry.Registries; +import javax.annotation.Nonnull; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; - public class BlockEntityUtils { /** * A list of all block entities that require the Java block state in order to fill out their block entity information. @@ -65,15 +64,9 @@ public class BlockEntityUtils { private static final BlockEntityTranslator EMPTY_TRANSLATOR = Registries.BLOCK_ENTITIES.get("Empty"); static { - for (BlockEntityTranslator translator : Registries.BLOCK_ENTITIES.get().values()) { - if (!(translator instanceof BedrockOnlyBlockEntity)) { - continue; - } - - GeyserConnector.getInstance().getLogger().debug("Found Bedrock-only block entity: " + translator.getClass().getCanonicalName()); - BedrockOnlyBlockEntity bedrockOnlyBlockEntity = (BedrockOnlyBlockEntity) translator; - BEDROCK_ONLY_BLOCK_ENTITIES.add(bedrockOnlyBlockEntity); - } + // Seeing as there are only two - and, hopefully, will only ever be two - we can hardcode this + BEDROCK_ONLY_BLOCK_ENTITIES.add((BedrockOnlyBlockEntity) Registries.BLOCK_ENTITIES.get().get("Chest")); + BEDROCK_ONLY_BLOCK_ENTITIES.add(new FlowerPotBlockEntityTranslator()); } public static String getBedrockBlockEntityId(String id) {