Jump to content

Recommended Posts

Posted

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 !

Posted

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.

Posted

Thank you for your reply jeffryfisher,

 

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

 

About the recipes, I think I will just use 1.9 fence patterns to make my walls recipes, and when i will update to 1.9, I will reverse the process.

Squirrel ! Squirrel ! Squirrel !

Posted
  On 3/10/2016 at 9:12 PM, Major Squirrel said:

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.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello , when I try to launch the forge installer it just crash with a message for 0,5 secondes. I'm using java 17 to launch it. Here's the link of the error :https://cdn.corenexis.com/view/?img=d/ma24/qs7u4U.jpg  
    • You will find the crash-report or log in your minecraft directory (crash-report or logs folder)
    • Use a modpack which is using these 2 mods as working base:   https://www.curseforge.com/minecraft/modpacks/life-in-the-village-3
    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
  • Topics

×
×
  • Create New...

Important Information

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