mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-25 12:45:35 +01:00
parent
a200975cda
commit
249280312e
@ -20,6 +20,10 @@ package com.viaversion.viabackwards.api.rewriters;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.data.MappedItem;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ByteTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||
@ -30,11 +34,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewriterBase<T> {
|
||||
|
||||
private final TranslatableRewriter translatableRewriter;
|
||||
|
||||
protected ItemRewriter(T protocol, @Nullable TranslatableRewriter translatableRewriter) {
|
||||
protected ItemRewriter(T protocol) {
|
||||
super(protocol, true);
|
||||
this.translatableRewriter = translatableRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,11 +43,11 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
||||
if (item == null) return null;
|
||||
|
||||
CompoundTag display = item.tag() != null ? item.tag().get("display") : null;
|
||||
if (translatableRewriter != null && display != null) {
|
||||
if (protocol.getTranslatableRewriter() != null && display != null) {
|
||||
// Handle name and lore components
|
||||
StringTag name = display.get("Name");
|
||||
if (name != null) {
|
||||
String newValue = translatableRewriter.processText(name.getValue()).toString();
|
||||
String newValue = protocol.getTranslatableRewriter().processText(name.getValue()).toString();
|
||||
if (!newValue.equals(name.getValue())) {
|
||||
saveStringTag(display, name, "Name");
|
||||
}
|
||||
@ -61,7 +62,7 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
||||
if (!(loreEntryTag instanceof StringTag)) continue;
|
||||
|
||||
StringTag loreEntry = (StringTag) loreEntryTag;
|
||||
String newValue = translatableRewriter.processText(loreEntry.getValue()).toString();
|
||||
String newValue = protocol.getTranslatableRewriter().processText(loreEntry.getValue()).toString();
|
||||
if (!changed && !newValue.equals(loreEntry.getValue())) {
|
||||
// Backup original lore before doing any modifications
|
||||
changed = true;
|
||||
@ -111,4 +112,52 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAdvancements(ClientboundPacketType packetType, Type<Item> type) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
|
||||
final int size = wrapper.passthrough(Type.VAR_INT); // Mapping size
|
||||
for (int i = 0; i < size; i++) {
|
||||
wrapper.passthrough(Type.STRING); // Identifier
|
||||
|
||||
// Parent
|
||||
if (wrapper.passthrough(Type.BOOLEAN)) {
|
||||
wrapper.passthrough(Type.STRING);
|
||||
}
|
||||
|
||||
// Display data
|
||||
if (wrapper.passthrough(Type.BOOLEAN)) {
|
||||
final JsonElement title = wrapper.passthrough(Type.COMPONENT);
|
||||
final JsonElement description = wrapper.passthrough(Type.COMPONENT);
|
||||
final TranslatableRewriter translatableRewriter = protocol.getTranslatableRewriter();
|
||||
if (translatableRewriter != null) {
|
||||
translatableRewriter.processText(title);
|
||||
translatableRewriter.processText(description);
|
||||
}
|
||||
|
||||
handleItemToClient(wrapper.passthrough(type)); // Icon
|
||||
wrapper.passthrough(Type.VAR_INT); // Frame type
|
||||
int flags = wrapper.passthrough(Type.INT); // Flags
|
||||
if ((flags & 1) != 0) {
|
||||
wrapper.passthrough(Type.STRING); // Background texture
|
||||
}
|
||||
wrapper.passthrough(Type.FLOAT); // X
|
||||
wrapper.passthrough(Type.FLOAT); // Y
|
||||
}
|
||||
|
||||
wrapper.passthrough(Type.STRING_ARRAY); // Criteria
|
||||
|
||||
final int arrayLength = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int array = 0; array < arrayLength; array++) {
|
||||
wrapper.passthrough(Type.STRING_ARRAY); // String array
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
|
||||
private final String extraNbtTag;
|
||||
|
||||
public BlockItemPackets1_13(Protocol1_12_2To1_13 protocol) {
|
||||
super(protocol, null);
|
||||
super(protocol);
|
||||
extraNbtTag = "VB|" + protocol.getClass().getSimpleName() + "|2";
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.14", "1.13.2", Protocol1_14To1_13_2.class, true);
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_14(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private BlockItemPackets1_14 blockItemPackets;
|
||||
|
||||
public Protocol1_13_2To1_14() {
|
||||
@ -56,7 +57,6 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_14To1_13_2.class, MAPPINGS::load);
|
||||
|
||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_14.BOSSBAR);
|
||||
translatableRewriter.registerChatMessage(ClientboundPackets1_14.CHAT_MESSAGE);
|
||||
translatableRewriter.registerCombatEvent(ClientboundPackets1_14.COMBAT_EVENT);
|
||||
@ -67,7 +67,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
new CommandRewriter1_14(this).registerDeclareCommands(ClientboundPackets1_14.DECLARE_COMMANDS);
|
||||
|
||||
blockItemPackets = new BlockItemPackets1_14(this, translatableRewriter);
|
||||
blockItemPackets = new BlockItemPackets1_14(this);
|
||||
blockItemPackets.register();
|
||||
entityRewriter.register();
|
||||
new PlayerPackets1_14(this).register();
|
||||
@ -211,4 +211,9 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BlockItemPackets1_14 getItemRewriter() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ package com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.packets;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.viaversion.viabackwards.ViaBackwards;
|
||||
import com.viaversion.viabackwards.api.rewriters.EnchantmentRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.storage.ChunkLightStorage;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
@ -65,8 +64,8 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit
|
||||
|
||||
private EnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
public BlockItemPackets1_14(Protocol1_13_2To1_14 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter);
|
||||
public BlockItemPackets1_14(Protocol1_13_2To1_14 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,6 +43,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.15", "1.14", Protocol1_15To1_14_4.class, true);
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_15(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private BlockItemPackets1_15 blockItemPackets;
|
||||
|
||||
public Protocol1_14_4To1_15() {
|
||||
@ -53,7 +54,6 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_15To1_14_4.class, MAPPINGS::load);
|
||||
|
||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_15.BOSSBAR);
|
||||
translatableRewriter.registerChatMessage(ClientboundPackets1_15.CHAT_MESSAGE);
|
||||
translatableRewriter.registerCombatEvent(ClientboundPackets1_15.COMBAT_EVENT);
|
||||
@ -63,7 +63,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
translatableRewriter.registerTitle(ClientboundPackets1_15.TITLE);
|
||||
translatableRewriter.registerPing();
|
||||
|
||||
(blockItemPackets = new BlockItemPackets1_15(this, translatableRewriter)).register();
|
||||
(blockItemPackets = new BlockItemPackets1_15(this)).register();
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
@ -122,4 +122,9 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BlockItemPackets1_15 getItemRewriter() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.packets;
|
||||
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.Protocol1_14_4To1_15;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||
@ -35,8 +34,8 @@ import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
|
||||
public class BlockItemPackets1_15 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<Protocol1_14_4To1_15> {
|
||||
|
||||
public BlockItemPackets1_15(Protocol1_14_4To1_15 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter);
|
||||
public BlockItemPackets1_15(Protocol1_14_4To1_15 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,8 +53,8 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_16(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter1_16(this);
|
||||
private BlockItemPackets1_16 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
public Protocol1_15_2To1_16() {
|
||||
super(ClientboundPackets1_16.class, ClientboundPackets1_15.class, ServerboundPackets1_16.class, ServerboundPackets1_14.class);
|
||||
@ -64,7 +64,6 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, MAPPINGS::load);
|
||||
|
||||
translatableRewriter = new TranslatableRewriter1_16(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_16.BOSSBAR);
|
||||
translatableRewriter.registerCombatEvent(ClientboundPackets1_16.COMBAT_EVENT);
|
||||
translatableRewriter.registerDisconnect(ClientboundPackets1_16.DISCONNECT);
|
||||
@ -74,7 +73,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
new CommandRewriter1_16(this).registerDeclareCommands(ClientboundPackets1_16.DECLARE_COMMANDS);
|
||||
|
||||
(blockItemPackets = new BlockItemPackets1_16(this, translatableRewriter)).register();
|
||||
(blockItemPackets = new BlockItemPackets1_16(this)).register();
|
||||
entityRewriter.register();
|
||||
|
||||
registerClientbound(State.STATUS, 0x00, 0x00, new PacketRemapper() {
|
||||
|
@ -19,7 +19,6 @@ package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.packets;
|
||||
|
||||
import com.viaversion.viabackwards.api.rewriters.EnchantmentRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.MapColorRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.MapColorRewrites;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
@ -54,8 +53,8 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit
|
||||
|
||||
private EnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
public BlockItemPackets1_16(Protocol1_15_2To1_16 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter);
|
||||
public BlockItemPackets1_16(Protocol1_15_2To1_16 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,8 +46,8 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.16.2", "1.16", Protocol1_16_2To1_16_1.class, true);
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_16_2(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private BlockItemPackets1_16_2 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
public Protocol1_16_1To1_16_2() {
|
||||
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16.class);
|
||||
@ -57,7 +57,6 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_16_2To1_16_1.class, MAPPINGS::load);
|
||||
|
||||
translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_16_2.BOSSBAR);
|
||||
translatableRewriter.registerCombatEvent(ClientboundPackets1_16_2.COMBAT_EVENT);
|
||||
translatableRewriter.registerDisconnect(ClientboundPackets1_16_2.DISCONNECT);
|
||||
@ -68,7 +67,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
|
||||
new CommandRewriter1_16_2(this).registerDeclareCommands(ClientboundPackets1_16_2.DECLARE_COMMANDS);
|
||||
|
||||
(blockItemPackets = new BlockItemPackets1_16_2(this, translatableRewriter)).register();
|
||||
(blockItemPackets = new BlockItemPackets1_16_2(this)).register();
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
@ -140,6 +139,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
user.addEntityTracker(this.getClass(), new EntityTrackerBase(user, Entity1_16_2Types.PLAYER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.packets;
|
||||
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8;
|
||||
@ -39,8 +38,8 @@ import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
|
||||
public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<Protocol1_16_1To1_16_2> {
|
||||
|
||||
public BlockItemPackets1_16_2(Protocol1_16_1To1_16_2 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter);
|
||||
public BlockItemPackets1_16_2(Protocol1_16_1To1_16_2 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,8 +56,8 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.17", "1.16.2", Protocol1_17To1_16_4.class, true);
|
||||
private static final int[] EMPTY_ARRAY = {};
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_17(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private BlockItemPackets1_17 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
public Protocol1_16_4To1_17() {
|
||||
super(ClientboundPackets1_17.class, ClientboundPackets1_16_2.class, ServerboundPackets1_17.class, ServerboundPackets1_16_2.class);
|
||||
@ -67,7 +67,6 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_17To1_16_4.class, MAPPINGS::load);
|
||||
|
||||
translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerChatMessage(ClientboundPackets1_17.CHAT_MESSAGE);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_17.BOSSBAR);
|
||||
translatableRewriter.registerDisconnect(ClientboundPackets1_17.DISCONNECT);
|
||||
@ -75,7 +74,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
translatableRewriter.registerOpenWindow(ClientboundPackets1_17.OPEN_WINDOW);
|
||||
translatableRewriter.registerPing();
|
||||
|
||||
blockItemPackets = new BlockItemPackets1_17(this, translatableRewriter);
|
||||
blockItemPackets = new BlockItemPackets1_17(this);
|
||||
blockItemPackets.register();
|
||||
|
||||
entityRewriter.register();
|
||||
|
@ -20,7 +20,6 @@ package com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets;
|
||||
import com.viaversion.viabackwards.ViaBackwards;
|
||||
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.MapColorRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.data.MapColorRewrites;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests;
|
||||
@ -47,8 +46,8 @@ import java.util.List;
|
||||
|
||||
public final class BlockItemPackets1_17 extends ItemRewriter<Protocol1_16_4To1_17> {
|
||||
|
||||
public BlockItemPackets1_17(Protocol1_16_4To1_17 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter);
|
||||
public BlockItemPackets1_17(Protocol1_16_4To1_17 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,6 +39,8 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPacke
|
||||
|
||||
public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
||||
|
||||
private boolean warned;
|
||||
|
||||
public EntityPackets1_17(Protocol1_16_4To1_17 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
@ -215,9 +217,10 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
IntTag height = tag.get("height");
|
||||
IntTag logicalHeight = tag.get("logical_height");
|
||||
if (minY.asInt() != 0 || height.asInt() > 256 || logicalHeight.asInt() > 256) {
|
||||
if (warn) {
|
||||
if (warn && !warned) {
|
||||
ViaBackwards.getPlatform().getLogger().severe("Custom worlds heights are NOT SUPPORTED for 1.16 players and older and may lead to errors!");
|
||||
ViaBackwards.getPlatform().getLogger().severe("You have min/max set to " + minY.asInt() + "/" + height.asInt());
|
||||
warned = true;
|
||||
}
|
||||
|
||||
height.setValue(Math.min(256, height.asInt()));
|
||||
|
@ -39,7 +39,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
|
||||
private static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this);
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private BlockItemPackets1_18 itemRewriter;
|
||||
|
||||
public Protocol1_17_1To1_18() {
|
||||
@ -50,7 +50,6 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_18To1_17_1.class, MAPPINGS::load);
|
||||
|
||||
translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_18.CHAT_MESSAGE);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_18.ACTIONBAR);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_18.TITLE_TEXT);
|
||||
@ -62,7 +61,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
translatableRewriter.registerCombatKill(ClientboundPackets1_18.COMBAT_KILL);
|
||||
translatableRewriter.registerPing();
|
||||
|
||||
itemRewriter = new BlockItemPackets1_18(this, translatableRewriter);
|
||||
itemRewriter = new BlockItemPackets1_18(this);
|
||||
entityRewriter.register();
|
||||
itemRewriter.register();
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets;
|
||||
|
||||
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data.BlockEntityIds;
|
||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||
@ -49,8 +48,8 @@ import java.util.List;
|
||||
|
||||
public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_18> {
|
||||
|
||||
public BlockItemPackets1_18(final Protocol1_17_1To1_18 protocol, final TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter);
|
||||
public BlockItemPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user