Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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

 

 

Posted

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

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.