3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 08:10:11 +01:00

Implement new boat types

Dieser Commit ist enthalten in:
onebeastchris 2024-12-05 20:45:56 +08:00
Ursprung abf14e6ef9
Commit 92c7f9895b
5 geänderte Dateien mit 23 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -238,6 +238,8 @@ public final class EntityDefinitions {
public static final EntityDefinition<ChestBoatEntity> OAK_CHEST_BOAT;
public static final EntityDefinition<OcelotEntity> OCELOT;
public static final EntityDefinition<PaintingEntity> PAINTING;
public static final EntityDefinition<BoatEntity> PALE_OAK_BOAT;
public static final EntityDefinition<ChestBoatEntity> PALE_OAK_CHEST_BOAT;
public static final EntityDefinition<PandaEntity> PANDA;
public static final EntityDefinition<ParrotEntity> PARROT;
public static final EntityDefinition<PhantomEntity> PHANTOM;
@ -593,6 +595,7 @@ public final class EntityDefinitions {
MANGROVE_BOAT = buildBoat(boatBase, EntityType.MANGROVE_BOAT, BoatEntity.BoatVariant.MANGROVE);
OAK_BOAT = buildBoat(boatBase, EntityType.OAK_BOAT, BoatEntity.BoatVariant.OAK);
SPRUCE_BOAT = buildBoat(boatBase, EntityType.SPRUCE_BOAT, BoatEntity.BoatVariant.SPRUCE);
PALE_OAK_BOAT = buildBoat(boatBase, EntityType.PALE_OAK_BOAT, BoatEntity.BoatVariant.PALE_OAK);
EntityDefinition<ChestBoatEntity> chestBoatBase = EntityDefinition.<ChestBoatEntity>inherited(null, boatBase)
.build();
@ -606,6 +609,7 @@ public final class EntityDefinitions {
MANGROVE_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.MANGROVE_CHEST_BOAT, BoatEntity.BoatVariant.MANGROVE);
OAK_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.OAK_CHEST_BOAT, BoatEntity.BoatVariant.OAK);
SPRUCE_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.SPRUCE_CHEST_BOAT, BoatEntity.BoatVariant.SPRUCE);
PALE_OAK_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.PALE_OAK_CHEST_BOAT, BoatEntity.BoatVariant.PALE_OAK);
}
EntityDefinition<LivingEntity> livingEntityBase = EntityDefinition.inherited(LivingEntity::new, entityBase)

Datei anzeigen

@ -34,6 +34,7 @@ import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.item.Items;
import org.geysermc.geyser.item.type.Item;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult;
import org.geysermc.geyser.util.InteractiveTag;
@ -77,6 +78,11 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90);
this.variant = variant;
// TODO remove once 1.21.40 is dropped
if (variant == BoatVariant.PALE_OAK && GameProtocol.isPreWinterDrop(session)) {
variant = BoatVariant.BIRCH;
}
dirtyMetadata.put(EntityDataTypes.VARIANT, variant.ordinal());
// Required to be able to move on land 1.16.200+ or apply gravity not in the water 1.16.100+
@ -238,7 +244,8 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
DARK_OAK(Items.DARK_OAK_BOAT, Items.DARK_OAK_CHEST_BOAT),
MANGROVE(Items.MANGROVE_BOAT, Items.MANGROVE_CHEST_BOAT),
BAMBOO(Items.BAMBOO_RAFT, Items.BAMBOO_CHEST_RAFT),
CHERRY(Items.CHERRY_BOAT, Items.CHERRY_CHEST_BOAT);
CHERRY(Items.CHERRY_BOAT, Items.CHERRY_CHEST_BOAT),
PALE_OAK(Items.PALE_OAK_BOAT, Items.PALE_OAK_CHEST_BOAT);
private final Item pickItem;
final Item chestPickItem;

Datei anzeigen

@ -30,6 +30,7 @@ import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
import org.cloudburstmc.protocol.bedrock.codec.v748.Bedrock_v748;
import org.cloudburstmc.protocol.bedrock.codec.v766.Bedrock_v766;
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.mcprotocollib.protocol.codec.MinecraftCodec;
import org.geysermc.mcprotocollib.protocol.codec.PacketCodec;
@ -84,6 +85,10 @@ public final class GameProtocol {
/* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */
public static boolean isPreWinterDrop(GeyserSession session) {
return session.getUpstream().getProtocolVersion() == Bedrock_v748.CODEC.getProtocolVersion();
}
/**
* Gets the {@link PacketCodec} for Minecraft: Java Edition.
*

Datei anzeigen

@ -62,6 +62,11 @@ public class JavaBlockEventTranslator extends PacketTranslator<ClientboundBlockE
Vector3i position = packet.getPosition();
BlockValue value = packet.getValue();
if (value == null) {
session.getGeyser().getLogger().debug("Unable to handle packet %s - null value! ".formatted(packet.toString()));
return;
}
BlockEventPacket blockEventPacket = new BlockEventPacket();
blockEventPacket.setBlockPosition(position);

Datei anzeigen

@ -15,7 +15,7 @@ protocol-common = "3.0.0.Beta5-20241203.200249-19"
protocol-codec = "3.0.0.Beta5-20241203.200249-19"
raknet = "1.0.0.CR3-20240416.144209-1"
minecraftauth = "4.1.1"
mcprotocollib = "1.21.4-SNAPSHOT"
mcprotocollib = "1.21.4-20241205.121506-8"
adventure = "4.14.0"
adventure-platform = "4.3.0"
junit = "5.9.2"