3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 13:52:50 +02:00

18w07c - Fix some inventory issues + mappings, thanks Gerrygames

Dieser Commit ist enthalten in:
creeper123123321 2018-02-18 05:55:52 -03:00
Ursprung 00dedaa1ff
Commit 700f0c293e
3 geänderte Dateien mit 7514 neuen und 7293 gelöschten Zeilen

Datei anzeigen

@ -13,6 +13,8 @@ import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.MappingData;
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.SoundSource;
import java.util.Map;
public class InventoryPackets {
private static String NBT_TAG_NAME;
@ -202,7 +204,7 @@ public class InventoryPackets {
if (MappingData.oldToNewItems.containsKey(item.getId() << 4)) {
rawId = item.getId() << 4;
} else {
System.out.println("FAILED TO GET ITEM FOR " + item.getId()); // TODO: Make this nicer etc, perhaps fix issues with mapping :T
System.out.println("FAILED TO GET 1.13 ITEM FOR " + item.getId()); // TODO: Make this nicer etc, perhaps fix issues with mapping :T
rawId = 16; // Stone
}
}
@ -217,18 +219,32 @@ public class InventoryPackets {
public static void toServer(Item item) {
if (item == null) return;
int rawId = -1;
if (item.getTag() != null) {
CompoundTag tag = item.getTag();
// Check for valid tag
if (tag.contains(NBT_TAG_NAME)) {
if (tag.get(NBT_TAG_NAME) instanceof IntTag) {
int rawId = (int) tag.get(NBT_TAG_NAME).getValue();
item.setId((short) (rawId >> 4));
item.setData((short) (rawId & 0xF));
rawId = (int) tag.get(NBT_TAG_NAME).getValue();
// Remove the tag
tag.remove(NBT_TAG_NAME);
}
}
}
if (rawId == -1){
int itemID = item.getId();
for (Map.Entry<Integer,Integer> entry : MappingData.oldToNewItems.entrySet()){
if (entry.getValue() == itemID){
rawId = entry.getKey();
break;
}
}
}
if (rawId != -1) {
item.setId((short) (rawId >> 4));
item.setData((short) (rawId & 0xF));
} else {
System.out.println("FAILED TO GET 1.12 ITEM FOR " + item.getId()); // TODO: Make this nicer etc, perhaps fix issues with mapping :T
}
}
}

Datei anzeigen

@ -3,24 +3,13 @@ package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.type;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.minecraft.Environment;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.type.PartialType;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.minecraft.BaseChunkType;
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.chunks.Chunk1_9_3_4;
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.chunks.ChunkSection1_9_3_4;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.List;
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
public Chunk1_13Type(ClientWorld param) {
super(param, Chunk.class);