Search in sources :

Example 1 with DataItem

use of com.viaversion.viaversion.api.minecraft.item.DataItem in project ViaBackwards by ViaVersion.

the class BlockItemPackets1_11 method getNewItem.

private Item getNewItem(ChestedHorseStorage storage, int slotId, Item current) {
    int strength = storage.isChested() ? storage.getLiamaStrength() : 0;
    int startNonExistingFormula = 2 + 3 * strength;
    int endNonExistingFormula = 2 + 3 * (storage.isChested() ? 5 : 0);
    if (slotId >= startNonExistingFormula && slotId < endNonExistingFormula)
        return new DataItem(166, (byte) 1, (short) 0, getNamedTag("ยง4SLOT DISABLED"));
    if (slotId == 1)
        return null;
    return current;
}
Also used : DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem)

Example 2 with DataItem

use of com.viaversion.viaversion.api.minecraft.item.DataItem in project ViaFabric by ViaVersion.

the class VRHandItemProvider method fromNative.

private Item fromNative(ItemStack original) {
    Identifier iid = Registry.ITEM.getId(original.getItem());
    int id = RemappingUtil.swordId(iid.toString());
    return new DataItem(id, (byte) original.getCount(), (short) original.getDamage(), null);
}
Also used : Identifier(net.minecraft.util.Identifier) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem)

Example 3 with DataItem

use of com.viaversion.viaversion.api.minecraft.item.DataItem in project ViaFabric by ViaVersion.

the class VRHandItemProvider method fromNative.

private Item fromNative(ItemStack original) {
    Identifier iid = Registry.ITEM.getId(original.getItem());
    int id = RemappingUtil.swordId(iid.toString());
    return new DataItem(id, (byte) original.getCount(), (short) original.getDamage(), null);
}
Also used : Identifier(net.minecraft.util.Identifier) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem)

Example 4 with DataItem

use of com.viaversion.viaversion.api.minecraft.item.DataItem in project ViaFabric by ViaVersion.

the class VRHandItemProvider method fromNative.

private Item fromNative(ItemStack original) {
    Identifier iid = Registry.ITEM.getId(original.getItem());
    int id = RemappingUtil.swordId(iid.toString());
    return new DataItem(id, (byte) original.getCount(), (short) original.getDamage(), null);
}
Also used : Identifier(net.minecraft.util.Identifier) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem)

Example 5 with DataItem

use of com.viaversion.viaversion.api.minecraft.item.DataItem in project ViaFabric by ViaVersion.

the class VRHandItemProvider method fromNative.

private Item fromNative(ItemStack original) {
    Identifier iid = Registry.ITEM.getId(original.getItem());
    int id = RemappingUtil.swordId(iid.toString());
    return new DataItem(id, (byte) original.getCount(), (short) original.getDamage(), null);
}
Also used : Identifier(net.minecraft.util.Identifier) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem)

Aggregations

DataItem (com.viaversion.viaversion.api.minecraft.item.DataItem)23 Item (com.viaversion.viaversion.api.minecraft.item.Item)12 PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)7 Identifier (net.minecraft.util.Identifier)6 PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)5 CompoundTag (com.github.steveice10.opennbt.tag.builtin.CompoundTag)4 Metadata (com.viaversion.viaversion.api.minecraft.metadata.Metadata)4 PacketHandler (com.viaversion.viaversion.api.protocol.remapper.PacketHandler)4 Type (com.viaversion.viaversion.api.type.Type)4 StringTag (com.github.steveice10.opennbt.tag.builtin.StringTag)3 JsonObject (com.google.gson.JsonObject)3 Via (com.viaversion.viaversion.api.Via)3 ListTag (com.github.steveice10.opennbt.tag.builtin.ListTag)2 Sets (com.google.common.collect.Sets)2 JsonElement (com.google.gson.JsonElement)2 Position (com.viaversion.viaversion.api.minecraft.Position)2 AbstractProtocol (com.viaversion.viaversion.api.protocol.AbstractProtocol)2 Protocol1_14To1_13_2 (com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2)2 EntityTracker1_14 (com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14)2 EntityTracker1_9 (com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9)2