Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 16:12:43 +01:00
fix rewrite
Dieser Commit ist enthalten in:
Ursprung
53b4151a26
Commit
55b4f6c080
@ -10,6 +10,7 @@
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13;
|
||||
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.BackwardsMappings;
|
||||
@ -29,7 +30,11 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
@Getter
|
||||
public class Protocol1_12_2To1_13 extends BackwardsProtocol {
|
||||
|
||||
private BlockItemPackets1_13 blockItemPackets;
|
||||
|
||||
static {
|
||||
BackwardsMappings.init();
|
||||
PaintingMapping.init();
|
||||
@ -38,7 +43,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
new BlockItemPackets1_13().register(this);
|
||||
(blockItemPackets = new BlockItemPackets1_13()).register(this);
|
||||
new EntityPackets1_13().register(this);
|
||||
new PlayerPacket1_13().register(this);
|
||||
new SoundPackets1_13().register(this);
|
||||
|
@ -32,7 +32,6 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.BlockIdData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
@ -56,39 +55,6 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
||||
return 1 << 4;
|
||||
}
|
||||
|
||||
//Basic translation for now. TODO remap new items; should probably use BlockItemRewriter#handleItemToClient/Server, but that needs some rewriting
|
||||
public static void toClient(Item item) {
|
||||
if(item != null && item.getTag() != null){
|
||||
CompoundTag tag = item.getTag();
|
||||
if (tag.get("display") instanceof CompoundTag) {
|
||||
CompoundTag display = (CompoundTag)tag.get("display");
|
||||
if (((CompoundTag)tag.get("display")).get("Name") instanceof StringTag) {
|
||||
StringTag name = (StringTag)display.get("Name");
|
||||
System.out.println("Item Name: " + name.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
try{
|
||||
InventoryPackets.toServer(item);
|
||||
}catch (Exception ex){
|
||||
if(item != null && item.getTag() != null){
|
||||
CompoundTag tag = item.getTag();
|
||||
if (tag.get("display") instanceof CompoundTag) {
|
||||
CompoundTag display = (CompoundTag)tag.get("display");
|
||||
if (((CompoundTag)tag.get("display")).get("Name") instanceof StringTag) {
|
||||
StringTag name = (StringTag)display.get("Name");
|
||||
System.out.println("Ex Item Name: " + name.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void toServer(Item item) {
|
||||
InventoryPackets.toClient(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets(Protocol1_12_2To1_13 protocol) {
|
||||
NBT_TAG_NAME = "ViaVersion|" + protocol.getClass().getSimpleName();
|
||||
@ -439,13 +405,13 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
||||
// rewrite(453).repItem(new Item((short) 174, (byte) 1, (short) -1, getNamedTag("1.12 Blue Ice")));
|
||||
|
||||
//Corals
|
||||
rewrite(561).repItem(new Item((short) 100, (byte) 1, (short) -1, getNamedTag("1.12 Tube Coral")));
|
||||
rewrite(438).repItem(new Item((short) 100, (byte) 1, (short) -1, getNamedTag("1.12 Tube Coral")));
|
||||
rewrite(439).repItem(new Item((short) 106, (byte) 1, (short) -1, getNamedTag("1.12 Brain Coral")));
|
||||
rewrite(563).repItem(new Item((short) 101, (byte) 1, (short) -1, getNamedTag("1.12 Bubble Coral")));
|
||||
rewrite(564).repItem(new Item((short) 103, (byte) 1, (short) -1, getNamedTag("1.12 Fire Coral")));
|
||||
rewrite(564).repItem(new Item((short) 98, (byte) 1, (short) -1, getNamedTag("1.12 Horn Coral")));
|
||||
rewrite(440).repItem(new Item((short) 101, (byte) 1, (short) -1, getNamedTag("1.12 Bubble Coral")));
|
||||
rewrite(441).repItem(new Item((short) 103, (byte) 1, (short) -1, getNamedTag("1.12 Fire Coral")));
|
||||
rewrite(442).repItem(new Item((short) 98, (byte) 1, (short) -1, getNamedTag("1.12 Horn Coral")));
|
||||
|
||||
rewrite(550).repItem(new Item((short) 561, (byte) 1, (short) -1, getNamedTag("1.12 Turtle Egg")));
|
||||
rewrite(427).repItem(new Item((short) 561, (byte) 1, (short) -1, getNamedTag("1.12 Turtle Egg")));
|
||||
|
||||
rewrite(781).repItem(new Item((short) 488, (byte) 1, (short) -1, getNamedTag("1.12 Trident")));
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
|
||||
// Rewrite items
|
||||
else if (typeId == 6) {
|
||||
meta.setMetaType(MetaType1_12.Slot);
|
||||
BlockItemPackets1_13.toClient((Item) meta.getValue());
|
||||
getProtocol().getBlockItemPackets().handleItemToClient((Item) meta.getValue());
|
||||
}
|
||||
|
||||
// Discontinue particles
|
||||
|
@ -34,18 +34,18 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
||||
for (int i = 0; i < size; i++) {
|
||||
//Input Item
|
||||
Item input = wrapper.read(Type.FLAT_ITEM);
|
||||
BlockItemPackets1_13.toClient(input);
|
||||
getProtocol().getBlockItemPackets().handleItemToClient(input);
|
||||
wrapper.write(Type.ITEM, input);
|
||||
//Output Item
|
||||
Item output = wrapper.read(Type.FLAT_ITEM);
|
||||
BlockItemPackets1_13.toClient(output);
|
||||
getProtocol().getBlockItemPackets().handleItemToClient(output);
|
||||
wrapper.write(Type.ITEM, output);
|
||||
|
||||
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); //Has second item
|
||||
if (secondItem) {
|
||||
//Second Item
|
||||
Item second = wrapper.read(Type.FLAT_ITEM);
|
||||
BlockItemPackets1_13.toClient(second);
|
||||
getProtocol().getBlockItemPackets().handleItemToClient(second);
|
||||
wrapper.write(Type.ITEM, second);
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
||||
if (channel.equals("MC|BSign") || channel.equals("MC|BEdit")) {
|
||||
wrapper.setId(0x0B);
|
||||
Item book = wrapper.read(Type.ITEM);
|
||||
BlockItemPackets1_13.toServer(book);
|
||||
getProtocol().getBlockItemPackets().handleItemToServer(book);
|
||||
wrapper.write(Type.FLAT_ITEM, book);
|
||||
boolean signing = channel.equals("MC|BSign");
|
||||
wrapper.write(Type.BOOLEAN, signing);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren