3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01:00

Rename data, protocol and mapping classes

Syncs names with a2b7fc82e2
Dieser Commit ist enthalten in:
FlorianMichael 2024-05-12 18:56:33 +02:00 committet von Nassim Jahnke
Ursprung c27f720316
Commit 264cce865b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
49 geänderte Dateien mit 101 neuen und 159 gelöschten Zeilen

Datei anzeigen

@ -21,7 +21,7 @@ package com.viaversion.viabackwards.api.rewriters;
import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.data.MappedLegacyBlockItem;
import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.BlockColors;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.BlockColors1_11_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
@ -121,7 +121,7 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
// Special block color handling
if (name != null && name.contains("%color%")) {
for (int i = from; i <= to; i++) {
mappings.put(IdAndData.toRawData(i, -1), new MappedLegacyBlockItem(id, data, name.replace("%color%", BlockColors.get(i - from)), type));
mappings.put(IdAndData.toRawData(i, -1), new MappedLegacyBlockItem(id, data, name.replace("%color%", BlockColors1_11_1.get(i - from)), type));
}
} else {
MappedLegacyBlockItem mappedBlockItem = new MappedLegacyBlockItem(id, data, name, type);
@ -202,7 +202,7 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
// Handle colors
String value = nameTag.getValue();
if (value.contains("%vb_color%")) {
display.putString("Name", value.replace("%vb_color%", BlockColors.get(originalData)));
display.putString("Name", value.replace("%vb_color%", BlockColors1_11_1.get(originalData)));
}
}
return item;

Datei anzeigen

@ -42,8 +42,8 @@ public class Protocol1_10To1_9_3 extends BackwardsProtocol<ClientboundPackets1_9
return (short) Math.round(inputValue * 63.5F);
}
};
private final EntityPacketRewriter1_10 entityPackets = new EntityPacketRewriter1_10(this);
private final BlockItemPacketRewriter1_10 blockItemPackets = new BlockItemPacketRewriter1_10(this);
private final EntityPacketRewriter1_10 entityRewriter = new EntityPacketRewriter1_10(this);
private final BlockItemPacketRewriter1_10 itemRewriter = new BlockItemPacketRewriter1_10(this);
public Protocol1_10To1_9_3() {
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
@ -51,8 +51,8 @@ public class Protocol1_10To1_9_3 extends BackwardsProtocol<ClientboundPackets1_9
@Override
protected void registerPackets() {
entityPackets.register();
blockItemPackets.register();
entityRewriter.register();
itemRewriter.register();
SoundRewriter<ClientboundPackets1_9_3> soundRewriter = new SoundRewriter<>(this);
registerClientbound(ClientboundPackets1_9_3.CUSTOM_SOUND, new PacketHandlers() {
@ -107,12 +107,12 @@ public class Protocol1_10To1_9_3 extends BackwardsProtocol<ClientboundPackets1_9
@Override
public EntityPacketRewriter1_10 getEntityRewriter() {
return entityPackets;
return entityRewriter;
}
@Override
public BlockItemPacketRewriter1_10 getItemRewriter() {
return blockItemPackets;
return itemRewriter;
}
@Override

Datei anzeigen

@ -30,19 +30,13 @@ import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPacke
public class Protocol1_11_1To1_11 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
private final EntityPacketRewriter1_11_1 entityPackets = new EntityPacketRewriter1_11_1(this);
private final EntityPacketRewriter1_11_1 entityRewriter = new EntityPacketRewriter1_11_1(this);
private final ItemPacketRewriter1_11_1 itemRewriter = new ItemPacketRewriter1_11_1(this);
public Protocol1_11_1To1_11() {
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
}
@Override
protected void registerPackets() {
entityPackets.register();
itemRewriter.register();
}
@Override
public void init(UserConnection user) {
if (!user.has(ClientWorld.class)) {
@ -54,7 +48,7 @@ public class Protocol1_11_1To1_11 extends BackwardsProtocol<ClientboundPackets1_
@Override
public EntityPacketRewriter1_11_1 getEntityRewriter() {
return entityPackets;
return entityRewriter;
}
@Override

Datei anzeigen

@ -23,7 +23,7 @@ import com.viaversion.viabackwards.api.data.BackwardsMappingData;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.protocol.v1_11to1_10.rewriter.BlockItemPacketRewriter1_11;
import com.viaversion.viabackwards.protocol.v1_11to1_10.rewriter.EntityPacketRewriter1_11;
import com.viaversion.viabackwards.protocol.v1_11to1_10.rewriter.PlayerPacketRewriterRewriter1_11;
import com.viaversion.viabackwards.protocol.v1_11to1_10.rewriter.PlayerPacketRewriter1_11;
import com.viaversion.viabackwards.protocol.v1_11to1_10.storage.WindowTracker;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.ClientWorld;
@ -35,8 +35,8 @@ import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPacke
public class Protocol1_11To1_10 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
public static final BackwardsMappingData MAPPINGS = new BackwardsMappingData("1.11", "1.10");
private final EntityPacketRewriter1_11 entityPackets = new EntityPacketRewriter1_11(this);
private final BlockItemPacketRewriter1_11 blockItemPackets = new BlockItemPacketRewriter1_11(this);
private final EntityPacketRewriter1_11 entityRewriter = new EntityPacketRewriter1_11(this);
private final BlockItemPacketRewriter1_11 itemRewriter = new BlockItemPacketRewriter1_11(this);
public Protocol1_11To1_10() {
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
@ -44,9 +44,9 @@ public class Protocol1_11To1_10 extends BackwardsProtocol<ClientboundPackets1_9_
@Override
protected void registerPackets() {
blockItemPackets.register();
entityPackets.register();
PlayerPacketRewriterRewriter1_11.register(this);
entityRewriter.register();
itemRewriter.register();
PlayerPacketRewriter1_11.register(this);
SoundRewriter<ClientboundPackets1_9_3> soundRewriter = new SoundRewriter<>(this);
soundRewriter.registerNamedSound(ClientboundPackets1_9_3.CUSTOM_SOUND);
@ -73,12 +73,12 @@ public class Protocol1_11To1_10 extends BackwardsProtocol<ClientboundPackets1_9_
@Override
public EntityPacketRewriter1_11 getEntityRewriter() {
return entityPackets;
return entityRewriter;
}
@Override
public BlockItemPacketRewriter1_11 getItemRewriter() {
return blockItemPackets;
return itemRewriter;
}
@Override

Datei anzeigen

@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_11to1_10.data;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
public class PotionSplashHandler {
public class SplashPotions1_10 {
private static final Int2IntMap DATA = new Int2IntOpenHashMap(14, 0.99F);

Datei anzeigen

@ -18,11 +18,10 @@
package com.viaversion.viabackwards.protocol.v1_11to1_10.rewriter;
import com.viaversion.viabackwards.api.entities.storage.EntityData;
import com.viaversion.viabackwards.api.entities.storage.WrappedMetadata;
import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
import com.viaversion.viabackwards.protocol.v1_11to1_10.Protocol1_11To1_10;
import com.viaversion.viabackwards.protocol.v1_11to1_10.data.PotionSplashHandler;
import com.viaversion.viabackwards.protocol.v1_11to1_10.data.SplashPotions1_10;
import com.viaversion.viabackwards.protocol.v1_11to1_10.storage.ChestedHorseStorage;
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
@ -30,7 +29,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_9;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.version.Types1_9;
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3;
@ -58,7 +56,7 @@ public class EntityPacketRewriter1_11 extends LegacyEntityRewriter<ClientboundPa
wrapper.set(Types.INT, 0, 2002);
}
int mappedData = PotionSplashHandler.getOldData(wrapper.get(Types.INT, 1));
int mappedData = SplashPotions1_10.getOldData(wrapper.get(Types.INT, 1));
if (mappedData != -1) {
wrapper.set(Types.INT, 1, mappedData);
}

Datei anzeigen

@ -22,7 +22,6 @@ import com.viaversion.viabackwards.protocol.v1_11to1_10.Protocol1_11To1_10;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.libs.gson.JsonElement;
import com.viaversion.viaversion.libs.gson.JsonObject;
@ -30,7 +29,7 @@ import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPacke
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPackets1_9_3;
import com.viaversion.viaversion.util.ComponentUtil;
public class PlayerPacketRewriterRewriter1_11 {
public class PlayerPacketRewriter1_11 {
private static final ValueTransformer<Short, Float> TO_NEW_FLOAT = new ValueTransformer<>(Types.FLOAT) {
@Override
public Float transform(PacketWrapper wrapper, Short inputValue) {

Datei anzeigen

@ -20,9 +20,9 @@ package com.viaversion.viabackwards.protocol.v1_12to1_11_1;
import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.data.BackwardsMappingData;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.ShoulderTracker;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.storage.ShoulderTracker;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter.BlockItemPacketRewriter1_12;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter.ChatPacketRewriter1_12;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter.ComponentRewriter1_12;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter.EntityPacketRewriter1_12;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter.SoundPacketRewriter1_12;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -40,8 +40,8 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9;
public class Protocol1_12To1_11_1 extends BackwardsProtocol<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> {
private static final BackwardsMappingData MAPPINGS = new BackwardsMappingData("1.12", "1.11");
private final EntityPacketRewriter1_12 entityPackets = new EntityPacketRewriter1_12(this);
private final BlockItemPacketRewriter1_12 blockItemPackets = new BlockItemPacketRewriter1_12(this);
private final EntityPacketRewriter1_12 entityRewriter = new EntityPacketRewriter1_12(this);
private final BlockItemPacketRewriter1_12 itemRewriter = new BlockItemPacketRewriter1_12(this);
public Protocol1_12To1_11_1() {
super(ClientboundPackets1_12.class, ClientboundPackets1_9_3.class, ServerboundPackets1_12.class, ServerboundPackets1_9_3.class);
@ -49,10 +49,10 @@ public class Protocol1_12To1_11_1 extends BackwardsProtocol<ClientboundPackets1_
@Override
protected void registerPackets() {
blockItemPackets.register();
entityPackets.register();
itemRewriter.register();
entityRewriter.register();
new SoundPacketRewriter1_12(this).register();
new ChatPacketRewriter1_12(this).register();
new ComponentRewriter1_12(this).register();
registerClientbound(ClientboundPackets1_12.SET_TITLES, wrapper -> {
int action = wrapper.passthrough(Types.VAR_INT);
@ -85,12 +85,12 @@ public class Protocol1_12To1_11_1 extends BackwardsProtocol<ClientboundPackets1_
@Override
public EntityPacketRewriter1_12 getEntityRewriter() {
return entityPackets;
return entityRewriter;
}
@Override
public BlockItemPacketRewriter1_12 getItemRewriter() {
return blockItemPackets;
return itemRewriter;
}
@Override

Datei anzeigen

@ -21,7 +21,7 @@ package com.viaversion.viabackwards.protocol.v1_12to1_11_1.data;
import java.util.HashMap;
import java.util.Map;
public class AdvancementTranslations {
public class AdvancementTranslations1_11_1 {
private static final Map<String, String> advancements = new HashMap<>();
static {

Datei anzeigen

@ -18,7 +18,7 @@
package com.viaversion.viabackwards.protocol.v1_12to1_11_1.data;
public class BlockColors {
public class BlockColors1_11_1 {
private static final String[] COLORS = new String[16];
static {

Datei anzeigen

@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_12to1_11_1.data;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
public class MapColorMapping {
public class MapColors1_11_1 {
private static final Int2IntMap MAPPING = new Int2IntOpenHashMap(64, 0.99F);
static {

Datei anzeigen

@ -20,15 +20,13 @@ package com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter;
import com.viaversion.viabackwards.api.rewriters.LegacyBlockItemRewriter;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.Protocol1_12To1_11_1;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.MapColorMapping;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.MapColors1_11_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
import com.viaversion.nbt.tag.CompoundTag;
@ -76,7 +74,7 @@ public class BlockItemPacketRewriter1_12 extends LegacyBlockItemRewriter<Clientb
for (int i = 0; i < data.length; i++) {
short color = (short) (data[i] & 0xFF);
if (color > 143) {
color = (short) MapColorMapping.getNearestOldColor(color);
color = (short) MapColors1_11_1.getNearestOldColor(color);
data[i] = (byte) color;
}
}

Datei anzeigen

@ -19,17 +19,16 @@
package com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.Protocol1_12To1_11_1;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.AdvancementTranslations;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.AdvancementTranslations1_11_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.rewriter.RewriterBase;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.libs.gson.JsonElement;
import com.viaversion.viaversion.libs.gson.JsonObject;
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12;
import com.viaversion.viaversion.rewriter.ComponentRewriter;
public class ChatPacketRewriter1_12 extends RewriterBase<Protocol1_12To1_11_1> {
public class ComponentRewriter1_12 extends RewriterBase<Protocol1_12To1_11_1> {
public static final ComponentRewriter<ClientboundPackets1_12> COMPONENT_REWRITER = new ComponentRewriter<>(null, ComponentRewriter.ReadType.JSON) {
@Override
@ -51,14 +50,14 @@ public class ChatPacketRewriter1_12 extends RewriterBase<Protocol1_12To1_11_1> {
@Override
protected void handleTranslate(JsonObject object, String translate) {
String text = AdvancementTranslations.get(translate);
String text = AdvancementTranslations1_11_1.get(translate);
if (text != null) {
object.addProperty("translate", text);
}
}
};
public ChatPacketRewriter1_12(Protocol1_12To1_11_1 protocol) {
public ComponentRewriter1_12(Protocol1_12To1_11_1 protocol) {
super(protocol);
}

Datei anzeigen

@ -20,8 +20,8 @@ package com.viaversion.viabackwards.protocol.v1_12to1_11_1.rewriter;
import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.Protocol1_12To1_11_1;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.ParrotStorage;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.data.ShoulderTracker;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.storage.ParrotStorage;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.storage.ShoulderTracker;
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
@ -29,7 +29,6 @@ import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_12;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.version.Types1_12;
import com.viaversion.viaversion.libs.gson.JsonElement;

Datei anzeigen

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_12to1_11_1.data;
package com.viaversion.viabackwards.protocol.v1_12to1_11_1.storage;
public class ParrotStorage {
private boolean tamed = true;

Datei anzeigen

@ -16,14 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_12to1_11_1.data;
package com.viaversion.viabackwards.protocol.v1_12to1_11_1.storage;
import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.protocol.v1_12to1_11_1.Protocol1_12To1_11_1;
import com.viaversion.viaversion.api.connection.StoredObject;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12;
import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9;

Datei anzeigen

@ -23,7 +23,7 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.BackwardsMappingData1_13;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.PaintingMapping;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.rewriter.BlockItemPacketRewriter1_13;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.rewriter.EntityPacketRewriter1_13;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.rewriter.PlayerPacketRewriter1_13;

Datei anzeigen

@ -19,11 +19,10 @@
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers;
import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider.BackwardsBlockEntityHandler;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider.BackwardsBlockEntityHandler;
import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.nbt.tag.ListTag;
import com.viaversion.nbt.tag.NumberTag;
import com.viaversion.nbt.tag.Tag;
public class BannerHandler implements BackwardsBlockEntityHandler {
private static final int WALL_BANNER_START = 7110; // 4 each

Datei anzeigen

@ -18,7 +18,7 @@
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider;
import com.viaversion.nbt.tag.CompoundTag;
public class BedHandler implements BackwardsBlockEntityProvider.BackwardsBlockEntityHandler {

Datei anzeigen

@ -18,7 +18,7 @@
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider;
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
import com.viaversion.nbt.tag.CompoundTag;

Datei anzeigen

@ -17,7 +17,7 @@
*/
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.Protocol1_13To1_12_2;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.MappingDataLoader;
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap;

Datei anzeigen

@ -18,7 +18,7 @@
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider.BackwardsBlockEntityHandler;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider.BackwardsBlockEntityHandler;
import com.viaversion.nbt.tag.CompoundTag;
public class SkullHandler implements BackwardsBlockEntityHandler {

Datei anzeigen

@ -18,8 +18,8 @@
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.EntityNameRewrites;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.EntityNames1_12_2;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider;
import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.nbt.tag.StringTag;
@ -31,7 +31,7 @@ public class SpawnerHandler implements BackwardsBlockEntityProvider.BackwardsBlo
if (dataTag != null) {
StringTag idTag = dataTag.getStringTag("id");
if (idTag != null) {
idTag.setValue(EntityNameRewrites.rewrite(idTag.getValue()));
idTag.setValue(EntityNames1_12_2.rewrite(idTag.getValue()));
}
}
return tag;

Datei anzeigen

@ -21,8 +21,9 @@ package com.viaversion.viabackwards.protocol.v1_13to1_12_2.data;
import com.viaversion.viaversion.util.Key;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class EntityNameRewrites {
public class EntityNames1_12_2 {
private static final Map<String, String> ENTITY_NAMES = new HashMap<>();
static {
@ -48,9 +49,6 @@ public class EntityNameRewrites {
public static String rewrite(String entName) {
String entityName = ENTITY_NAMES.get(Key.namespaced(entName));
if (entityName != null) {
return entityName;
} else
return entName;
return Objects.requireNonNullElse(entityName, entName);
}
}

Datei anzeigen

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers;
package com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers.BannerHandler;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers.BedHandler;

Datei anzeigen

@ -24,7 +24,7 @@ import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter;
import com.viaversion.viabackwards.api.rewriters.EnchantmentRewriter;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.Protocol1_13To1_12_2;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers.FlowerPotHandler;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.providers.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.storage.BackwardsBlockStorage;
import com.viaversion.viabackwards.protocol.v1_13to1_12_2.storage.NoteBlockStorage;
import com.viaversion.viaversion.api.Via;
@ -39,7 +39,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_13;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;

Datei anzeigen

@ -23,7 +23,7 @@ import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.data.CommandRewriter1_14;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.BlockItemPacketRewriter1_14;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.EntityPacketRewriter1_14;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.PlayerPacketRewriterRewriter1_14;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.PlayerPacketRewriter1_14;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.SoundPacketRewriter1_14;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.storage.ChunkLightStorage;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.storage.DifficultyStorage;
@ -44,7 +44,7 @@ public class Protocol1_14To1_13_2 extends BackwardsProtocol<ClientboundPackets1_
public static final BackwardsMappingData MAPPINGS = new BackwardsMappingData("1.14", "1.13.2", Protocol1_13_2To1_14.class);
private final EntityPacketRewriter1_14 entityRewriter = new EntityPacketRewriter1_14(this);
private final BlockItemPacketRewriter1_14 blockItemPackets = new BlockItemPacketRewriter1_14(this);
private final BlockItemPacketRewriter1_14 itemRewriter = new BlockItemPacketRewriter1_14(this);
private final TranslatableRewriter<ClientboundPackets1_14> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
public Protocol1_14To1_13_2() {
@ -64,7 +64,7 @@ public class Protocol1_14To1_13_2 extends BackwardsProtocol<ClientboundPackets1_
translatableRewriter.registerPing();
new CommandRewriter1_14(this).registerDeclareCommands(ClientboundPackets1_14.COMMANDS);
new PlayerPacketRewriterRewriter1_14(this).register();
new PlayerPacketRewriter1_14(this).register();
new SoundPacketRewriter1_14(this).register();
new StatisticsRewriter<>(this).register(ClientboundPackets1_14.AWARD_STATS);
@ -187,7 +187,7 @@ public class Protocol1_14To1_13_2 extends BackwardsProtocol<ClientboundPackets1_
@Override
public BlockItemPacketRewriter1_14 getItemRewriter() {
return blockItemPackets;
return itemRewriter;
}
@Override

Datei anzeigen

@ -22,14 +22,13 @@ import com.viaversion.viabackwards.protocol.v1_14to1_13_2.storage.DifficultyStor
import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.rewriter.RewriterBase;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13;
import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ClientboundPackets1_14;
public class PlayerPacketRewriterRewriter1_14 extends RewriterBase<Protocol1_14To1_13_2> {
public class PlayerPacketRewriter1_14 extends RewriterBase<Protocol1_14To1_13_2> {
public PlayerPacketRewriterRewriter1_14(Protocol1_14To1_13_2 protocol) {
public PlayerPacketRewriter1_14(Protocol1_14To1_13_2 protocol) {
super(protocol);
}

Datei anzeigen

@ -21,7 +21,7 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.data.BackwardsMappingData;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.data.ImmediateRespawn;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.storage.ImmediateRespawnStorage;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.rewriter.BlockItemPacketRewriter1_15;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.rewriter.EntityPacketRewriter1_15;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -102,7 +102,7 @@ public class Protocol1_15To1_14_4 extends BackwardsProtocol<ClientboundPackets1_
@Override
public void init(UserConnection user) {
user.put(new ImmediateRespawn());
user.put(new ImmediateRespawnStorage());
user.addEntityTracker(getClass(), new EntityTrackerBase(user, EntityTypes1_15.PLAYER));
}

Datei anzeigen

@ -1,29 +0,0 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_15to1_14_4.data;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_14;
public class EntityTypeMapping {
// There's only the bee, so not much to do here
public static int getOldEntityId(int entityId) {
if (entityId == 4) return EntityTypes1_14.PUFFERFISH.getId(); // Flying pufferfish!
return entityId >= 5 ? entityId - 1 : entityId;
}
}

Datei anzeigen

@ -19,14 +19,13 @@ package com.viaversion.viabackwards.protocol.v1_15to1_14_4.rewriter;
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.Protocol1_15To1_14_4;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.data.EntityTypeMapping;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.data.ImmediateRespawn;
import com.viaversion.viabackwards.protocol.v1_15to1_14_4.storage.ImmediateRespawnStorage;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_14;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_15;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.version.Types1_14;
import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ServerboundPackets1_14;
@ -44,7 +43,7 @@ public class EntityPacketRewriter1_15 extends EntityRewriter<ClientboundPackets1
protocol.registerClientbound(ClientboundPackets1_15.SET_HEALTH, wrapper -> {
float health = wrapper.passthrough(Types.FLOAT);
if (health > 0) return;
if (!wrapper.user().get(ImmediateRespawn.class).isImmediateRespawn()) return;
if (!wrapper.user().get(ImmediateRespawnStorage.class).isImmediateRespawn()) return;
// Instantly request respawn when 1.15 gamerule is set
PacketWrapper statusPacket = wrapper.create(ServerboundPackets1_14.CLIENT_COMMAND);
@ -59,7 +58,7 @@ public class EntityPacketRewriter1_15 extends EntityRewriter<ClientboundPackets1
map(Types.FLOAT);
handler(wrapper -> {
if (wrapper.get(Types.UNSIGNED_BYTE, 0) == 11) {
wrapper.user().get(ImmediateRespawn.class).setImmediateRespawn(wrapper.get(Types.FLOAT, 0) == 1);
wrapper.user().get(ImmediateRespawnStorage.class).setImmediateRespawn(wrapper.get(Types.FLOAT, 0) == 1);
}
});
}
@ -88,7 +87,7 @@ public class EntityPacketRewriter1_15 extends EntityRewriter<ClientboundPackets1
int type = wrapper.get(Types.VAR_INT, 1);
EntityType entityType = EntityTypes1_15.getTypeFromId(type);
tracker(wrapper.user()).addEntity(wrapper.get(Types.VAR_INT, 0), entityType);
wrapper.set(Types.VAR_INT, 1, EntityTypeMapping.getOldEntityId(type));
wrapper.set(Types.VAR_INT, 1, newEntityId(type));
});
}
});
@ -119,7 +118,7 @@ public class EntityPacketRewriter1_15 extends EntityRewriter<ClientboundPackets1
handler(wrapper -> {
boolean immediateRespawn = !wrapper.read(Types.BOOLEAN); // Inverted
wrapper.user().get(ImmediateRespawn.class).setImmediateRespawn(immediateRespawn);
wrapper.user().get(ImmediateRespawnStorage.class).setImmediateRespawn(immediateRespawn);
});
}
});
@ -223,6 +222,7 @@ public class EntityPacketRewriter1_15 extends EntityRewriter<ClientboundPackets1
@Override
public int newEntityId(final int newId) {
return EntityTypeMapping.getOldEntityId(newId);
if (newId == 4) return EntityTypes1_14.PUFFERFISH.getId(); // Flying pufferfish!
return newId >= 5 ? newId - 1 : newId;
}
}

Datei anzeigen

@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_15to1_14_4.data;
package com.viaversion.viabackwards.protocol.v1_15to1_14_4.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
public class ImmediateRespawn implements StorableObject {
public class ImmediateRespawnStorage implements StorableObject {
private boolean immediateRespawn;
public boolean isImmediateRespawn() {

Datei anzeigen

@ -19,10 +19,10 @@ package com.viaversion.viabackwards.protocol.v1_16to1_15_2;
import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.chat.TranslatableRewriter1_16;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.rewriter.TranslatableRewriter1_16;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.data.BackwardsMappingData1_16;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.data.CommandRewriter1_16;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.data.WorldNameTracker;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.rewriter.CommandRewriter1_16;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.storage.WorldNameTracker;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.rewriter.BlockItemPacketRewriter1_16;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.rewriter.EntityPacketRewriter1_16;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.storage.PlayerSneakStorage;
@ -32,7 +32,6 @@ import com.viaversion.viaversion.api.minecraft.RegistryType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.libs.gson.JsonElement;

Datei anzeigen

@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_16to1_15_2.data;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
public final class MapColorRewrites {
public final class MapColorMappings1_15_2 {
private static final Int2IntMap MAPPINGS = new Int2IntOpenHashMap();

Datei anzeigen

@ -22,7 +22,7 @@ import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter;
import com.viaversion.viabackwards.api.rewriters.EnchantmentRewriter;
import com.viaversion.viabackwards.api.rewriters.MapColorRewriter;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.Protocol1_16To1_15_2;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.data.MapColorRewrites;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.data.MapColorMappings1_15_2;
import com.viaversion.viabackwards.protocol.v1_16_2to1_16_1.storage.BiomeStorage;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_15;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16;
@ -231,7 +230,7 @@ public class BlockItemPacketRewriter1_16 extends BackwardsItemRewriter<Clientbou
map(Types.BYTE); // Scale
map(Types.BOOLEAN); // Tracking Position
map(Types.BOOLEAN); // Locked
handler(MapColorRewriter.getRewriteHandler(MapColorRewrites::getMappedColor));
handler(MapColorRewriter.getRewriteHandler(MapColorMappings1_15_2::getMappedColor));
}
});

Datei anzeigen

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_16to1_15_2.data;
package com.viaversion.viabackwards.protocol.v1_16to1_15_2.rewriter;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.Protocol1_16To1_15_2;
import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ClientboundPackets1_16;

Datei anzeigen

@ -19,7 +19,7 @@ package com.viaversion.viabackwards.protocol.v1_16to1_15_2.rewriter;
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.Protocol1_16To1_15_2;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.data.WorldNameTracker;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.storage.WorldNameTracker;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.storage.WolfDataMaskStorage;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
@ -34,7 +34,6 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.version.Types1_14;
import com.viaversion.viaversion.api.type.types.version.Types1_16;

Datei anzeigen

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_16to1_15_2.chat;
package com.viaversion.viabackwards.protocol.v1_16to1_15_2.rewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.v1_16to1_15_2.Protocol1_16To1_15_2;

Datei anzeigen

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_16to1_15_2.data;
package com.viaversion.viabackwards.protocol.v1_16to1_15_2.storage;
import com.viaversion.viaversion.api.connection.StorableObject;

Datei anzeigen

@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_17to1_16_4.data;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
public final class MapColorRewrites {
public final class MapColorMappings1_16_4 {
private static final Int2IntMap MAPPINGS = new Int2IntOpenHashMap();

Datei anzeigen

@ -21,7 +21,7 @@ import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter;
import com.viaversion.viabackwards.api.rewriters.MapColorRewriter;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.Protocol1_17To1_16_4;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.data.MapColorRewrites;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.data.MapColorMappings1_16_4;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PingRequests;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PlayerLastCursorItem;
import com.viaversion.viaversion.api.data.entity.EntityTracker;
@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16_2;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_17;
@ -402,7 +401,7 @@ public final class BlockItemPacketRewriter1_17 extends BackwardsItemRewriter<Cli
if (!hasMarkers) {
wrapper.write(Types.VAR_INT, 0); // Array size
} else {
MapColorRewriter.getRewriteHandler(MapColorRewrites::getMappedColor).handle(wrapper);
MapColorRewriter.getRewriteHandler(MapColorMappings1_16_4::getMappedColor).handle(wrapper);
}
});
}

Datei anzeigen

@ -19,11 +19,10 @@ package com.viaversion.viabackwards.protocol.v1_18_2to1_18;
import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.protocol.v1_18_2to1_18.data.CommandRewriter1_18_2;
import com.viaversion.viabackwards.protocol.v1_18_2to1_18.rewriter.CommandRewriter1_18_2;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_16_4to1_17.packet.ServerboundPackets1_17;
import com.viaversion.nbt.tag.CompoundTag;

Datei anzeigen

@ -15,10 +15,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_18_2to1_18.data;
package com.viaversion.viabackwards.protocol.v1_18_2to1_18.rewriter;
import com.viaversion.viabackwards.protocol.v1_18_2to1_18.Protocol1_18_2To1_18;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_17_1to1_18.packet.ClientboundPackets1_18;
import com.viaversion.viaversion.rewriter.CommandRewriter;

Datei anzeigen

@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_18to1_17_1.data;
import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntityIds1_18;
import java.util.Arrays;
public final class BlockEntityIds {
public final class BlockEntityIds1_17_1 {
private static final int[] IDS;

Datei anzeigen

@ -19,7 +19,7 @@ package com.viaversion.viabackwards.protocol.v1_18to1_17_1.rewriter;
import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter;
import com.viaversion.viabackwards.protocol.v1_18to1_17_1.Protocol1_18To1_17_1;
import com.viaversion.viabackwards.protocol.v1_18to1_17_1.data.BlockEntityIds;
import com.viaversion.viabackwards.protocol.v1_18to1_17_1.data.BlockEntityIds1_17_1;
import com.viaversion.viaversion.api.data.ParticleMappings;
import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.Position;
@ -31,7 +31,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_17;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_18;
@ -132,7 +131,7 @@ public final class BlockItemPacketRewriter1_18 extends BackwardsItemRewriter<Cli
final int id = wrapper.read(Types.VAR_INT);
final CompoundTag tag = wrapper.read(Types.NAMED_COMPOUND_TAG);
final int mappedId = BlockEntityIds.mappedId(id);
final int mappedId = BlockEntityIds1_17_1.mappedId(id);
if (mappedId == -1) {
wrapper.cancel();
return;

Datei anzeigen

@ -23,7 +23,7 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.v1_19to1_18_2.data.BackwardsMappingData1_19;
import com.viaversion.viabackwards.protocol.v1_19to1_18_2.data.CommandRewriter1_19;
import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.CommandRewriter1_19;
import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.BlockItemPacketRewriter1_19;
import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.EntityPacketRewriter1_19;
import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.DimensionRegistryStorage;
@ -39,7 +39,6 @@ import com.viaversion.viaversion.api.minecraft.signature.model.MessageMetadata;
import com.viaversion.viaversion.api.minecraft.signature.storage.ChatSession1_19_0;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.libs.gson.JsonElement;

Datei anzeigen

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_19to1_18_2.data;
package com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter;
import com.viaversion.viabackwards.protocol.v1_19to1_18_2.Protocol1_19To1_18_2;
import com.viaversion.viaversion.api.type.Types;

Datei anzeigen

@ -17,14 +17,13 @@
*/
package com.viaversion.viabackwards.protocol.v1_9_3to1_9_1;
import com.viaversion.viabackwards.protocol.v1_9_3to1_9_1.chunks.BlockEntity;
import com.viaversion.viabackwards.protocol.v1_9_3to1_9_1.data.BlockEntity1_9_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_1;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
@ -77,7 +76,7 @@ public class Protocol1_9_3To1_9_1 extends AbstractProtocol<ClientboundPackets1_9
Chunk chunk = wrapper.read(newType);
wrapper.write(oldType, chunk);
BlockEntity.handle(chunk.getBlockEntities(), wrapper.user());
BlockEntity1_9_1.handle(chunk.getBlockEntities(), wrapper.user());
});
registerClientbound(ClientboundPackets1_9_3.LOGIN, new PacketHandlers() {

Datei anzeigen

@ -15,12 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.v1_9_3to1_9_1.chunks;
package com.viaversion.viabackwards.protocol.v1_9_3to1_9_1.data;
import com.viaversion.viabackwards.protocol.v1_9_3to1_9_1.Protocol1_9_3To1_9_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3;
import com.viaversion.nbt.tag.CompoundTag;
@ -29,7 +28,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BlockEntity {
public class BlockEntity1_9_1 {
private static final Map<String, Integer> TYPES = new HashMap<>();
static {