Jump to content

[1.10] Trouble with custom wall blocks. [RESOLVED]


Recommended Posts

Posted

Hello I made some custom wall blocks and for some reason they show up twice in the creative inventory. They all have the same name unlocalized name and block ID number but only one is textured.  I do not understand why I am getting 2 block for each block registered as I do not get them with my custom stair blocks or blocks, but you can still select both wall blocks and place them in the world. My System.out.println statement shows only one block being created is this a bug in forge itself dealing with wall blocks?

 

Here is my wall block class

 

WoolenWalls.java

 

  Reveal hidden contents

 

 

and here is how i am registering my blocks.

 

MBM_Blocks.java

 

  Reveal hidden contents

 

 

and here is an image I made to show what it is doing in the creative tabs.

 

 

  Reveal hidden contents

 

 

I do not know why the image is not showing up so here is a direct link to the image also.

https://postimg.org/image/6igkmjpcd/

 

anyhelp would be greatly appreciated!

Thanks in advance.

 

 

Posted

BlockWall has variants for cobblestone and mossy cobblestone walls.

I'm pretty sure you are creating them also(without you knowing this). You prob see this in the console.

I think because you create them and there aren't any variants defined in your blockstate for cobble and mossycobble they have no texture and show up in the creative tab as "doubles" without textures.

You need to make your own class for walls.

I made my own abstract class for walls and extend from that. Counterpart of this is, it will no longer be a child of BlockWall.

Post the log from the console so we can help you better.

 

Also i think your code looks pretty complicated, not to say chaotic. Everyone has his/her own style, but still....

Like Diesieben7 said, use metadata.

Posted
  On 11/2/2016 at 12:55 PM, rtester said:

 

When you use postimg, don't get the first URL it gives you, get the second one ("direct link").

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
  On 11/2/2016 at 4:20 PM, winnetrie said:

BlockWall has variants for cobblestone and mossy cobblestone walls.

I'm pretty sure you are creating them also(without you knowing this). You prob see this in the console.

I think because you create them and there aren't any variants defined in your blockstate for cobble and mossycobble they have no texture and show up in the creative tab as "doubles" without textures.

You need to make your own class for walls.

I made my own abstract class for walls and extend from that. Counterpart of this is, it will no longer be a child of BlockWall.

Post the log from the console so we can help you better.

 

It is not duplicating the default Minecraft walls it is only duplicating my walls. I have my own class for creating the walls I posted it in my initial forum post. and the only walls are my blocks being duplicated twice as i explained in the post and in the image I posted my walls same name same block Id one with a texture and one without.

 

 

  Quote

Why are you creating separate wall instances for every color? Why not use metadata?

 

Because if I remembered right when i did this in 1.7.10 when I placed the walls in different directions it changed the textures of the block like the stairs did.  I am a beginner to modding and I thought this was pretty simple code. the only complicated part was the for loop that registered all 16 colors in 3 lines instead of typing out 16 separate lines, but if you can show me how to register them with one instance of the class with the metadata it would be greatly appreciated.

 

  Quote

Also please post the console output.

 

Console output

 

  Reveal hidden contents

 

 

Thanks for answering everyone

 

EDIT I forgot to say none of my other blocks are duplicating and the stairs and the wall blocks are almost identical code.

Posted

I think Winnetrie has a point. You extended BlockWall, which has a state with a two-value property. I don't see you overriding it, so you could get two versions of your wall.

 

Investigate what your wall's parent class is doing to you.

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.

Posted

I did not say it is duplicating minecraft walls.

What i was saying is that BlockWall creates 2 walls and you are extending it!! Somehow 1 gets more or less overwrited but the other 1 not, because you did not defined it in the blockstate wich ofc you didn't because you don't want that.

 

You did not create your own wall class, you extend BlockWall class.

If you extend a class you take everything inside that class to your class extending it. Unless you override it. You can even add new stuff, but you can't remove things. At least not that i know.

I'm not sure you can override these variants, i wasn't able to do so. I think they will co-exist, even if you add your own.

 

If you can override this:

public static final PropertyEnum<BlockWall.EnumType> VARIANT = PropertyEnum.<BlockWall.EnumType>create("variant", BlockWall.EnumType.class);

I think you can't. If i'm wrong i'll be happy to hear about it.

As long as you can't, this will keep messing with your walls.

 

EDIT:

 

Just tested it your way just to make sure and this is what i get:

 

Exception loading model for variant tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false for blockstate "tem:testwall[east=false,north=false,south=true,up=true,variant=cobblestone,west=false]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false with loader VariantLoader.INSTANCE,

 

Strange i don't see this in your log.

And guess what happens too? I made 1 wall and i have 2 in the creative tab.

Posted
  On 11/3/2016 at 1:08 AM, winnetrie said:

I did not say it is duplicating minecraft walls.

What i was saying is that BlockWall creates 2 walls and you are extending it!! Somehow 1 gets more or less overwrited but the other 1 not, because you did not defined it in the blockstate wich ofc you didn't because you don't want that.

 

You did not create your own wall class, you extend BlockWall class.

If you extend a class you take everything inside that class to your class extending it. Unless you override it. You can even add new stuff, but you can't remove things. At least not that i know.

I'm not sure you can override these variants, i wasn't able to do so. I think they will co-exist, even if you add your own.

 

If you can override this:

public static final PropertyEnum<BlockWall.EnumType> VARIANT = PropertyEnum.<BlockWall.EnumType>create("variant", BlockWall.EnumType.class);

I think you can't. If i'm wrong i'll be happy to hear about it.

As long as you can't, this will keep messing with your walls.

 

EDIT:

 

Just tested it your way just to make sure and this is what i get:

 

Exception loading model for variant tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false for blockstate "tem:testwall[east=false,north=false,south=true,up=true,variant=cobblestone,west=false]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false with loader VariantLoader.INSTANCE,

 

Strange i don't see this in your log.

And guess what happens too? I made 1 wall and i have 2 in the creative tab.

 

This my new class

 

  Reveal hidden contents

 

 

and this is the error I get now.

 

 

  Reveal hidden contents

 

 

When I did this in 1.7.10 Yeah I know 1.10 is different  butI never had to add all these extra method while extending BlockWall I had like  10 lines of code in my WoolenWall class and My WoolenFence and dthey never made duplicates.

 

Also I think the reason the other stuff never showed up in my console window is that I have the .json files for the blocks I am creating  it takes like 10+ .json file for each wall block  1 block state, 6+ block models and an item Block model

the .json files names are

 

BlockState: blockWoolColoredWhiteWall.json

Block Models: blockWoolColoredWhiteWall_Inventory.json, blockWoolColoredWhiteWall_ne.json, blockWoolColoredWhiteWall_ns_above.json, blockWoolColoredWhiteWall_ns.json, blockWoolColoredWhiteWall_nse.json, blockWoolColoredWhiteWall_nsew.json, blockWoolColoredWhiteWall_wall_post.json, and blockWoolColoredWhiteWall_side.json

Item Block:blockWoolColoredWhiteWall.json

 

when I run the loop I do get the errors you had but when you have 14 blocks without .json files the rest of what you wanted got left out of the buffer so i had to just create the white and yellow blocks that I do have the .json files for.

 

EDITED for spelling and added my .json file names

Posted

You never fill META_LOOKUP with any values.  You create the array, but it is full of null.

Also, get rid of it.  enum type objects already have a

Enum#values()

array getter that returns an ordered array of all its values.

 

public static EnumType byMetadata(int meta) {
    return EnumType.values()[meta];
}

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
  On 11/3/2016 at 2:41 AM, Draco18s said:

You never fill META_LOOKUP with any values.  You create the array, but it is full of null.

Also, get rid of it.  enum type objects already have a

Enum#values()

array getter that returns an ordered array of all its values.

 

public static EnumType byMetadata(int meta) {
    return EnumType.values()[meta];
}

 

I guess I do not understand the code then because it is the EXACT code that is in BloackWall with the exception the enums for my block. and I get this error saying it cant set the enums it not allowed.

 

 

  Reveal hidden contents

 

 

EDIT it seems i missed this part of the code when I copied it from the other class

		        EnumType[] var0 = values();
	        int var1 = var0.length;
	           
	          for (int var2 = 0; var2 < var1; var2++) {
	        	  EnumType var3 = var0[var2];
	        	  META_LOOKUP[var3.getMetadata()] = var3;
	           }
	    	}	

 

but now instead of only having 2 of each blocks I have 16

 

 

 

OK I changed the EnumType from the 16 different colors to just this

 

    public static enum EnumType implements IStringSerializable {

       

    NORMAL(0, "mbm_woolen_walls", "normal");

         

and it is only giving me 1 copy of the walls now is this the way it suppose to be done or is this a hack or workaround?  if it is the way it is suppose to be done then I can mark this post Resolved? Let me know and TYVM everyone whom helped me get this far.

 

Posted

Btw You don't need all those .json files anymore. Just use the new forge blockstates.

I have made walls for all 16 hardened clay colors and i have only 1 .json file(the blockstate file). nothing more!

 

here is my blockstate file claywall.json :

 

  Reveal hidden contents

 

 

Pretty cool he?

 

Is everything working now for you or not?

Posted
  On 11/3/2016 at 11:13 AM, winnetrie said:

Btw You don't need all those .json files anymore. Just use the new forge blockstates.

I have made walls for all 16 hardened clay colors and i have only 1 .json file. nothing more!

 

Is everything working now for you or not?

 

Would you have a link to something describing the new forge json files you mentioned because the blockstate files that are in the current minecraft only have 5 multistate references to 2 other files wall_post and wall_side

 

EDIT sorry I did not see the hidden tag in your post

Posted

I edited my previous post.

I created a dummy model to use as a default (wich does nothing except for having a comment)

The first 16 color types are for the blocks the next 16 colors are for the items.

 

i register the render like this:

registerMetaRender(claywall,0,"type=white");
registerMetaRender(claywall,1,"type=orange");
registerMetaRender(claywall,2,"type=magenta");
registerMetaRender(claywall,3,"type=lightblue");
registerMetaRender(claywall,4,"type=yellow");
registerMetaRender(claywall,5,"type=lime");
registerMetaRender(claywall,6,"type=pink");
registerMetaRender(claywall,7,"type=gray");
registerMetaRender(claywall,8,"type=silver");
registerMetaRender(claywall,9,"type=cyan");
registerMetaRender(claywall,10,"type=purple");
registerMetaRender(claywall,11,"type=blue");
registerMetaRender(claywall,12,"type=brown");
registerMetaRender(claywall,13,"type=green");
registerMetaRender(claywall,14,"type=red");
registerMetaRender(claywall,15,"type=black");

 

Posted
  On 11/3/2016 at 12:03 PM, rtester said:

Yeah I guess everything is working ok now except for the walls does not want to connect to other wall types but I guess that is for a new topic.

I think you place this here too. It's still "trouble with custom wall blocks".

 

I made an abstract wall class where all the basic things are inside needed for the walls.

Like this:

 

  Reveal hidden contents

 

That basic class i named it BlockCustomWalls.class (but you name it whatever you like)

 

So from now on if i want to create walls i can create a class for each wall type that extends BlockCustomWalls

In there i define all the subtypes it looks like this:

 

  Reveal hidden contents

 

 

For the connections, look at the BlockCustomWall. You might also want to be able to place torches on top of the wall.

Posted

I have almost the exact code for my walls I changed it to be generic but I never thought of extending the custom class. I am able to place torches ok but I believe my problem is in the canConnectTo method I need to look at your code and the several 1.10 wall code I found on GIT but it seems almost everyone does it completely differently :P

Posted

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

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.

Posted
  On 11/4/2016 at 12:46 AM, jeffryfisher said:

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

 

My walls do not connect to themselves either white wool wont connect to any other color or any other custom walls I created but i guess i could remake the cobble and mossy-cobble and overwrite the default ones since I am using the default texture pack as my images so it does not matter what texture pack is used they will  or should look the same

Posted

If they do not connect to themself, you do something wrong in here:

 

private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        return block == Blocks.BARRIER || block == this || block instanceof BlockWall || block instanceof BlockCustomWall || block instanceof BlockFenceGate || block instanceof BlockFence || (block.isOpaqueCube(iblockstate) && iblockstate.isFullCube());
    }

block==this

block instanceof (your own custom wall class here)

 

Those 2 should be enough to connect to themself

 

Show you code again so we can see what's wrong

 

  On 11/4/2016 at 12:46 AM, jeffryfisher said:

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

Do you let them co-exists in the game or do you completely replace them or do you replace only the recipe so your walls will be returned instead?

If any other mod requires for some reason a vanilla cobblestone wall in a recipe, you will have a problem if it isn't obtaineble.

Ofcourse the oredictionary can solve this, but only other mods use it. There is also no common name for walls in the oredictionary. So other mods can name it wall, Wall, blockwall, blockWall, BlockWall, Blockwall etc etc.

Too many option i think. I 'solved' this more or less in my 1.7.10 mod to include a vanillawand. Placing it in the crafting grid together with the 'new' wall will return the 'old wall.

I don't know any other (better) way.

Posted
  On 11/4/2016 at 10:43 AM, winnetrie said:

If they do not connect to themself, you do something wrong in here:

 

private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        return block == Blocks.BARRIER || block == this || block instanceof BlockWall || block instanceof BlockCustomWall || block instanceof BlockFenceGate || block instanceof BlockFence || (block.isOpaqueCube(iblockstate) && iblockstate.isFullCube());
    }

block==this

block instanceof (your own custom wall class here)

 

Those 2 should be enough to connect to themself

 

Show you code again so we can see what's wrong

 

  Quote

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

Do you let them co-exists in the game or do you completely replace them or do you replace only the recipe so your walls will be returned instead?

If any other mod requires for some reason a vanilla cobblestone wall in a recipe, you will have a problem if it isn't obtaineble.

Ofcourse the oredictionary can solve this, but only other mods use it. There is also no common name for walls in the oredictionary. So other mods can name it wall, Wall, blockwall, blockWall, BlockWall, Blockwall etc etc.

Too many option i think. I 'solved' this more or less in my 1.7.10 mod to include a vanillawand. Placing it in the crafting grid together with the 'new' wall will return the 'old wall.

I don't know any other (better) way.

 

Yeah I only have the default code in there I need to add my custom blocks and classes in there I just have not gotten around to it yet I did try  to add them in when I was extending BlockWall instead of block

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.