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

Update VV usage

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-10-21 13:41:39 +10:00
Ursprung 8a9d4bd971
Commit e68ddf42b0
13 geänderte Dateien mit 28 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -89,10 +89,10 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
@Override @Override
public void register() { public void register() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID map(Type.UNSIGNED_BYTE); // 0 - Window ID
map(Type.ITEM1_8_ARRAY); // 1 - Window Values map(Type.ITEM1_8_SHORT_ARRAY); // 1 - Window Values
handler(wrapper -> { handler(wrapper -> {
Item[] stacks = wrapper.get(Type.ITEM1_8_ARRAY, 0); Item[] stacks = wrapper.get(Type.ITEM1_8_SHORT_ARRAY, 0);
for (int i = 0; i < stacks.length; i++) for (int i = 0; i < stacks.length; i++)
stacks[i] = handleItemToClient(stacks[i]); stacks[i] = handleItemToClient(stacks[i]);
@ -107,7 +107,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
stacks[getNewSlotId(storage, i)] = stacks[i]; stacks[getNewSlotId(storage, i)] = stacks[i];
stacks[i] = getNewItem(storage, i, stacks[i]); stacks[i] = getNewItem(storage, i, stacks[i]);
} }
wrapper.set(Type.ITEM1_8_ARRAY, 0, stacks); wrapper.set(Type.ITEM1_8_SHORT_ARRAY, 0, stacks);
} }
}); });
} }

Datei anzeigen

@ -81,7 +81,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<ClientboundPac
}); });
registerSetSlot(ClientboundPackets1_12.SET_SLOT, Type.ITEM1_8); registerSetSlot(ClientboundPackets1_12.SET_SLOT, Type.ITEM1_8);
registerWindowItems(ClientboundPackets1_12.WINDOW_ITEMS, Type.ITEM1_8_ARRAY); registerWindowItems(ClientboundPackets1_12.WINDOW_ITEMS, Type.ITEM1_8_SHORT_ARRAY);
registerEntityEquipment(ClientboundPackets1_12.ENTITY_EQUIPMENT, Type.ITEM1_8); registerEntityEquipment(ClientboundPackets1_12.ENTITY_EQUIPMENT, Type.ITEM1_8);
// Plugin message Packet -> Trading // Plugin message Packet -> Trading

Datei anzeigen

@ -40,7 +40,7 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<ClientboundPacket
@Override @Override
protected void registerPackets() { protected void registerPackets() {
registerSetSlot(ClientboundPackets1_9_3.SET_SLOT, Type.ITEM1_8); registerSetSlot(ClientboundPackets1_9_3.SET_SLOT, Type.ITEM1_8);
registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS, Type.ITEM1_8_ARRAY); registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS, Type.ITEM1_8_SHORT_ARRAY);
registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM1_8); registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM1_8);
// Plugin message Packet -> Trading // Plugin message Packet -> Trading

Datei anzeigen

@ -19,10 +19,10 @@
package com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data; package com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data;
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import java.util.List; import java.util.List;
public class ParticleMapping { public class ParticleMapping {
@ -36,7 +36,7 @@ public class ParticleMapping {
} }
@Override @Override
public int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data) { public int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData<?>> data) {
return rewrite((int) data.get(0).getValue()); return rewrite((int) data.get(0).getValue());
} }
@ -85,7 +85,7 @@ public class ParticleMapping {
} }
@Override @Override
public int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data) { public int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData<?>> data) {
return null; return null;
} }
}), // (11->30) minecraft:dust -> reddust }), // (11->30) minecraft:dust -> reddust
@ -112,7 +112,7 @@ public class ParticleMapping {
} }
@Override @Override
public int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data) { public int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData<?>> data) {
return rewrite(protocol, (Item) data.get(0).getValue()); return rewrite(protocol, (Item) data.get(0).getValue());
} }
@ -162,7 +162,7 @@ public class ParticleMapping {
int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception; int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception;
int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data); int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData<?>> data);
default boolean isBlockHandler() { default boolean isBlockHandler() {
return false; return false;
@ -187,7 +187,7 @@ public class ParticleMapping {
return handler.rewrite(protocol, wrapper); return handler.rewrite(protocol, wrapper);
} }
public int[] rewriteMeta(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data) { public int[] rewriteMeta(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData<?>> data) {
if (handler == null) return null; if (handler == null) return null;
return handler.rewrite(protocol, data); return handler.rewrite(protocol, data);
} }

Datei anzeigen

@ -238,9 +238,9 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
@Override @Override
public void register() { public void register() {
map(Type.UNSIGNED_BYTE); map(Type.UNSIGNED_BYTE);
map(Type.ITEM1_13_ARRAY, Type.ITEM1_8_ARRAY); map(Type.ITEM1_13_ARRAY, Type.ITEM1_8_SHORT_ARRAY);
handler(itemArrayToClientHandler(Type.ITEM1_8_ARRAY)); handler(itemArrayToClientHandler(Type.ITEM1_8_SHORT_ARRAY));
} }
}); });

Datei anzeigen

@ -26,15 +26,15 @@ import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data.PaintingMa
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data.ParticleMapping; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data.ParticleMapping;
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.BackwardsBlockStorage; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.BackwardsBlockStorage;
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.PlayerPositionStorage1_13; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.PlayerPositionStorage1_13;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_13; import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_13;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_12; import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_12;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_12; import com.viaversion.viaversion.api.type.types.version.Types1_12;
import com.viaversion.viaversion.api.type.types.version.Types1_13; import com.viaversion.viaversion.api.type.types.version.Types1_13;
import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.libs.gson.JsonElement;

Datei anzeigen

@ -27,6 +27,7 @@ import com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.storage.Difficu
import com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.storage.EntityPositionStorage1_14; import com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.storage.EntityPositionStorage1_14;
import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.Position; import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.minecraft.VillagerData; import com.viaversion.viaversion.api.minecraft.VillagerData;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
@ -36,7 +37,6 @@ import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_13_2; import com.viaversion.viaversion.api.type.types.version.Types1_13_2;
import com.viaversion.viaversion.api.type.types.version.Types1_14; import com.viaversion.viaversion.api.type.types.version.Types1_14;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;

Datei anzeigen

@ -20,13 +20,13 @@ package com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets;
import com.viaversion.viabackwards.ViaBackwards; import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter; import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1; import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_13; import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_13;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_13; import com.viaversion.viaversion.api.type.types.version.Types1_13;
import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.libs.gson.JsonElement;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;

Datei anzeigen

@ -24,6 +24,7 @@ import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.storage.WolfDat
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.entity.StoredEntityData; import com.viaversion.viaversion.api.data.entity.StoredEntityData;
import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_15; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_15;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
@ -35,7 +36,6 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_14; import com.viaversion.viaversion.api.type.types.version.Types1_14;
import com.viaversion.viaversion.api.type.types.version.Types1_16; import com.viaversion.viaversion.api.type.types.version.Types1_16;
import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.libs.gson.JsonElement;

Datei anzeigen

@ -20,13 +20,13 @@ package com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets;
import com.viaversion.viabackwards.ViaBackwards; import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.api.rewriters.EntityRewriter; import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17; import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16_2; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16_2;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.metadata.MetaType; import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_16; import com.viaversion.viaversion.api.type.types.version.Types1_16;
import com.viaversion.viaversion.api.type.types.version.Types1_17; import com.viaversion.viaversion.api.type.types.version.Types1_17;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;

Datei anzeigen

@ -19,12 +19,12 @@ package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets;
import com.viaversion.viabackwards.api.rewriters.EntityRewriter; import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18; import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17; import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17;
import com.viaversion.viaversion.api.minecraft.metadata.MetaType; import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_17; import com.viaversion.viaversion.api.type.types.version.Types1_17;
import com.viaversion.viaversion.api.type.types.version.Types1_18; import com.viaversion.viaversion.api.type.types.version.Types1_18;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
@ -99,9 +99,9 @@ public final class EntityPackets1_18 extends EntityRewriter<ClientboundPackets1_
MetaType type = meta.metaType(); MetaType type = meta.metaType();
if (type == Types1_17.META_TYPES.particleType) { if (type == Types1_17.META_TYPES.particleType) {
Particle particle = (Particle) meta.getValue(); Particle particle = meta.value();
if (particle.getId() == 3) { // Block marker if (particle.getId() == 3) { // Block marker
Particle.ParticleData data = particle.getArguments().remove(0); Particle.ParticleData<?> data = particle.getArguments().remove(0);
int blockState = (int) data.getValue(); int blockState = (int) data.getValue();
if (blockState == 7786) { // Light block if (blockState == 7786) { // Light block
particle.setId(3); particle.setId(3);

Datei anzeigen

@ -23,14 +23,14 @@ import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.Dimensi
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.StoredPainting; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.StoredPainting;
import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.data.ParticleMappings;
import com.viaversion.viaversion.api.data.entity.StoredEntityData; import com.viaversion.viaversion.api.data.entity.StoredEntityData;
import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.Position; import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19;
import com.viaversion.viaversion.api.minecraft.metadata.MetaType; import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_18; import com.viaversion.viaversion.api.type.types.version.Types1_18;
import com.viaversion.viaversion.api.type.types.version.Types1_19; import com.viaversion.viaversion.api.type.types.version.Types1_19;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;

Datei anzeigen

@ -39,7 +39,7 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<ClientboundPac
@Override @Override
protected void registerPackets() { protected void registerPackets() {
registerSetSlot(ClientboundPackets1_9_3.SET_SLOT, Type.ITEM1_8); registerSetSlot(ClientboundPackets1_9_3.SET_SLOT, Type.ITEM1_8);
registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS, Type.ITEM1_8_ARRAY); registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS, Type.ITEM1_8_SHORT_ARRAY);
// Entity Equipment Packet // Entity Equipment Packet
registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM1_8); registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM1_8);