Jump to content

[1.8.9][Blocks] Adding more wall blocks using BlockWall


Major Squirrel

Recommended Posts

Good evening,

 

I'm trying to make more wall blocks (from BlockWall class), for now it does work but I feel I am doing it the wrong way. Here is a screenshot of what I accomplished from now :

 

width=800 height=449http://s11.postimg.org/ptxdoyv83/2016_03_09_19_56_27.png[/img]

 

At first thoughts, I felt that I had to extend the BlockWall class to get a full compatibility between my custom walls and the basic ones (regarding blocks connections for example). When I did this, I encountered some problems : I couldn't add values to the EnumType inside the BlockWall class. So I decided to make my own PropertyEnum but then it crashed because it obivously waited for the default EnumType and not my custom one.

 

On second thoughts, I decided to copy the BlockWall class and I changed the EnumType class to implement my own one, changing some values moreover. There I dunno why but I couldn't access to some protected final variable from Block class (yet, I extended my custom one from Block) so I had to put some "default" values for hardness or resistance (if you don't know what I mean, take a look at the BlockWall constructor for setHardness and setResistance, etc). It does work for now, but I feel that this way is not the right one, furthermore the maintainability or the .json blockstates is awful (see the file).

 

Did everyone achieve this with an easier way ? Do you have some tips to give me to facilitate the work I've already done and so make it more maintainable ?

 

Oh and for last, I have a little problem here that I encountered with another block (BlockCrop) too : when registering the models, it can't find the model definition for inventory :

 

Model definition for location questsystem:block_wall_custom#inventory not found

 

But it registers the other models sucessfully. I saw in some codes that I can manually put the "inventory" variant in the .json file but I was wondering if it was the right way ?

 

BlockWallCustom.java

ItemBlockMeta.java

 

BlockWallCustomVariants.java

block_wall_custom.json

 

Thank you in advance for your help :)

 

UPDATE1: fixed inventory registration, I just forgot the .json file in the models/item folder, I'm a bit ashamed.  :-[ Finally, it does not work, lel.

Squirrel ! Squirrel ! Squirrel !

Link to comment
Share on other sites

I've made this exact mod (except that I did not use netherbrick, which is too dark for my taste). BTW, Netherbrick in the crafting shape of a vanilla wall will craft a vanilla netherbrick fence. What were you planning for your recipes?

 

Another irritating feature of vanilla walls is that they won't join up with subclassed walls (the test is for '== BlockWall', not 'instanceof'). Likewise subclassed gates. I ended up adding my own cobble and mossy-cobble walls after distinguishing my recipe to make 7 walls from 7 blocks (I added a cap to the top center).

 

In addition, if you try to vary hardness by metadata, you may need to guard against having your hardness method called against an air block (when breaking blocks, vanilla seems to make one last call to get hardness after replacing a block with air).

 

Take a look at uncle jeff's anystone walls (my extra walls mod). There are two sets of 16 walls in the version for 1.8.

 

I ported to 1.8.9 but haven't uploaded that yet because I ran into problems moving my world from 1.8 to 1.8.9 for client-server final testing. However, I could stick it on Curse Forge as an alpha if you want to try it.

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

It seems that Minecraft has a non-dev-friendly side in there.

If you think walls are unfriendly, just try adding a new horse armor  :o  It's almost as if Mojang's coders didn't plan for future modders when they wrote the vanilla code  :P

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