resolution to null errors but not seeing item models for all states

This commit is contained in:
Mohammad-Ali Minaie
2017-02-13 14:00:27 -05:00
parent f5b246a8bb
commit 9600f40037
2 changed files with 15 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import nmd.primal.forgecraft.blocks.*; import nmd.primal.forgecraft.blocks.*;
import nmd.primal.forgecraft.items.blocks.ItemBlockIngotBall;
/** /**
* Created by kitsu on 11/26/2016. * Created by kitsu on 11/26/2016.
@@ -35,6 +36,7 @@ public class ModBlocks {
public static Block failedironcruciblehot; public static Block failedironcruciblehot;
public static Block ironball; public static Block ironball;
public static ItemBlock ironballitem;
public static void init() { public static void init() {
@@ -63,6 +65,7 @@ public class ModBlocks {
failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot"); failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot");
ironball = new IngotBall(Material.IRON, "ironball", 5.0F); ironball = new IngotBall(Material.IRON, "ironball", 5.0F);
ironballitem = new ItemBlockIngotBall(ironball);
} }
@@ -89,7 +92,7 @@ public class ModBlocks {
registerBlock(failedironcrucible); registerBlock(failedironcrucible);
registerBlock(failedironcruciblehot); registerBlock(failedironcruciblehot);
registerBlock(ironball); registerBlockSubType(ironball, ironballitem);
} }
public static void registerRenders() { public static void registerRenders() {
@@ -124,6 +127,13 @@ public class ModBlocks {
GameRegistry.register(item); GameRegistry.register(item);
} }
private static void registerBlockSubType(Block block, ItemBlock itemBlock){
GameRegistry.register(block);
ItemBlock item = itemBlock;
item.setRegistryName(block.getRegistryName());
GameRegistry.register(item);
}
private static void registerRender(Block block) { private static void registerRender(Block block) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
} }

View File

@@ -26,7 +26,7 @@ public class ModItems {
public static Item pistonbellows; public static Item pistonbellows;
public static Item softcrucible; public static Item softcrucible;
public static Item stonetongs; public static Item stonetongs;
public static ItemBlock ironingotball; //public static ItemBlock ironingotball;
//public static Item forgingmanual; //public static Item forgingmanual;
public static void init() { public static void init() {
@@ -34,7 +34,7 @@ public class ModItems {
pistonbellows = new ItemBellowsHandle(); pistonbellows = new ItemBellowsHandle();
softcrucible = new ItemSoftCrucible(); softcrucible = new ItemSoftCrucible();
stonetongs = new ItemStoneTongs("stonetongs"); stonetongs = new ItemStoneTongs("stonetongs");
ironingotball = new ItemBlockIngotBall(ModBlocks.ironball.setRegistryName(ModBlocks.ironball.getRegistryName())); //ironingotball = new ItemBlockIngotBall(ModBlocks.ironball.setRegistryName(ModBlocks.ironball.getRegistryName()));
//forgingmanual = new ItemForgingManual(); //forgingmanual = new ItemForgingManual();
} }
@@ -42,14 +42,14 @@ public class ModItems {
GameRegistry.register(pistonbellows); GameRegistry.register(pistonbellows);
GameRegistry.register(softcrucible); GameRegistry.register(softcrucible);
GameRegistry.register(stonetongs); GameRegistry.register(stonetongs);
GameRegistry.register(ironingotball); //GameRegistry.register(ironingotball);
//GameRegistry.register(forgingmanual); //GameRegistry.register(forgingmanual);
} }
public static void registerRenders() { public static void registerRenders() {
registerRender(pistonbellows); registerRender(pistonbellows);
registerRender(softcrucible); registerRender(softcrucible);
registerRenderItemBlock(ironingotball); //registerRenderItemBlock(ironingotball);
//registerRender(forgingmanual); //registerRender(forgingmanual);
} }