Posted September 23, 20168 yr All I'm trying to do is add doors with no extra functionality for the wood blocks i've added. I've been at this for hours and Everything I try has problems no one can seem to help with. So I'll go back as far as I think is correct. Iv'e got an item that extends ItemDoor: public class ItemVarietyDoor extends ItemDoor{ public ItemVarietyDoor(Block block) { super(block); } } I've got a block that extends BlockDoor public class BlockVarietyDoor extends BlockDoor{ private String Wood; public BlockVarietyDoor(String wood) { super(Material.wood); this.setStepSound(Block.soundTypeWood); this.setHardness(3.0F); this.disableStats(); Wood = wood; } @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(getItem()); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : getItem(); } public Item getItem(){ return GameRegistry.findItem(VarietyTrees.MODID, Wood+"_door"); } } I've got a blockstates.json "apple_door": http://pastebin.com/E8aqEPJz I've got a block model json "apple_door_bottom": { "parent": "block/door_bottom", "textures": { "bottom": "varietytrees:blocks/door_apple_lower", "top": "varietytrees:blocks/door_apple_upper" } } I've got a block model json "apple_door_bottom_rh": { "parent": "block/door_bottom_rh", "textures": { "bottom": "varietytrees:blocks/door_apple_lower", "top": "varietytrees:blocks/door_apple_upper" } } I've got a block model json "apple_door_top": { "parent": "block/door_top", "textures": { "bottom": "varietytrees:blocks/door_apple_lower", "top": "varietytrees:blocks/door_apple_upper" } } I've got a block model json "apple_door_top_rh": { "parent": "block/door_top_rh", "textures": { "bottom": "varietytrees:blocks/door_apple_lower", "top": "varietytrees:blocks/door_apple_upper" } } What goes in my main class to get this to work properly? I know broadly what needs to go there, I need to register things and renderers, but every time I try, it's wrong
September 23, 20168 yr These classes aren't complete enough to function. Your door classes don't have any getState method overrides, which means that it will use the vanilla door variants (not what you want). Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
September 23, 20168 yr Author That part I actually did have working fine before. But maybe its part of the reason other parts didn't, so I overrode all of the state functions too. What else?
September 23, 20168 yr Have you... - Registered your block? - Registered your item? - Registered renderers? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
September 23, 20168 yr Author AppleDoor = new BlockVarietyDoor("apple"); GameRegistry.registerBlock(AppleDoor, "apple_door"); AppleDoorItem = new ItemVarietyDoor(AppleDoor); GameRegistry.registerItem(AppleDoorItem, "apple_door"); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(Item.getItemFromBlock(AppleDoor),0, new ModelResourceLocation(MODID + ":" + "apple_door", "inventory")); Crashes with: The name varietytrees:apple_door has been registered twice, for net.minecraft.item.ItemBlock@46916d68 and panda.varietytrees.trees.ItemVarietyDoor@79b07ccd. At the line GameRegistry.registerItem(AppleDoorItem, "apple_door"); Even though i am not using an itemblock
September 23, 20168 yr Hi registerBlock also registers an ItemBlock automatically, corresponding to the block. public static Block registerBlock(Block block, String name) { return registerBlock(block, ItemBlock.class, name); } If you want to use your own ItemBLock, use this method instead /** * Register a block with the world, with the specified item class and block name * * @param block The block to register * @param itemclass The item type to register with it : null registers a block without associated item. * @param name The mod-unique name to register it as, will get prefixed by your modid. */ public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name) { return registerBlock(block, itemclass, name, new Object[] {}); } -TGG
September 23, 20168 yr Author Hello! So I need to make my own ItemDoor class that extends ItemBlock then? I cannot use one that extends minecraft ItemDoor? Because Itemdoor does not extend ItemBlock..
September 23, 20168 yr Hi In that case, try using registerBlock with null in place of itemClass, and then register your item separately, like in the code you posted. -TGG
September 23, 20168 yr Author That worked! What an elegant solution. The only thing now is my Item is rendering as the missing texture cube. I double checked my json and it looks correct to me, so I'm not sure there. Console output is: Model definition for location varietytrees:apple_door#inventory not found
September 23, 20168 yr Hi Do you have a json for your item in assets/yourmodid/models/item? You might find this example project useful to get the structure of the resources correct https://github.com/TheGreyGhost/MinecraftByExample/tree/1-8final The mbe01 and mbe10 are probably the closest to what you're doing. -TGG
September 23, 20168 yr Author Yes. And its' file name is the same as what I registered the item renderer with
September 23, 20168 yr Console output is: Model definition for location varietytrees:apple_door#inventory not found I think that means that you forgot to set the custom model resource location during client-proxy preinit. There are many threads around here with examples. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.