ConstructionWand/src/main/java/thetadev/constructionwand/items/ModItems.java

38 lines
1.5 KiB
Java

package thetadev.constructionwand.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.item.ItemTier;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.IForgeRegistryEntry;
import thetadev.constructionwand.basics.ConfigServer;
import thetadev.constructionwand.ConstructionWand;
@Mod.EventBusSubscriber(modid = ConstructionWand.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModItems
{
public static final Item WAND_STONE = new ItemWandBasic("stone_wand", ItemTier.STONE);
public static final Item WAND_IRON = new ItemWandBasic("iron_wand", ItemTier.IRON);
public static final Item WAND_DIAMOND = new ItemWandBasic("diamond_wand", ItemTier.DIAMOND);
public static final Item WAND_INFINITY = new ItemWandInfinity("infinity_wand");
public static final Item[] WANDS = {WAND_STONE, WAND_IRON, WAND_DIAMOND, WAND_INFINITY};
@SubscribeEvent
public static void onRegisterItems(RegistryEvent.Register<Item> event)
{
event.getRegistry().registerAll(WANDS);
}
public static void registerModelProperties() {
for(Item item : WANDS) {
ItemModelsProperties.func_239418_a_(
item, new ResourceLocation(ConstructionWand.MODID, "wand_mode"),
(stack, world, entity) -> entity == null || !(stack.getItem() instanceof ItemWand) ? 0 : ItemWand.getWandMode(stack)
);
}
}
}