Jump to content

[1.8] How to make custom doors?


Cleverpanda
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm researching the how to create biomes in json. There is a great tool for creating the jsons online. Using the vanilla `river` biome, I want to essentially create a custom disk feature that mixes 3 blocks instead of a single-block provider. Any ideas on where to start with that?
    • I figured out what was wrong ... you can spot it pretty quick most likely: { "type": "minecraft:smelting", "ingredient": { "item": "minecraft:gold_nugget_ore" }, "result": "minecraft:gold_nugget", "experience": 0.25, "cookingtime": 150 }   ... so, after changing `minecraft` to `foundations` for all the custom items and all the recipes work. Well that's what copy/paste will get you. One last question about recipes, though. What does the following json key/value do in the game? "group": "copper_ingot"  
    • # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # #      102.54.94.97     rhino.acme.com          # source server #       38.25.63.10     x.acme.com              # x client host # localhost name resolution is handled within DNS itself. #    127.0.0.1       localhost #    ::1             localhost ###0.0.0.0 apps.corel.com ###0.0.0.0 mc.corel.com 0.0.0.0 origin-mc.corel.com ###0.0.0.0 iws.corel.com
    • Is there a way to create a custom map marker for a custom structure/biome (same as a vanilla mansion)?
    • I’ve scrounged the Internet for solutions and found absolutely nothing that has worked for me I have posted my code in a GitHub Repository. I bet the culprit is somewhere in the Container or TileEntity classes (Furnace packages are in blocks/coke_furnace or blocks/foundry) PS I know I’m on 1.12.2 and that it’s not supported I don’t want to update my game or my code. Lol It’s my favorite version and the most widely modded. I don’t plan to release the mod, I’m just customizing my game to my will. I’ll send it to friends but that’s it.
  • Topics

×
×
  • Create New...

Important Information

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