Item registration updated. Tweaks to ModelManager.

This commit is contained in:
Michael Zanga 2017-01-11 14:19:21 -05:00
parent cc8f0326f0
commit 2cb880c6ca
11 changed files with 24 additions and 17 deletions

View file

@ -1,5 +1,6 @@
package com.zixiken.dimdoors;
import com.zixiken.dimdoors.blocks.BlockDimWall;
import com.zixiken.dimdoors.blocks.ModBlocks;
import com.zixiken.dimdoors.items.ModItems;
import net.minecraft.block.BlockDoor;
@ -15,8 +16,6 @@ import static net.minecraft.item.Item.getItemFromBlock;
@SuppressWarnings({"MethodCallSideOnly", "NewExpressionSideOnly"})
public class ModelManager {
private static final String ID = DimDoors.MODID;
public static void registerModels() {
//ItemBlock registration
register(getItemFromBlock(ModBlocks.blockDimWall));
@ -24,7 +23,6 @@ public class ModelManager {
register(getItemFromBlock(ModBlocks.blockDimWall), 2, "Altered");
register(getItemFromBlock(ModBlocks.blockRift));
register(getItemFromBlock(ModBlocks.blockDimDoorTransient));
register(getItemFromBlock(ModBlocks.blockDimHatch));
//Item registration
@ -41,19 +39,19 @@ public class ModelManager {
public static void registerModelVariants() {
ModelBakery.registerItemVariants(getItemFromBlock(ModBlocks.blockDimWall),
new ResourceLocation(ID + ":blockDimWall"),
new ResourceLocation(ID + ":blockDimWallAncient"),
new ResourceLocation(ID + ":blockDimWallAltered"));
ModBlocks.blockDimWall.getRegistryName(),
new ResourceLocation(ModBlocks.blockDimWall.getRegistryName() + "Ancient"),
new ResourceLocation(ModBlocks.blockDimWall.getRegistryName() + "Altered"));
}
private static void register(Item item) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0,
new ModelResourceLocation(ID + ':' + item.getUnlocalizedName().substring(5), "inventory"));
new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
private static void register(Item item, int meta, String name) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta,
new ModelResourceLocation(ID + ':' + item.getUnlocalizedName().substring(5) + name, "inventory"));
new ModelResourceLocation(item.getRegistryName() + name, "inventory"));
}
@SuppressWarnings("LocalVariableDeclarationSideOnly")

View file

@ -15,6 +15,7 @@ public class ItemDimDoor extends ItemDoorBase {
public ItemDimDoor() {
super(ModBlocks.blockDimDoor, (ItemDoor)Items.IRON_DOOR);
setUnlocalizedName(ID);
setRegistryName(ID);
}
@Override

View file

@ -13,6 +13,7 @@ public class ItemDimDoorGold extends ItemDoorBase {
public ItemDimDoorGold() {
super(ModBlocks.blockDimDoorGold, ModItems.itemDoorGold);
setUnlocalizedName(ID);
setRegistryName(ID);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {

View file

@ -13,6 +13,7 @@ public class ItemDimDoorPersonal extends ItemDoorBase {
public ItemDimDoorPersonal() {
super(ModBlocks.blockDimDoorPersonal, ModItems.itemDoorQuartz);
setUnlocalizedName(ID);
setRegistryName(ID);
}
@Override

View file

@ -13,6 +13,7 @@ public class ItemDimDoorUnstable extends ItemDoorBase {
public ItemDimDoorUnstable() {
super(ModBlocks.blockDimDoorChaos, null);
setUnlocalizedName(ID);
setRegistryName(ID);
}
@Override

View file

@ -16,6 +16,7 @@ public class ItemDimDoorWarp extends ItemDoorBase {
public ItemDimDoorWarp() {
super(ModBlocks.blockDimDoorWarp, (ItemDoor)Items.OAK_DOOR );
setUnlocalizedName(ID);
setRegistryName(ID);
}
@Override

View file

@ -10,5 +10,6 @@ public class ItemDoorGold extends ItemDoor {
super(ModBlocks.blockDoorGold);
setMaxStackSize(16);
setUnlocalizedName(ID);
setRegistryName(ID);
}
}

View file

@ -9,5 +9,6 @@ public class ItemDoorQuartz extends ItemDoor {
public ItemDoorQuartz() {
super(ModBlocks.blockDoorQuartz);
setUnlocalizedName(ID);
setRegistryName(ID);
}
}

View file

@ -10,5 +10,6 @@ public class ItemStableFabric extends Item {
super();
setCreativeTab(DimDoors.dimDoorsCreativeTab);
setUnlocalizedName(ID);
setRegistryName(ID);
}
}

View file

@ -10,5 +10,6 @@ public class ItemWorldThread extends Item {
super();
setCreativeTab(DimDoors.dimDoorsCreativeTab);
setUnlocalizedName(ID);
setRegistryName(ID);
}
}

View file

@ -17,15 +17,15 @@ public class ModItems {
public static ItemBlockDimWall itemBlockDimWall;
public static void registerItems() {
GameRegistry.registerItem(itemDoorQuartz = new ItemDoorQuartz(), ItemDoorQuartz.ID);
GameRegistry.registerItem(itemDimDoorPersonal = new ItemDimDoorPersonal(), ItemDimDoorPersonal.ID);
GameRegistry.registerItem(itemDoorGold = new ItemDoorGold(), ItemDoorGold.ID);
GameRegistry.registerItem(itemDimDoorGold = new ItemDimDoorGold(), ItemDimDoorGold.ID);
GameRegistry.registerItem(itemDimDoor = new ItemDimDoor(), ItemDimDoor.ID);
GameRegistry.registerItem(itemDimDoorWarp = new ItemDimDoorWarp(), ItemDimDoorWarp.ID);
GameRegistry.registerItem(itemStableFabric = new ItemStableFabric(), ItemStableFabric.ID);
GameRegistry.registerItem(itemDimDoorChaos = new ItemDimDoorUnstable(), ItemDimDoorUnstable.ID);
GameRegistry.registerItem(itemWorldThread = new ItemWorldThread(), ItemWorldThread.ID);
GameRegistry.register(itemDoorQuartz = new ItemDoorQuartz());
GameRegistry.register(itemDimDoorPersonal = new ItemDimDoorPersonal());
GameRegistry.register(itemDoorGold = new ItemDoorGold());
GameRegistry.register(itemDimDoorGold = new ItemDimDoorGold());
GameRegistry.register(itemDimDoor = new ItemDimDoor());
GameRegistry.register(itemDimDoorWarp = new ItemDimDoorWarp());
GameRegistry.register(itemStableFabric = new ItemStableFabric());
GameRegistry.register(itemDimDoorChaos = new ItemDimDoorUnstable());
GameRegistry.register(itemWorldThread = new ItemWorldThread());
//ItemBlocks
GameRegistry.register(itemBlockDimWall = new ItemBlockDimWall());