Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01:00
Fix serverbound hanging sign updates (#3904)
Dieser Commit ist enthalten in:
Ursprung
70db98eeaf
Commit
8aed471ba0
@ -45,7 +45,6 @@ import java.util.Locale;
|
|||||||
*/
|
*/
|
||||||
public final class BlockStateValues {
|
public final class BlockStateValues {
|
||||||
private static final IntSet ALL_CAULDRONS = new IntOpenHashSet();
|
private static final IntSet ALL_CAULDRONS = new IntOpenHashSet();
|
||||||
private static final IntSet HANGING_SIGNS = new IntOpenHashSet();
|
|
||||||
private static final Int2IntMap BANNER_COLORS = new FixedInt2IntMap();
|
private static final Int2IntMap BANNER_COLORS = new FixedInt2IntMap();
|
||||||
private static final Int2ByteMap BED_COLORS = new FixedInt2ByteMap();
|
private static final Int2ByteMap BED_COLORS = new FixedInt2ByteMap();
|
||||||
private static final Int2IntMap BRUSH_PROGRESS = new Int2IntOpenHashMap();
|
private static final Int2IntMap BRUSH_PROGRESS = new Int2IntOpenHashMap();
|
||||||
@ -88,12 +87,6 @@ public final class BlockStateValues {
|
|||||||
* @param blockData JsonNode of info about the block from blocks.json
|
* @param blockData JsonNode of info about the block from blocks.json
|
||||||
*/
|
*/
|
||||||
public static void storeBlockStateValues(String javaId, int javaBlockState, JsonNode blockData) {
|
public static void storeBlockStateValues(String javaId, int javaBlockState, JsonNode blockData) {
|
||||||
if (javaId.contains("_hanging_sign")) {
|
|
||||||
// covers hanging_sign and wall_hanging_sign
|
|
||||||
HANGING_SIGNS.add(javaBlockState);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonNode bannerColor = blockData.get("banner_color");
|
JsonNode bannerColor = blockData.get("banner_color");
|
||||||
if (bannerColor != null) {
|
if (bannerColor != null) {
|
||||||
BANNER_COLORS.put(javaBlockState, (byte) bannerColor.intValue());
|
BANNER_COLORS.put(javaBlockState, (byte) bannerColor.intValue());
|
||||||
@ -220,17 +213,6 @@ public final class BlockStateValues {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hanging signs have a different maximum text width than "normal" signs. As a result, when the client
|
|
||||||
* updates the text of a sign without indication of the sign type, we must determine it.
|
|
||||||
*
|
|
||||||
* @param state BlockState of the block
|
|
||||||
* @return true if the sign is any hanging variant
|
|
||||||
*/
|
|
||||||
public static boolean isHangingSign(int state) {
|
|
||||||
return HANGING_SIGNS.contains(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Banner colors are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.
|
* Banner colors are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock.
|
||||||
* This gives an integer color that Bedrock can use.
|
* This gives an integer color that Bedrock can use.
|
||||||
|
@ -43,9 +43,9 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator<BlockEnti
|
|||||||
public void translate(GeyserSession session, BlockEntityDataPacket packet) {
|
public void translate(GeyserSession session, BlockEntityDataPacket packet) {
|
||||||
NbtMap tag = packet.getData();
|
NbtMap tag = packet.getData();
|
||||||
String id = tag.getString("id");
|
String id = tag.getString("id");
|
||||||
if (id.equals("Sign")) {
|
if (id.endsWith("Sign")) {
|
||||||
// Hanging signs are narrower
|
// Hanging signs are narrower
|
||||||
int widthMax = SignUtils.getSignWidthMax(session.getGeyser().getWorldManager().getBlockAt(session, packet.getBlockPosition()));
|
int widthMax = SignUtils.getSignWidthMax(id.startsWith("Hanging"));
|
||||||
|
|
||||||
String text = MessageTranslator.convertToPlainText(
|
String text = MessageTranslator.convertToPlainText(
|
||||||
tag.getCompound(session.getWorldCache().isEditingSignOnFront() ? "FrontText" : "BackText").getString("Text"));
|
tag.getCompound(session.getWorldCache().isEditingSignOnFront() ? "FrontText" : "BackText").getString("Text"));
|
||||||
|
@ -61,8 +61,8 @@ public class SignUtils {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSignWidthMax(int javaBlockState) {
|
public static int getSignWidthMax(boolean hanging) {
|
||||||
if (BlockStateValues.isHangingSign(javaBlockState)) {
|
if (hanging) {
|
||||||
return HANGING_SIGN_WIDTH_MAX;
|
return HANGING_SIGN_WIDTH_MAX;
|
||||||
}
|
}
|
||||||
return SIGN_WIDTH_MAX;
|
return SIGN_WIDTH_MAX;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren