Jump to content

Branone

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by Branone

  1. Sorry, I thought I understood what to do but apparently not. I have one blockstate for the hot tub and in there I have this: { "variants": { "normal": {"model": "odm:hot_tub_empty"}, "back=false,forward=false,left=false,right=false": {"model": "odm:hot_tub_empty"}, "back=true,forward=true,left=true,right=true": {"model": "odm:hot_tub_center_empty"}, "back=true,forward=false,left=false,right=false": {"model": "odm:hot_tub_side_empty"}, "back=false,forward=true,left=false,right=false": {"model": "odm:hot_tub_side_empty", "y": 180}, "back=false,forward=false,left=true,right=false": {"model": "odm:hot_tub_side_empty", "y": 270}, "back=false,forward=false,left=false,right=true": {"model": "odm:hot_tub_side_empty", "y": 90}, "back=true,forward=true,left=false,right=false": {"model": "odm:hot_tub_sides_two_empty", "y": 90}, "back=false,forward=false,left=true,right=true": {"model": "odm:hot_tub_sides_two_empty"}, "back=true,forward=false,left=true,right=false": {"model": "odm:hot_tub_corner_empty", "y": 270}, "back=true,forward=false,left=false,right=true": {"model": "odm:hot_tub_corner_empty"}, "back=false,forward=true,left=true,right=false": {"model": "odm:hot_tub_corner_empty", "y": 180}, "back=true,forward=false,left=true,right=false": {"model": "odm:hot_tub_corner_empty", "y": 270}, "back=true,forward=true,left=false,right=true": {"model": "odm:hot_tub_sides_three_empty"}, "back=false,forward=true,left=true,right=true": {"model": "odm:hot_tub_sides_three_empty", "y": 90}, "back=true,forward=true,left=true,right=false": {"model": "odm:hot_tub_sides_three_empty", "y": 190}, "back=true,forward=false,left=true,right=true": {"model": "odm:hot_tub_sides_three_empty", "y": 270}, } } And in the hot tub's class I have set the blockstate properties: public static final PropertyBool BACK = PropertyBool.create("back"); public static final PropertyBool FORWARD = PropertyBool.create("forward"); public static final PropertyBool LEFT = PropertyBool.create("left"); public static final PropertyBool RIGHT = PropertyBool.create("right"); So under the addCollisionBoxesToList method, what exactly should I be checking for the value of in the if statements?
  2. Great, so I just need to check the value of the state passed through using an if statement in this method and add the collision box accordingly?
  3. Here is my hot tub. As you can see, I can hop inside of it. It has walls which work properly so that I can't just walk out of it. But here's the major problem. When I make the hot tub larger, it doesn't get rid of the collision box for the wall that is no longer there. So because of that, I can't move around in the hot tub (move to the other hot tub part that I placed down). It's only meant to have collision boxes on the faces that are false. Just realised my problem but don't know how to fix it. The addCollisionBoxes method only gets called on once - when it's first placed down. So when the blockstate properties change, the collision boxes don't get updated. How do I update the collision boxes? Block Class:
  4. I didn't know about that Makes me feel a lot better though.
  5. Okay, I'll make it two separate blocks then. I didn't want to do this because it will be quite tedious in the future with all the different types of wooden wardrobes that I am adding + the open-door versions of them.
  6. Okay I've added the JSON file to the post now. I know that it isn't a good idea to make blocks bigger than 1 block but I didn't think it was entirely necessary, as I've seen many mods which successfully do this and I also have a 2x1 block which works fine with the textures.
  7. To start off, take a look at the image below to see what my model is suppose to look like in-game. What the block is meant to look like: What the block actually looks like-game: JSON Model File: It changes bits and pieces of the block. The doors of the wardrobe are half the wood I set it to (oak) and the other half is spruce wood which I never even set. Also, how is it even possible for the block to render two different textures on the same face? This double-texture thing is also happening on the back of the wardrobe only on the left side, where it's strangely rendering a quartz_block_bottom and quartz_block_chiseled. A quartz_block is also rendering on the bottom of the wardrobe. These positions seem completely abitrary to me and make this bug even more bizzare. This next part may be of some significance. When I first encountered this issue, I looked in the json model file and saw that two of the textures being referred to hadn't been typed out properly in the file by the model creator (it said the name of the anvil block and quartz_block_side textures but didn't have the 'blocks/' before each of them). So after fixing that I immediately suspected that the json file for the model was corrupt. I then went ahead and deleted the json file, went into the model creator, loaded the model back up and exported it once again - a fresh json file. This did nothing to solve the issue. After this, I literally re-built the entire wardrobe in the model creator, exported it and still got the same glitch. Due to the odd nature of this bug and the fact that I don't get any console error, I haven't been able to to look it up to see if anyone else has gotten this before. I appreciate any help I can get to fix this. No error shows up in the console but if you're still curious here:
  8. When I right-click on my object it is meant to change the block's model to be open (it's a wardrobe with doors that open). But instead my hand does the interaction animation to indicate that I have right-clicked the block yet the model doesn't change to 'oak_wardrobe_closed'. In the blockstate of the wardrobe I have the 3 different possible situations: the open variable is true, false or does not exist/work for some reason and therefore resorts to the normal tag. I know that the problem is due to the blockstate not being able to read the open variable's value and therefore resorting to the normal tag. This is confirmed by the fact that I receieve an error when I don't have that tag, and also because the default model in-game is always the same as the tag. { "variants": { "normal": { "model": "odm:oak_wardrobe_closed" }, "open=false": { "model": "odm:oak_wardrobe_closed" }, "open=true": { "model": "odm:oak_wardrobe_open" } } } Then in the BlockWardrobe class I have created a public boolean called open which is what I want the blockstate to be checking for the value of. public class BlockWardrobe extends Block { public boolean open = false; public BlockWardrobe(Material materialIn) { super(materialIn); this.setCreativeTab(OddmentsMod.tabOddments); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (open == true) open = false; else open = true; return true; } } I don't know whether this is a problem with my lack of Java knowledge or Minecraft method knowledge - or perhaps both. I am aware that I'm not making the open variable unique for each instance and am pretty sure that I should be doing that in the constructor. But for now I'm just trying to get something basic working.
  9. Noted. I re-formatted the code so it should be easier to debug the problem if you feel like helping out.
  10. My mod currently has several working blocks but I've been having problems trying to add a semi-animated block with different models in its blockstate. I believe it has to do with my naming conventions as I have three different names pertaining to this block. The block I'm trying to add is a wardrobe which will soon have various wood types, but for now I'm trying to get an oak one working. I want the wardrobe to use the oak_wardrobe_closed model by default and then switch to oak_wardrobe_open when right-clicked. Console Error: Code for the initialization of the blocks: Names of the JSON files: Blockstate: BlockWardrobe:
  11. After scouring the internet and spending hours of confusion trying to make sense of the code for basic blocks in Minecraft, I have been left with no choice but to ask the question in specific detail for myself. What I want I want to know how to make the collision box more than just one square shape, so as to surround all of the model perfectly. For example with one of my objects, a hot tub, I want an area in which you stand to be hollow similar to the cauldron. I am aware that the addCollisionBoxes method is responsible for handling this however I do not understand how it works. There are no videos on YouTube that I could find which explain the method in detail and the threads relevant to the topic are quite confusing/overwhelming to someone who has just begun learning modding for Minecraft. This is the most related thread I could find: http://www.minecraftforge.net/forum/index.php?topic=22129.0 but the OP seemed to already know half of what he was doing, where as I have no idea how to even begin implementing this method into my block's class. I would greatly appreciate it if someone could just run me through how the method works and where to begin with it.
×
×
  • Create New...

Important Information

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