trying to register itemblocks

This commit is contained in:
Mohammad-Ali Minaie
2017-02-13 09:26:10 -05:00
parent 1e72721c22
commit f5b246a8bb
3 changed files with 42 additions and 2 deletions

View File

@@ -42,10 +42,12 @@ public class ForgeCraft
NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ModInfo.MOD_CHANNEL); NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ModInfo.MOD_CHANNEL);
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
ModItems.init();
ModBlocks.init(); ModBlocks.init();
ModItems.register();
ModBlocks.register(); ModBlocks.register();
ModItems.init();
ModItems.register();
ModTiles.registerTileEntities(); ModTiles.registerTileEntities();
// ModItems.registerRenders(); // ModItems.registerRenders();
proxy.preInit(); proxy.preInit();

View File

@@ -5,6 +5,7 @@ import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoader;
@@ -15,6 +16,7 @@ import nmd.primal.forgecraft.items.ItemBellowsHandle;
import nmd.primal.forgecraft.items.ItemForgingManual; import nmd.primal.forgecraft.items.ItemForgingManual;
import nmd.primal.forgecraft.items.ItemSoftCrucible; import nmd.primal.forgecraft.items.ItemSoftCrucible;
import nmd.primal.forgecraft.items.ItemStoneTongs; import nmd.primal.forgecraft.items.ItemStoneTongs;
import nmd.primal.forgecraft.items.blocks.ItemBlockIngotBall;
/** /**
* Created by kitsu on 11/26/2016. * Created by kitsu on 11/26/2016.
@@ -24,6 +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 Item forgingmanual; //public static Item forgingmanual;
public static void init() { public static void init() {
@@ -31,6 +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()));
//forgingmanual = new ItemForgingManual(); //forgingmanual = new ItemForgingManual();
} }
@@ -38,12 +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(forgingmanual); //GameRegistry.register(forgingmanual);
} }
public static void registerRenders() { public static void registerRenders() {
registerRender(pistonbellows); registerRender(pistonbellows);
registerRender(softcrucible); registerRender(softcrucible);
registerRenderItemBlock(ironingotball);
//registerRender(forgingmanual); //registerRender(forgingmanual);
} }
@@ -90,6 +96,11 @@ public class ModItems {
private static void registerRender(Item item) { private static void registerRender(Item item) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
} }
private static void registerRenderItemBlock(ItemBlock item){
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
/*public static void registerRender(Item item, int meta, String fileName) { /*public static void registerRender(Item item, int meta, String fileName) {
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation(fileName), "inventory")); ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation(fileName), "inventory"));

View File

@@ -0,0 +1,27 @@
package nmd.primal.forgecraft.items.blocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
/**
* Created by mminaie on 2/12/17.
*/
public class ItemBlockIngotBall extends ItemBlock {
public ItemBlockIngotBall(Block block){
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
//this.setRegistryName(name);
}
public int getMetadata(int damage)
{
return damage;
}
}