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

Start on 1.21.4 support

Dieser Commit ist enthalten in:
onebeastchris 2024-11-28 02:17:11 +08:00
Ursprung 47b68f8140
Commit d53a1a5cc4
11 geänderte Dateien mit 46 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -105,6 +105,10 @@ public class VehicleComponent<T extends LivingEntity & ClientVehicle> {
boundingBox.setMiddleZ(z); boundingBox.setMiddleZ(z);
} }
public void moveAbsolute(Vector3d vec) {
moveAbsolute(vec.getX(), vec.getY(), vec.getZ());
}
public void moveRelative(double x, double y, double z) { public void moveRelative(double x, double y, double z) {
boundingBox.translate(x, y, z); boundingBox.translate(x, y, z);
} }
@ -756,7 +760,7 @@ public class VehicleComponent<T extends LivingEntity & ClientVehicle> {
vehicle.getSession().sendUpstreamPacket(moveEntityDeltaPacket); vehicle.getSession().sendUpstreamPacket(moveEntityDeltaPacket);
} }
ServerboundMoveVehiclePacket moveVehiclePacket = new ServerboundMoveVehiclePacket(javaPos.getX(), javaPos.getY(), javaPos.getZ(), rotation.getX(), rotation.getY()); ServerboundMoveVehiclePacket moveVehiclePacket = new ServerboundMoveVehiclePacket(javaPos, rotation.getX(), rotation.getY(), vehicle.isOnGround());
vehicle.getSession().sendDownstreamPacket(moveVehiclePacket); vehicle.getSession().sendDownstreamPacket(moveVehiclePacket);
} }

Datei anzeigen

@ -70,6 +70,11 @@ import static org.geysermc.geyser.item.type.Item.builder;
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Items { public final class Items {
static {
// Load data components here
}
public static final Item AIR = register(new Item("air", builder())); public static final Item AIR = register(new Item("air", builder()));
public static final Item STONE = register(new BlockItem(builder(), Blocks.STONE)); public static final Item STONE = register(new BlockItem(builder(), Blocks.STONE));
public static final Item GRANITE = register(new BlockItem(builder(), Blocks.GRANITE)); public static final Item GRANITE = register(new BlockItem(builder(), Blocks.GRANITE));

Datei anzeigen

@ -62,12 +62,16 @@ public class Item {
private static final Map<Block, Item> BLOCK_TO_ITEM = new HashMap<>(); private static final Map<Block, Item> BLOCK_TO_ITEM = new HashMap<>();
protected final Key javaIdentifier; protected final Key javaIdentifier;
private int javaId = -1; private int javaId = -1;
// TODO remove these
private final int stackSize; private final int stackSize;
private final int attackDamage; private final int attackDamage;
private final int maxDamage; private final int maxDamage;
private final Rarity rarity; private final Rarity rarity;
private final boolean glint; private final boolean glint;
private DataComponents dataComponents;
public Item(String javaIdentifier, Builder builder) { public Item(String javaIdentifier, Builder builder) {
this.javaIdentifier = MinecraftKey.key(javaIdentifier); this.javaIdentifier = MinecraftKey.key(javaIdentifier);
this.stackSize = builder.stackSize; this.stackSize = builder.stackSize;
@ -86,7 +90,7 @@ public class Item {
} }
public int maxDamage() { public int maxDamage() {
return maxDamage; return dataComponents.getOrDefault(DataComponentType.MAX_DAMAGE, 0);
} }
public int attackDamage() { public int attackDamage() {
@ -94,7 +98,7 @@ public class Item {
} }
public int maxStackSize() { public int maxStackSize() {
return stackSize; return dataComponents.getOrDefault(DataComponentType.MAX_STACK_SIZE, 1);
} }
public Rarity rarity() { public Rarity rarity() {
@ -317,16 +321,6 @@ public class Item {
return this; return this;
} }
public Builder rarity(Rarity rarity) {
this.rarity = rarity;
return this;
}
public Builder glint(boolean glintOverride) {
this.glint = glintOverride;
return this;
}
private Builder() { private Builder() {
} }
} }

Datei anzeigen

@ -25,6 +25,7 @@
package org.geysermc.geyser.translator.item; package org.geysermc.geyser.translator.item;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.CustomModelData;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.Pair;
@ -52,7 +53,15 @@ public final class CustomItemTranslator {
return null; return null;
} }
int customModelData = components.getOrDefault(DataComponentType.CUSTOM_MODEL_DATA, 0); // TODO 1.21.4
float customModelDataInt = 0;
CustomModelData customModelData = components.get(DataComponentType.CUSTOM_MODEL_DATA);
if (customModelData != null) {
if (!customModelData.floats().isEmpty()) {
customModelDataInt = customModelData.floats().get(0);
}
}
boolean checkDamage = mapping.getJavaItem().maxDamage() > 0; boolean checkDamage = mapping.getJavaItem().maxDamage() > 0;
int damage = !checkDamage ? 0 : components.getOrDefault(DataComponentType.DAMAGE, 0); int damage = !checkDamage ? 0 : components.getOrDefault(DataComponentType.DAMAGE, 0);
boolean unbreakable = checkDamage && !isDamaged(components, damage); boolean unbreakable = checkDamage && !isDamaged(components, damage);
@ -88,7 +97,7 @@ public final class CustomItemTranslator {
} }
OptionalInt customModelDataOption = options.customModelData(); OptionalInt customModelDataOption = options.customModelData();
if (customModelDataOption.isPresent() && customModelData < customModelDataOption.getAsInt()) { if (customModelDataOption.isPresent() && customModelDataInt < customModelDataOption.getAsInt()) {
continue; continue;
} }

Datei anzeigen

@ -312,8 +312,9 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator<Pla
vehicle.setPosition(vehiclePosition); vehicle.setPosition(vehiclePosition);
ServerboundMoveVehiclePacket moveVehiclePacket = new ServerboundMoveVehiclePacket( ServerboundMoveVehiclePacket moveVehiclePacket = new ServerboundMoveVehiclePacket(
vehiclePosition.getX(), vehiclePosition.getY(), vehiclePosition.getZ(), vehiclePosition.toDouble(),
vehicleRotation.getY() - 90, vehiclePosition.getX() // TODO I wonder if this is related to the horse spinning bugs... vehicleRotation.getY() - 90, vehiclePosition.getX(), // TODO I wonder if this is related to the horse spinning bugs...
vehicle.isOnGround()
); );
session.sendDownstreamGamePacket(moveVehiclePacket); session.sendDownstreamGamePacket(moveVehiclePacket);
} }

Datei anzeigen

@ -25,13 +25,12 @@
package org.geysermc.geyser.translator.protocol.java.entity; package org.geysermc.geyser.translator.protocol.java.entity;
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket;
import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.vehicle.ClientVehicle; import org.geysermc.geyser.entity.vehicle.ClientVehicle;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket;
@Translator(packet = ClientboundMoveVehiclePacket.class) @Translator(packet = ClientboundMoveVehiclePacket.class)
public class JavaMoveVehicleTranslator extends PacketTranslator<ClientboundMoveVehiclePacket> { public class JavaMoveVehicleTranslator extends PacketTranslator<ClientboundMoveVehiclePacket> {
@ -42,9 +41,9 @@ public class JavaMoveVehicleTranslator extends PacketTranslator<ClientboundMoveV
if (entity == null) return; if (entity == null) return;
if (entity instanceof ClientVehicle clientVehicle) { if (entity instanceof ClientVehicle clientVehicle) {
clientVehicle.getVehicleComponent().moveAbsolute(packet.getX(), packet.getY(), packet.getZ()); clientVehicle.getVehicleComponent().moveAbsolute(packet.getPosition());
} }
entity.moveAbsolute(Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, true); entity.moveAbsolute(packet.getPosition().toFloat(), packet.getYRot(), packet.getXRot(), false, true);
} }
} }

Datei anzeigen

@ -69,7 +69,6 @@ import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDis
import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.TagSlotDisplay; import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.TagSlotDisplay;
import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.WithRemainderSlotDisplay; import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.WithRemainderSlotDisplay;
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemPacket;
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket; import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
@ -305,8 +304,9 @@ public class InventoryUtils {
} }
// If this is the item we're looking for // If this is the item we're looking for
if (geyserItem.getJavaId() == itemStack.getId() && Objects.equals(geyserItem.getComponents(), itemStack.getDataComponents())) { //TODO verify if (geyserItem.getJavaId() == itemStack.getId() && Objects.equals(geyserItem.getComponents(), itemStack.getDataComponents())) { //TODO verify
ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item //ServerboundPickItemFromBlockPacket packetToSend = new ServerboundPickItemFromBlockPacket(i); // https://wiki.vg/Protocol#Pick_Item
session.sendDownstreamGamePacket(packetToSend); //session.sendDownstreamGamePacket(packetToSend);
// TODO 1.21.4
return; return;
} }
} }
@ -368,8 +368,9 @@ public class InventoryUtils {
continue; continue;
} }
ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item // TODO 1.21.4
session.sendDownstreamGamePacket(packetToSend); //ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item
//session.sendDownstreamGamePacket(packetToSend);
return; return;
} }

Datei anzeigen

@ -154,7 +154,7 @@ public class ScoreboardIssueTests {
new ClientboundPlayerInfoUpdatePacket( new ClientboundPlayerInfoUpdatePacket(
EnumSet.of(PlayerListEntryAction.ADD_PLAYER, PlayerListEntryAction.UPDATE_LISTED), EnumSet.of(PlayerListEntryAction.ADD_PLAYER, PlayerListEntryAction.UPDATE_LISTED),
new PlayerListEntry[] { new PlayerListEntry[] {
new PlayerListEntry(npcUuid, new GameProfile(npcUuid, "1297"), false, 0, GameMode.SURVIVAL, null, 0, null, 0, null, null) new PlayerListEntry(npcUuid, new GameProfile(npcUuid, "1297"), false, 0, GameMode.SURVIVAL, null, false, 0, null, 0, null, null)
})); }));
//todo we don't have to remove an entry that was never in the playerlist in the first place //todo we don't have to remove an entry that was never in the playerlist in the first place

Datei anzeigen

@ -11,5 +11,5 @@ loom.ignoreDependencyLoomVersionValidation=true
group=org.geysermc group=org.geysermc
id=geyser id=geyser
version=2.5.0-SNAPSHOT version=2.6.0-SNAPSHOT
description=Allows for players from Minecraft: Bedrock Edition to join Minecraft: Java Edition servers. description=Allows for players from Minecraft: Bedrock Edition to join Minecraft: Java Edition servers.

Datei anzeigen

@ -15,7 +15,7 @@ protocol-common = "3.0.0.Beta5-20241022.154658-14"
protocol-codec = "3.0.0.Beta5-20241022.154658-14" protocol-codec = "3.0.0.Beta5-20241022.154658-14"
raknet = "1.0.0.CR3-20240416.144209-1" raknet = "1.0.0.CR3-20240416.144209-1"
minecraftauth = "4.1.1" minecraftauth = "4.1.1"
mcprotocollib = "1.21.2-20241107.110329-3" mcprotocollib = "1.21.4-SNAPSHOT"
adventure = "4.14.0" adventure = "4.14.0"
adventure-platform = "4.3.0" adventure-platform = "4.3.0"
junit = "5.9.2" junit = "5.9.2"
@ -34,12 +34,12 @@ bungeecord = "a7c6ede"
velocity = "3.3.0-SNAPSHOT" velocity = "3.3.0-SNAPSHOT"
viaproxy = "3.3.2-SNAPSHOT" viaproxy = "3.3.2-SNAPSHOT"
fabric-loader = "0.16.7" fabric-loader = "0.16.7"
fabric-api = "0.106.1+1.21.3" fabric-api = "0.109.1+1.21.4"
fabric-permissions-api = "0.3.3" fabric-permissions-api = "0.3.3"
neoforge-minecraft = "21.3.0-beta" neoforge-minecraft = "21.3.0-beta"
mixin = "0.8.5" mixin = "0.8.5"
mixinextras = "0.3.5" mixinextras = "0.3.5"
minecraft = "1.21.3" minecraft = "1.21.4-pre3"
mockito = "5.+" mockito = "5.+"
# plugin versions # plugin versions

Datei anzeigen

@ -20,7 +20,7 @@ include(":ap")
include(":api") include(":api")
include(":bungeecord") include(":bungeecord")
include(":fabric") include(":fabric")
include(":neoforge") //include(":neoforge")
include(":mod") include(":mod")
include(":spigot") include(":spigot")
include(":standalone") include(":standalone")
@ -32,7 +32,7 @@ include(":core")
// Specify project dirs // Specify project dirs
project(":bungeecord").projectDir = file("bootstrap/bungeecord") project(":bungeecord").projectDir = file("bootstrap/bungeecord")
project(":fabric").projectDir = file("bootstrap/mod/fabric") project(":fabric").projectDir = file("bootstrap/mod/fabric")
project(":neoforge").projectDir = file("bootstrap/mod/neoforge") //project(":neoforge").projectDir = file("bootstrap/mod/neoforge")
project(":mod").projectDir = file("bootstrap/mod") project(":mod").projectDir = file("bootstrap/mod")
project(":spigot").projectDir = file("bootstrap/spigot") project(":spigot").projectDir = file("bootstrap/spigot")
project(":standalone").projectDir = file("bootstrap/standalone") project(":standalone").projectDir = file("bootstrap/standalone")