SPIGOT-7398: TextDisplay#setInterpolationDuration incorrectly updates the line width

This commit is contained in:
md_5 2023-07-08 13:07:16 +10:00
parent b60a95c8cf
commit ce545de57f
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
2 changed files with 93 additions and 3 deletions

View File

@ -0,0 +1,90 @@
--- a/net/minecraft/world/entity/Display.java
+++ b/net/minecraft/world/entity/Display.java
@@ -183,11 +183,11 @@
@Override
protected void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
- DataResult dataresult;
+ // DataResult dataresult; // CraftBukkit - decompile error
Logger logger;
if (nbttagcompound.contains("transformation")) {
- dataresult = Transformation.EXTENDED_CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("transformation"));
+ DataResult<Pair<Transformation, net.minecraft.nbt.NBTBase>> dataresult = Transformation.EXTENDED_CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("transformation")); // CraftBukkit - decompile error
logger = Display.LOGGER;
Objects.requireNonNull(logger);
dataresult.resultOrPartial(SystemUtils.prefix("Display entity", logger::error)).ifPresent((pair) -> {
@@ -208,7 +208,7 @@
}
if (nbttagcompound.contains("billboard", 8)) {
- dataresult = Display.BillboardConstraints.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("billboard"));
+ DataResult<Pair<Display.BillboardConstraints, net.minecraft.nbt.NBTBase>> dataresult = Display.BillboardConstraints.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("billboard")); // CraftBukkit - decompile error
logger = Display.LOGGER;
Objects.requireNonNull(logger);
dataresult.resultOrPartial(SystemUtils.prefix("Display entity", logger::error)).ifPresent((pair) -> {
@@ -241,7 +241,7 @@
}
if (nbttagcompound.contains("brightness", 10)) {
- dataresult = Brightness.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("brightness"));
+ DataResult<Pair<Brightness, net.minecraft.nbt.NBTBase>> dataresult = Brightness.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("brightness")); // CraftBukkit - decompile error
logger = Display.LOGGER;
Objects.requireNonNull(logger);
dataresult.resultOrPartial(SystemUtils.prefix("Display entity", logger::error)).ifPresent((pair) -> {
@@ -594,8 +594,8 @@
private static final byte INITIAL_TEXT_OPACITY = -1;
public static final int INITIAL_BACKGROUND = 1073741824;
private static final DataWatcherObject<IChatBaseComponent> DATA_TEXT_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.COMPONENT);
- private static final DataWatcherObject<Integer> DATA_LINE_WIDTH_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
- private static final DataWatcherObject<Integer> DATA_BACKGROUND_COLOR_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
+ public static final DataWatcherObject<Integer> DATA_LINE_WIDTH_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
+ public static final DataWatcherObject<Integer> DATA_BACKGROUND_COLOR_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
private static final DataWatcherObject<Byte> DATA_TEXT_OPACITY_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.BYTE);
private static final DataWatcherObject<Byte> DATA_STYLE_FLAGS_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.BYTE);
private static final IntSet TEXT_RENDER_STATE_IDS = IntSet.of(new int[]{Display.TextDisplay.DATA_TEXT_ID.getId(), Display.TextDisplay.DATA_LINE_WIDTH_ID.getId(), Display.TextDisplay.DATA_BACKGROUND_COLOR_ID.getId(), Display.TextDisplay.DATA_TEXT_OPACITY_ID.getId(), Display.TextDisplay.DATA_STYLE_FLAGS_ID.getId()});
@@ -614,7 +614,7 @@
this.entityData.define(Display.TextDisplay.DATA_TEXT_ID, IChatBaseComponent.empty());
this.entityData.define(Display.TextDisplay.DATA_LINE_WIDTH_ID, 200);
this.entityData.define(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID, 1073741824);
- this.entityData.define(Display.TextDisplay.DATA_TEXT_OPACITY_ID, -1);
+ this.entityData.define(Display.TextDisplay.DATA_TEXT_OPACITY_ID, (byte) -1); // CraftBukkit - decompile error
this.entityData.define(Display.TextDisplay.DATA_STYLE_FLAGS_ID, (byte) 0);
}
@@ -639,7 +639,7 @@
return (Integer) this.entityData.get(Display.TextDisplay.DATA_LINE_WIDTH_ID);
}
- public void setLineWidth(int i) {
+ private void setLineWidth(int i) {
this.entityData.set(Display.TextDisplay.DATA_LINE_WIDTH_ID, i);
}
@@ -655,7 +655,7 @@
return (Integer) this.entityData.get(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID);
}
- public void setBackgroundColor(int i) {
+ private void setBackgroundColor(int i) {
this.entityData.set(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID, i);
}
@@ -690,7 +690,7 @@
b0 = loadFlag(b0, nbttagcompound, "see_through", (byte) 2);
b0 = loadFlag(b0, nbttagcompound, "default_background", (byte) 4);
- DataResult dataresult = Display.TextDisplay.Align.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("alignment"));
+ DataResult<Pair<Display.TextDisplay.Align, net.minecraft.nbt.NBTBase>> dataresult = Display.TextDisplay.Align.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("alignment")); // CraftBukkit - decompile error
Logger logger = Display.LOGGER;
Objects.requireNonNull(logger);
@@ -961,7 +961,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.setItemStack(ItemStack.of(nbttagcompound.getCompound("item")));
if (nbttagcompound.contains("item_display", 8)) {
- DataResult dataresult = ItemDisplayContext.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("item_display"));
+ DataResult<Pair<ItemDisplayContext, net.minecraft.nbt.NBTBase>> dataresult = ItemDisplayContext.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("item_display")); // CraftBukkit - decompile error
Logger logger = Display.LOGGER;
Objects.requireNonNull(logger);

View File

@ -46,7 +46,7 @@ public class CraftTextDisplay extends CraftDisplay implements TextDisplay {
@Override @Override
public void setLineWidth(int width) { public void setLineWidth(int width) {
getHandle().setLineWidth(width); getHandle().getEntityData().set(Display.TextDisplay.DATA_LINE_WIDTH_ID, width);
} }
@Override @Override
@ -59,9 +59,9 @@ public class CraftTextDisplay extends CraftDisplay implements TextDisplay {
@Override @Override
public void setBackgroundColor(Color color) { public void setBackgroundColor(Color color) {
if (color == null) { if (color == null) {
getHandle().setBackgroundColor(-1); getHandle().getEntityData().set(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID, -1);
} else { } else {
getHandle().setBackgroundColor(color.asARGB()); getHandle().getEntityData().set(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID, color.asARGB());
} }
} }