Search in sources :

Example 11 with ItemInstance

use of net.minecraft.item.ItemInstance in project StationAPI by ModificationStation.

the class TagItemInit method addItem0Damage.

private static void addItem0Damage(String oreDictString, ItemBase itemBase) {
    ItemInstance itemInstanceToUse = new ItemInstance(itemBase, 1, 0);
    TagRegistry.INSTANCE.register(new TagEntry(itemInstanceToUse, itemInstanceToUse::isDamageAndIDIdentical, Identifier.of(oreDictString)));
}
Also used : TagEntry(net.modificationstation.stationapi.api.tags.TagEntry) ItemInstance(net.minecraft.item.ItemInstance)

Example 12 with ItemInstance

use of net.minecraft.item.ItemInstance in project StationAPI by ModificationStation.

the class TileEntityFreezer method readIdentifyingData.

@Override
public void readIdentifyingData(CompoundTag nbttagcompound) {
    super.readIdentifyingData(nbttagcompound);
    ListTag nbttaglist = nbttagcompound.getListTag("Items");
    frozenItemStacks = new ItemInstance[getInventorySize()];
    for (int i = 0; i < nbttaglist.size(); i++) {
        CompoundTag nbttagcompound1 = (CompoundTag) nbttaglist.get(i);
        byte byte0 = nbttagcompound1.getByte("Slot");
        if (byte0 >= 0 && byte0 < frozenItemStacks.length) {
            frozenItemStacks[byte0] = new ItemInstance(nbttagcompound1);
        }
    }
    frozenProgress = nbttagcompound.getShort("BurnTime");
    frozenTimeForItem = nbttagcompound.getShort("CookTime");
}
Also used : ListTag(net.minecraft.util.io.ListTag) CompoundTag(net.minecraft.util.io.CompoundTag) ItemInstance(net.minecraft.item.ItemInstance)

Aggregations

ItemInstance (net.minecraft.item.ItemInstance)12 TagEntry (net.modificationstation.stationapi.api.tags.TagEntry)6 EventListener (net.mine_diver.unsafeevents.listener.EventListener)3 ListenerPriority (net.mine_diver.unsafeevents.listener.ListenerPriority)2 LOGGER (net.modificationstation.stationapi.api.StationAPI.LOGGER)2 TagRegisterEvent (net.modificationstation.stationapi.api.event.tags.TagRegisterEvent)2 Entrypoint (net.modificationstation.stationapi.api.mod.entrypoint.Entrypoint)2 EventBusPolicy (net.modificationstation.stationapi.api.mod.entrypoint.EventBusPolicy)2 Identifier (net.modificationstation.stationapi.api.registry.Identifier)2 TagRegistry (net.modificationstation.stationapi.api.tags.TagRegistry)2 BlockBase (net.minecraft.block.BlockBase)1 Slot (net.minecraft.container.slot.Slot)1 ItemBase (net.minecraft.item.ItemBase)1 CompoundTag (net.minecraft.util.io.CompoundTag)1 ListTag (net.minecraft.util.io.ListTag)1 Frozen (net.modificationstation.sltest.util.Frozen)1 TemplateItemBase (net.modificationstation.stationapi.api.template.item.TemplateItemBase)1