Search in sources :

Example 1 with TagEntry

use of net.modificationstation.stationapi.api.tags.TagEntry in project StationAPI by ModificationStation.

the class MainTest method onInitialize.

@EventListener
public void onInitialize(TagRegisterEvent event) {
    SLTest.LOGGER.info("==================================================================================================");
    Identifier oreDictToTest = Identifier.of("items/tools/pickaxes/");
    SLTest.LOGGER.info(oreDictToTest);
    Optional<Map<Identifier, List<TagEntry>>> predicates = TagRegistry.INSTANCE.getWithIdentifiers(oreDictToTest);
    if (predicates.isPresent()) {
        for (Identifier oreDictEntryObject : predicates.get().keySet()) {
            SLTest.LOGGER.info(oreDictEntryObject);
        }
    } else {
        throw new RuntimeException("Predicates are empty for " + oreDictToTest);
    }
    SLTest.LOGGER.info("==================================================================================================");
// block.mineableByTool("pickaxe*", 0);
}
Also used : Identifier(net.modificationstation.stationapi.api.registry.Identifier) TagEntry(net.modificationstation.stationapi.api.tags.TagEntry) EventListener(net.mine_diver.unsafeevents.listener.EventListener)

Example 2 with TagEntry

use of net.modificationstation.stationapi.api.tags.TagEntry in project StationAPI by ModificationStation.

the class TagBlockInit method addBlock0Damage.

private static void addBlock0Damage(String oreDictString, BlockBase 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 3 with TagEntry

use of net.modificationstation.stationapi.api.tags.TagEntry in project StationAPI by ModificationStation.

the class TagItemInit method addItem.

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

Example 4 with TagEntry

use of net.modificationstation.stationapi.api.tags.TagEntry in project StationAPI by ModificationStation.

the class TagItemInit method addItemIgnoreDamage.

private static void addItemIgnoreDamage(String oreDictString, ItemBase itemBase) {
    ItemInstance itemInstanceToUse = new ItemInstance(itemBase);
    TagRegistry.INSTANCE.register(new TagEntry(new ItemInstance(itemBase), itemInstance -> itemInstanceToUse.itemId == itemInstance.itemId, Identifier.of(oreDictString)));
}
Also used : EventListener(net.mine_diver.unsafeevents.listener.EventListener) ItemBase(net.minecraft.item.ItemBase) ListenerPriority(net.mine_diver.unsafeevents.listener.ListenerPriority) EventBusPolicy(net.modificationstation.stationapi.api.mod.entrypoint.EventBusPolicy) LOGGER(net.modificationstation.stationapi.api.StationAPI.LOGGER) TagRegistry(net.modificationstation.stationapi.api.tags.TagRegistry) Entrypoint(net.modificationstation.stationapi.api.mod.entrypoint.Entrypoint) Identifier(net.modificationstation.stationapi.api.registry.Identifier) ItemInstance(net.minecraft.item.ItemInstance) TagRegisterEvent(net.modificationstation.stationapi.api.event.tags.TagRegisterEvent) TagEntry(net.modificationstation.stationapi.api.tags.TagEntry) TagEntry(net.modificationstation.stationapi.api.tags.TagEntry) ItemInstance(net.minecraft.item.ItemInstance)

Example 5 with TagEntry

use of net.modificationstation.stationapi.api.tags.TagEntry in project StationAPI by ModificationStation.

the class TagBlockInit method addBlockIgnoreDamage.

private static void addBlockIgnoreDamage(String oreDictString, BlockBase itemBase) {
    ItemInstance itemInstanceToUse = new ItemInstance(itemBase);
    TagRegistry.INSTANCE.register(new TagEntry(new ItemInstance(itemBase), itemInstance -> itemInstanceToUse.itemId == itemInstance.itemId, Identifier.of(oreDictString)));
}
Also used : EventListener(net.mine_diver.unsafeevents.listener.EventListener) ListenerPriority(net.mine_diver.unsafeevents.listener.ListenerPriority) EventBusPolicy(net.modificationstation.stationapi.api.mod.entrypoint.EventBusPolicy) LOGGER(net.modificationstation.stationapi.api.StationAPI.LOGGER) TagRegistry(net.modificationstation.stationapi.api.tags.TagRegistry) Entrypoint(net.modificationstation.stationapi.api.mod.entrypoint.Entrypoint) Identifier(net.modificationstation.stationapi.api.registry.Identifier) ItemInstance(net.minecraft.item.ItemInstance) BlockBase(net.minecraft.block.BlockBase) TagRegisterEvent(net.modificationstation.stationapi.api.event.tags.TagRegisterEvent) TagEntry(net.modificationstation.stationapi.api.tags.TagEntry) TagEntry(net.modificationstation.stationapi.api.tags.TagEntry) ItemInstance(net.minecraft.item.ItemInstance)

Aggregations

TagEntry (net.modificationstation.stationapi.api.tags.TagEntry)7 ItemInstance (net.minecraft.item.ItemInstance)6 EventListener (net.mine_diver.unsafeevents.listener.EventListener)3 Identifier (net.modificationstation.stationapi.api.registry.Identifier)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 TagRegistry (net.modificationstation.stationapi.api.tags.TagRegistry)2 BlockBase (net.minecraft.block.BlockBase)1 ItemBase (net.minecraft.item.ItemBase)1