3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-02 08:00:07 +02:00

Merge upstream (1.19.4/1.19.70)

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
Dieser Commit ist enthalten in:
Joshua Castle 2023-03-14 20:48:46 -07:00
Commit 9be2ec9d65
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: F674F38216C35D5D
26 geänderte Dateien mit 10360 neuen und 127 gelöschten Zeilen

Datei anzeigen

@ -17,7 +17,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.19.20 - 1.19.63 and Minecraft Java 1.19.3.
### Currently supporting Minecraft Bedrock 1.19.30 - 1.19.70 and Minecraft Java 1.19.4.
## Setting Up
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.

Datei anzeigen

@ -31,10 +31,6 @@ dependencies {
exclude("com.github.GeyserMC", "mcauthlib")
}
api(libs.packetlib) {
exclude("io.netty", "netty-all")
}
implementation(libs.raknet) {
exclude("io.netty", "*");
}

Datei anzeigen

@ -83,8 +83,6 @@ public interface GeyserConfiguration {
boolean isDisableBedrockScaffolding();
boolean isAlwaysQuickChangeArmor();
EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround();
String getDefaultLocale();

Datei anzeigen

@ -111,9 +111,6 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
@JsonProperty("disable-bedrock-scaffolding")
private boolean disableBedrockScaffolding = false;
@JsonProperty("always-quick-change-armor")
private boolean alwaysQuickChangeArmor = false;
@JsonDeserialize(using = EmoteOffhandWorkaroundOption.Deserializer.class)
@JsonProperty("emote-offhand-workaround")
private EmoteOffhandWorkaroundOption emoteOffhandWorkaround = EmoteOffhandWorkaroundOption.DISABLED;

Datei anzeigen

@ -486,7 +486,7 @@ public final class EntityDefinitions {
ENDERMAN = EntityDefinition.inherited(EndermanEntity::new, mobEntityBase)
.type(EntityType.ENDERMAN)
.height(2.9f).width(0.6f)
.addTranslator(MetadataType.BLOCK_STATE, EndermanEntity::setCarriedBlock)
.addTranslator(MetadataType.OPTIONAL_BLOCK_STATE, EndermanEntity::setCarriedBlock)
.addTranslator(MetadataType.BOOLEAN, EndermanEntity::setScreaming)
.addTranslator(MetadataType.BOOLEAN, EndermanEntity::setAngry)
.build();
@ -858,7 +858,6 @@ public final class EntityDefinitions {
{
EntityDefinition<AbstractHorseEntity> abstractHorseEntityBase = EntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase)
.addTranslator(MetadataType.BYTE, AbstractHorseEntity::setHorseFlags)
.addTranslator(null) // UUID of owner
.build();
CAMEL = EntityDefinition.inherited(CamelEntity::new, abstractHorseEntityBase)
.type(EntityType.CAMEL)

Datei anzeigen

@ -28,6 +28,7 @@ package org.geysermc.geyser.entity.type.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.OptionalIntMetadataType;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
@ -45,13 +46,8 @@ public class EndermanEntity extends MonsterEntity {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
}
public void setCarriedBlock(EntityMetadata<OptionalInt, OptionalIntMetadataType> entityMetadata) {
int bedrockBlockId;
if (entityMetadata.getValue().isPresent()) {
bedrockBlockId = session.getBlockMappings().getBedrockBlockId(entityMetadata.getValue().getAsInt());
} else {
bedrockBlockId = session.getBlockMappings().getBedrockAirId();
}
public void setCarriedBlock(IntEntityMetadata entityMetadata) {
int bedrockBlockId = session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue());;
dirtyMetadata.put(EntityData.CARRIED_BLOCK, bedrockBlockId);
}

Datei anzeigen

@ -25,19 +25,18 @@
package org.geysermc.geyser.level.physics;
import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue;
import com.nukkitx.math.vector.Vector3i;
import lombok.Getter;
import javax.annotation.Nonnull;
public enum Direction {
DOWN(1, Vector3i.from(0, -1, 0), Axis.Y, PistonValue.DOWN),
UP(0, Vector3i.UNIT_Y, Axis.Y, PistonValue.UP),
NORTH(3, Vector3i.from(0, 0, -1), Axis.Z, PistonValue.NORTH),
SOUTH(2, Vector3i.UNIT_Z, Axis.Z, PistonValue.SOUTH),
WEST(5, Vector3i.from(-1, 0, 0), Axis.X, PistonValue.WEST),
EAST(4, Vector3i.UNIT_X, Axis.X, PistonValue.EAST);
DOWN(1, Vector3i.from(0, -1, 0), Axis.Y, com.github.steveice10.mc.protocol.data.game.entity.object.Direction.DOWN),
UP(0, Vector3i.UNIT_Y, Axis.Y, com.github.steveice10.mc.protocol.data.game.entity.object.Direction.UP),
NORTH(3, Vector3i.from(0, 0, -1), Axis.Z, com.github.steveice10.mc.protocol.data.game.entity.object.Direction.NORTH),
SOUTH(2, Vector3i.UNIT_Z, Axis.Z, com.github.steveice10.mc.protocol.data.game.entity.object.Direction.SOUTH),
WEST(5, Vector3i.from(-1, 0, 0), Axis.X, com.github.steveice10.mc.protocol.data.game.entity.object.Direction.WEST),
EAST(4, Vector3i.UNIT_X, Axis.X, com.github.steveice10.mc.protocol.data.game.entity.object.Direction.EAST);
public static final Direction[] VALUES = values();
@ -46,10 +45,9 @@ public enum Direction {
private final Vector3i unitVector;
@Getter
private final Axis axis;
@Getter
private final PistonValue pistonValue;
private final com.github.steveice10.mc.protocol.data.game.entity.object.Direction pistonValue;
Direction(int reversedId, Vector3i unitVector, Axis axis, PistonValue pistonValue) {
Direction(int reversedId, Vector3i unitVector, Axis axis, com.github.steveice10.mc.protocol.data.game.entity.object.Direction pistonValue) {
this.reversedId = reversedId;
this.unitVector = unitVector;
this.axis = axis;
@ -69,7 +67,7 @@ public enum Direction {
}
@Nonnull
public static Direction fromPistonValue(PistonValue pistonValue) {
public static Direction fromPistonValue(com.github.steveice10.mc.protocol.data.game.entity.object.Direction pistonValue) {
for (Direction direction : VALUES) {
if (direction.pistonValue == pistonValue) {
return direction;

Datei anzeigen

@ -28,6 +28,7 @@ package org.geysermc.geyser.network;
import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
import com.github.steveice10.mc.protocol.codec.PacketCodec;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.v554.Bedrock_v554;
import com.nukkitx.protocol.bedrock.v557.Bedrock_v557;
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
import com.nukkitx.protocol.bedrock.v567.Bedrock_v567;
@ -46,7 +47,10 @@ public final class GameProtocol {
* Default Bedrock codec that should act as a fallback. Should represent the latest available
* release of the game that Geyser supports.
*/
public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v567.V567_CODEC;
public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v567patch.BEDROCK_V567PATCH.toBuilder()
.protocolVersion(575)
.minecraftVersion("1.19.70")
.build();
/**
* A list of all supported Bedrock versions that can join Geyser
*/
@ -59,17 +63,21 @@ public final class GameProtocol {
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
static {
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v554.V554_CODEC.toBuilder()
.minecraftVersion("1.19.30/1.19.31")
.build());
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v557.V557_CODEC.toBuilder()
.minecraftVersion("1.19.40/1.19.41")
.build());
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v560.V560_CODEC.toBuilder()
.minecraftVersion("1.19.50/1.19.51")
.build());
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v567.V567_CODEC);
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v567patch.BEDROCK_V567PATCH.toBuilder()
.protocolVersion(568)
.minecraftVersion("1.19.62")
.build());
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
}
/**

Datei anzeigen

@ -79,6 +79,16 @@ public final class BlockRegistryPopulator {
.put(ObjectIntPair.of("1_19_20", Bedrock_v544.V544_CODEC.getProtocolVersion()), emptyMapper)
.put(ObjectIntPair.of("1_19_50", Bedrock_v560.V560_CODEC.getProtocolVersion()), emptyMapper)
.put(ObjectIntPair.of("1_19_60", Bedrock_v567.V567_CODEC.getProtocolVersion()), emptyMapper)
.put(ObjectIntPair.of("1_19_70", 575), (bedrockIdentifier, statesBuilder) -> {
if (bedrockIdentifier.equals("minecraft:wool")) {
String color = (String) statesBuilder.remove("color");
if ("silver".equals(color)) {
color = "light_gray";
}
return "minecraft:" + color + "_wool";
}
return null;
})
.build();
for (Map.Entry<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> palette : blockMappers.entrySet()) {

Datei anzeigen

@ -90,6 +90,7 @@ public class ItemRegistryPopulator {
paletteVersions.put("1_19_20", new PaletteVersion(Bedrock_v544.V544_CODEC.getProtocolVersion(), Collections.emptyMap()));
paletteVersions.put("1_19_50", new PaletteVersion(Bedrock_v560.V560_CODEC.getProtocolVersion(), Collections.emptyMap()));
paletteVersions.put("1_19_60", new PaletteVersion(Bedrock_v567.V567_CODEC.getProtocolVersion(), Collections.emptyMap()));
paletteVersions.put("1_19_70", new PaletteVersion(575, Collections.emptyMap()));
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
@ -323,6 +324,11 @@ public class ItemRegistryPopulator {
mappingItem = entry.getValue();
}
// 1.19.70+
if (palette.getValue().protocolVersion() >= 575 && mappingItem.getBedrockIdentifier().equals("minecraft:wool")) {
mappingItem.setBedrockIdentifier(javaIdentifier);
}
if (customItemsAllowed && javaIdentifier.equals("minecraft:furnace_minecart")) {
javaFurnaceMinecartId = itemIndex;
itemIndex++;

Datei anzeigen

@ -33,7 +33,9 @@ import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import javax.annotation.Nullable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@Getter
@ -44,7 +46,7 @@ public final class Team {
@Getter(AccessLevel.PACKAGE)
private final Set<String> entities;
@Setter private NameTagVisibility nameTagVisibility;
@Setter @Nullable private NameTagVisibility nameTagVisibility;
@Setter private TeamColor color;
private final TeamData currentData;
@ -187,6 +189,11 @@ public final class Team {
}
public boolean isVisibleFor(String entity) {
if (nameTagVisibility == null) {
// Null - normal behavior
return true;
}
return switch (nameTagVisibility) {
case HIDE_FOR_OTHER_TEAMS -> {
// Player must be in a team in order for HIDE_FOR_OTHER_TEAMS to be triggered
@ -199,6 +206,10 @@ public final class Team {
};
}
public NameTagVisibility getNameTagVisibility() {
return Objects.requireNonNullElse(this.nameTagVisibility, NameTagVisibility.ALWAYS);
}
@Override
public int hashCode() {
return id.hashCode();

Datei anzeigen

@ -1018,7 +1018,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
// Server is offline, probably
disconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.server_offline", locale());
} else {
disconnectMessage = MessageTranslator.convertMessageLenient(event.getReason());
disconnectMessage = MessageTranslator.convertMessage(event.getReason());
}
if (downstream instanceof LocalSession) {

Datei anzeigen

@ -32,12 +32,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.*;
import com.nukkitx.math.vector.Vector3d;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i;
@ -46,14 +41,12 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import com.nukkitx.protocol.bedrock.data.inventory.InventorySource;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.data.inventory.LegacySetItemSlotData;
import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket;
import com.nukkitx.protocol.bedrock.packet.InventoryTransactionPacket;
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.type.ItemFrameEntity;
@ -76,9 +69,7 @@ import org.geysermc.geyser.util.BlockUtils;
import org.geysermc.geyser.util.CooldownUtils;
import org.geysermc.geyser.util.EntityUtils;
import org.geysermc.geyser.util.InteractionResult;
import org.geysermc.geyser.util.InventoryUtils;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
@ -357,43 +348,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
ServerboundUseItemPacket useItemPacket = new ServerboundUseItemPacket(Hand.MAIN_HAND, session.getWorldCache().nextPredictionSequence());
session.sendDownstreamPacket(useItemPacket);
List<LegacySetItemSlotData> legacySlots = packet.getLegacySlots();
if (packet.getActions().size() == 1 && legacySlots.size() > 0) {
InventoryActionData actionData = packet.getActions().get(0);
LegacySetItemSlotData slotData = legacySlots.get(0);
if (slotData.getContainerId() == 6 && actionData.getToItem().getId() != 0) {
// The player is trying to swap out an armor piece that already has an item in it
if (session.getGeyser().getConfig().isAlwaysQuickChangeArmor()) {
// Java doesn't know when a player is in its own inventory and not, so we
// can abuse this feature to send a swap inventory packet
int bedrockHotbarSlot = packet.getHotbarSlot();
Click click = InventoryUtils.getClickForHotbarSwap(bedrockHotbarSlot);
if (click != null && slotData.getSlots().length != 0) {
Inventory playerInventory = session.getPlayerInventory();
// Bedrock sends us the index of the slot in the armor container; armor in Java
// Edition is offset by 5 in the player inventory
int armorSlot = slotData.getSlots()[0] + 5;
GeyserItemStack armorSlotItem = playerInventory.getItem(armorSlot);
GeyserItemStack hotbarItem = playerInventory.getItem(playerInventory.getOffsetForHotbar(bedrockHotbarSlot));
playerInventory.setItem(armorSlot, hotbarItem, session);
playerInventory.setItem(bedrockHotbarSlot, armorSlotItem, session);
Int2ObjectMap<ItemStack> changedSlots = new Int2ObjectOpenHashMap<>(2);
changedSlots.put(armorSlot, hotbarItem.getItemStack());
changedSlots.put(bedrockHotbarSlot, armorSlotItem.getItemStack());
ServerboundContainerClickPacket clickPacket = new ServerboundContainerClickPacket(
playerInventory.getJavaId(), playerInventory.getStateId(), armorSlot,
click.actionType, click.action, null, changedSlots);
session.sendDownstreamPacket(clickPacket);
}
} else {
// Disallowed; let's revert
session.getInventoryTranslator().updateInventory(session, session.getPlayerInventory());
}
}
}
}
case 2 -> {
int blockState = session.getGameMode() == GameMode.CREATIVE ?

Datei anzeigen

@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
import com.github.steveice10.mc.protocol.data.game.recipe.Recipe;
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
import com.github.steveice10.mc.protocol.data.game.recipe.data.LegacyUpgradeRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.SmithingRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.StoneCuttingRecipeData;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateRecipesPacket;
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
@ -137,7 +137,7 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
}
case SMITHING -> {
// Required to translate these as of 1.18.10, or else they cannot be crafted
SmithingRecipeData recipeData = (SmithingRecipeData) recipe.getData();
LegacyUpgradeRecipeData recipeData = (LegacyUpgradeRecipeData) recipe.getData();
ItemData output = ItemTranslator.translateToBedrock(session, recipeData.getResult());
for (ItemStack base : recipeData.getBase().getOptions()) {
ItemDescriptorWithCount bedrockBase = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, base));

Datei anzeigen

@ -0,0 +1,52 @@
/*
* 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.translator.protocol.java.entity;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundDamageEventPacket;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
@Translator(packet = ClientboundDamageEventPacket.class)
public class JavaDamageEventTranslator extends PacketTranslator<ClientboundDamageEventPacket> {
@Override
public void translate(GeyserSession session, ClientboundDamageEventPacket packet) {
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
if (entity == null) {
return;
}
// We can probably actually map damage types.
EntityEventPacket entityEventPacket = new EntityEventPacket();
entityEventPacket.setRuntimeEntityId(entity.getGeyserId());
entityEventPacket.setType(EntityEventType.HURT);
session.sendUpstreamPacket(entityEventPacket);
}
}

Datei anzeigen

@ -83,15 +83,6 @@ public class JavaEntityEventTranslator extends PacketTranslator<ClientboundEntit
session.sendAdventureSettings();
return;
// EntityEventType.HURT sends extra data depending on the type of damage. However this appears to have no visual changes
case LIVING_BURN:
case LIVING_DROWN:
case LIVING_HURT:
case LIVING_HURT_SWEET_BERRY_BUSH:
case LIVING_HURT_THORNS:
case LIVING_FREEZE:
entityEventPacket.setType(EntityEventType.HURT);
break;
case LIVING_DEATH:
entityEventPacket.setType(EntityEventType.DEATH);
if (entity.getDefinition() == EntityDefinitions.EGG) {

Datei anzeigen

@ -91,6 +91,16 @@ public class JavaSetPassengersTranslator extends PacketTranslator<ClientboundSet
EntityUtils.updateMountOffset(passenger, entity, false, false, (packet.getPassengerIds().length > 1));
// Force an update to the passenger metadata
passenger.updateBedrockMetadata();
if (passenger == session.getPlayerEntity()) {
//TODO test
if (session.getMountVehicleScheduledFuture() != null) {
// Cancel this task as it is now unnecessary.
// Note that this isn't present in JavaSetPassengersTranslator as that code is not called for players
// as of Java 1.19.3, but the scheduled future checks for the vehicle being null anyway.
session.getMountVehicleScheduledFuture().cancel(false);
}
}
}
}

Datei anzeigen

@ -30,20 +30,16 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData;
import com.nukkitx.protocol.bedrock.packet.ChunkRadiusUpdatedPacket;
import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket;
import com.nukkitx.protocol.bedrock.packet.RespawnPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.session.cache.TeleportCache;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.geyser.util.ChunkUtils;
import org.geysermc.geyser.util.EntityUtils;
@Translator(packet = ClientboundPlayerPositionPacket.class)
public class JavaPlayerPositionTranslator extends PacketTranslator<ClientboundPlayerPositionPacket> {
@ -101,27 +97,6 @@ public class JavaPlayerPositionTranslator extends PacketTranslator<ClientboundPl
return;
}
Entity vehicle;
if (packet.isDismountVehicle() && (vehicle = session.getPlayerEntity().getVehicle()) != null) {
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
linkPacket.setEntityLink(new EntityLinkData(vehicle.getGeyserId(), entity.getGeyserId(), EntityLinkData.Type.REMOVE, false, false));
session.sendUpstreamPacket(linkPacket);
vehicle.getPassengers().remove(entity);
session.getPlayerEntity().setVehicle(null);
EntityUtils.updateRiderRotationLock(entity, null, false);
EntityUtils.updateMountOffset(entity, null, false, false, entity.getPassengers().size() > 1);
entity.updateBedrockMetadata();
if (session.getMountVehicleScheduledFuture() != null) {
// Cancel this task as it is now unnecessary.
// Note that this isn't present in JavaSetPassengersTranslator as that code is not called for players
// as of Java 1.19.3, but the scheduled future checks for the vehicle being null anyway.
session.getMountVehicleScheduledFuture().cancel(false);
}
}
// If coordinates are relative, then add to the existing coordinate
double newX = packet.getX() +
(packet.getRelative().contains(PositionElement.X) ? entity.getPosition().getX() : 0);

Datei anzeigen

@ -63,7 +63,7 @@ public class JavaBlockEventTranslator extends PacketTranslator<ClientboundBlockE
session.sendUpstreamPacket(blockEventPacket);
} else if (packet.getValue() instanceof PistonValue pistonValue) {
PistonValueType action = (PistonValueType) packet.getType();
Direction direction = Direction.fromPistonValue(pistonValue);
Direction direction = Direction.fromPistonValue(pistonValue.getDirection());
PistonCache pistonCache = session.getPistonCache();
if (session.getGeyser().getPlatformType() == PlatformType.SPIGOT) {

Datei anzeigen

@ -157,7 +157,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
SmokeEventData smokeEventData = (SmokeEventData) packet.getData();
int data = 0;
switch (smokeEventData) {
switch (smokeEventData.getDirection()) {
case DOWN -> {
data = 4;
pos = pos.add(0, -0.9f, 0);

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 anzeigen

@ -130,10 +130,6 @@ show-coordinates: true
# Whether Bedrock players are blocked from performing their scaffolding-style bridging.
disable-bedrock-scaffolding: false
# Whether Bedrock players can right-click outside of their inventory to replace armor in their inventory, even if the
# armor slot is already occupied (which Java Edition doesn't allow)
always-quick-change-armor: false
# If set, when a Bedrock player performs any emote, it will swap the offhand and mainhand items, just like the Java Edition keybind
# There are three options this can be set to:
# disabled - the default/fallback, which doesn't apply this workaround

@ -1 +1 @@
Subproject commit 677c5b0872d2f0c99ad834c0ca49a0ae3b45fde3
Subproject commit eab643ddbaf31c4d76531376838f8fd30633bb8e

Datei anzeigen

@ -11,8 +11,7 @@ websocket = "1.5.1"
protocol = "2.9.17-20230217.002312-1"
raknet = "1.6.28-20220125.214016-6"
mcauthlib = "d9d773e"
mcprotocollib = "1.19.3-20230107.194116-10"
packetlib = "3.0.1"
mcprotocollib = "1.19.4-20230314.173921-2"
adventure = "4.12.0-20220629.025215-9"
adventure-platform = "4.1.2"
junit = "5.9.2"
@ -84,7 +83,6 @@ gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" }
mcprotocollib = { group = "com.github.steveice10", name = "mcprotocollib", version.ref = "mcprotocollib" }
packetlib = { group = "com.github.steveice10", name = "packetlib", version.ref = "packetlib" }
protocol = { group = "com.nukkitx.protocol", name = "bedrock-v567", version.ref = "protocol" }
raknet = { group = "com.nukkitx.network", name = "raknet", version.ref = "raknet" }
sponge-api = { group = "org.spongepowered", name = "spongeapi", version.ref = "sponge" }