Merge branch 'master' of https://github.com/GeyserMC/Geyser into feature/1.21

This commit is contained in:
Camotoy 2024-06-16 12:19:32 -04:00
commit 3b46622ffa
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
3 changed files with 27 additions and 20 deletions

View file

@ -34,6 +34,7 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.level.block.property.Properties; import org.geysermc.geyser.level.block.property.Properties;
import org.geysermc.geyser.level.block.type.BedBlock;
import org.geysermc.geyser.level.block.type.BlockState; import org.geysermc.geyser.level.block.type.BlockState;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata; import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata;
@ -125,22 +126,24 @@ public class VillagerEntity extends AbstractMerchantEntity {
int bedRotation = 0; int bedRotation = 0;
float xOffset = 0; float xOffset = 0;
float zOffset = 0; float zOffset = 0;
switch (state.getValue(Properties.HORIZONTAL_FACING)) { if (state.block() instanceof BedBlock) {
case SOUTH -> { switch (state.getValue(Properties.HORIZONTAL_FACING)) {
bedRotation = 180; case SOUTH -> {
zOffset = -.5f; bedRotation = 180;
} zOffset = -.5f;
case EAST -> { }
bedRotation = 90; case EAST -> {
xOffset = -.5f; bedRotation = 90;
} xOffset = -.5f;
case WEST -> { }
bedRotation = 270; case WEST -> {
xOffset = .5f; bedRotation = 270;
} xOffset = .5f;
case NORTH -> { }
// rotation does not change because north is 0 case NORTH -> {
zOffset = .5f; // rotation does not change because north is 0
zOffset = .5f;
}
} }
} }

View file

@ -35,10 +35,7 @@ import org.cloudburstmc.nbt.util.VarInts;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.network.GameProtocol;
import java.io.ByteArrayOutputStream; import java.io.*;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.*; import java.net.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -139,6 +136,9 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn
this.geyser.getLogger().debug("Connection timeout for ping passthrough."); this.geyser.getLogger().debug("Connection timeout for ping passthrough.");
} catch (JsonParseException | JsonMappingException ex) { } catch (JsonParseException | JsonMappingException ex) {
this.geyser.getLogger().error("Failed to parse json when pinging server!", ex); this.geyser.getLogger().error("Failed to parse json when pinging server!", ex);
} catch (EOFException e) {
this.pingInfo = null;
this.geyser.getLogger().warning("Failed to ping the remote Java server! Is it online and configured in Geyser's config?");
} catch (UnknownHostException ex) { } catch (UnknownHostException ex) {
// Don't reset pingInfo, as we want to keep the last known value // Don't reset pingInfo, as we want to keep the last known value
this.geyser.getLogger().warning("Unable to resolve remote host! Is the remote server down or invalid?"); this.geyser.getLogger().warning("Unable to resolve remote host! Is the remote server down or invalid?");

View file

@ -27,6 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity;
import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.nbt.NbtMapBuilder;
import org.geysermc.geyser.level.block.Blocks;
import org.geysermc.geyser.level.block.property.ChestType; import org.geysermc.geyser.level.block.property.ChestType;
import org.geysermc.geyser.level.block.property.Properties; import org.geysermc.geyser.level.block.property.Properties;
import org.geysermc.geyser.level.block.type.BlockState; import org.geysermc.geyser.level.block.type.BlockState;
@ -42,6 +43,9 @@ public class DoubleChestBlockEntityTranslator extends BlockEntityTranslator impl
@Override @Override
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) { public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, NbtMap javaNbt, BlockState blockState) {
if (!(blockState.is(Blocks.CHEST) || blockState.is(Blocks.TRAPPED_CHEST))) {
return;
}
if (blockState.getValue(Properties.CHEST_TYPE) != ChestType.SINGLE) { if (blockState.getValue(Properties.CHEST_TYPE) != ChestType.SINGLE) {
int x = (int) bedrockNbt.get("x"); int x = (int) bedrockNbt.get("x");
int z = (int) bedrockNbt.get("z"); int z = (int) bedrockNbt.get("z");