Posted August 27, 20196 yr [ANSWERED] So I am new to modding and only have a basic understanding of some things as I have to figure most of it out for myself, well I created some custom models in Blockbench, and they work, but you can see through the world almost like your in spectator mode with them. and their hitboxes are square like a block and do not cover just the model. I do not know how to fix these things as I am new to this(I do know Java). TLDR: @Override public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return VoxelShapes.create(blocksize); } Edited August 27, 20196 yr by MrNoodles75 Topic has been Answered
August 27, 20196 yr 13 minutes ago, MrNoodles75 said: but you can see through the world almost like your in spectator mode with them. Override getRenderLayer in your block classes where their model is not a solid cube and return either CUTOUT_MIPPED or CUTOUT. 17 minutes ago, MrNoodles75 said: and their hitboxes are square like a block and do not cover just the model. Override getCollisionShape and return your own VoxelShape value. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 0 Advanced issues found ▲ 0 Advanced issues found ▲ 0 Advanced issues found ▲ 7 minutes ago, Animefan8888 said: 3 minutes ago, Animefan8888 said: Override getRenderLayer in your block classes where their model is not a solid cube and return either CUTOUT_MIPPED or CUTOUT. Override getCollisionShape and return your own VoxelShape value. how would I override those though, what are the return values etc? also, what is a VoxelShape value? Edited August 27, 20196 yr by MrNoodles75
August 27, 20196 yr 2 minutes ago, MrNoodles75 said: how would I override those though They are methods in the block class. If you don't know what overriding is learn Java from another source. We don't teach Java here. 2 minutes ago, MrNoodles75 said: what are the return values etc? If you look at the method you would know... 3 minutes ago, MrNoodles75 said: what is a VoxelShape value? A VoxelShape value is an instance of the VoxelShape class... VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 thank you, but I don't understand how to create a VoxelShape Value
August 27, 20196 yr 3 minutes ago, MrNoodles75 said: but I don't understand how to create a VoxelShape Value Then you must be using 1.12? Then it's override Block#getCollisionBoundingBox and return your own AxisAlignedBB value. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 7 minutes ago, Animefan8888 said: Then you must be using 1.12? Then it's override Block#getCollisionBoundingBox and return your own AxisAlignedBB value. I just don't understand how to do it, I am using 1.14.3 also, it throughs an error when I override getCollisionShape Edited August 27, 20196 yr by MrNoodles75
August 27, 20196 yr Just now, MrNoodles75 said: how to do it, I am using 1.14.3 If you do a little looking you'll discover the VoxelShapes class that has the create methods for VoxelShape objects. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 it throughs an error when I override getCollisionShape it says method does not Override it's superclass @Override public VoxelShape getCollisionShape(IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return VoxelShapes.create(new AxisAlignedBB(0.125, 0, 0.125, 0.875, 2, 0.875)); } Edited August 27, 20196 yr by MrNoodles75
August 27, 20196 yr 3 minutes ago, MrNoodles75 said: it says method does not Override it's superclass That's a Java error not a forge error. Please look it up. If eclipse ever yells at you with a red underline that is a Java error. Don't ask about those here. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author 2 minutes ago, Animefan8888 said: That's a Java error not a forge error. Please look it up. If eclipse ever yells at you with a red underline that is a Java error. Don't ask about those here. well it won't let me run the mod if I runClient it says @Override ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error > Task :compileJava FAILED
August 27, 20196 yr Just now, MrNoodles75 said: well it won't let me run the mod if I runClient it says Check this out. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 8 minutes ago, Animefan8888 said: Check this out. so if I remove the @Override I should be fine? because i tried that and it didn't work.
August 27, 20196 yr no that is not how java works https://stackoverflow.com/questions/94361/when-do-you-use-javas-override-annotation-and-why Edited August 27, 20196 yr by loordgek
August 27, 20196 yr Author wait I think I fixed it before I was Overriding getCollisionShape from BlockState.java when I should have done it from Block.java
August 27, 20196 yr 1 minute ago, MrNoodles75 said: so if I remove the @Override I should be fine? No...why doesn't the internet tell you why the error is caused. I'm kinda disappointed in it. The problem is your method signature is wrong. Look in the Block class and find the method called getCollisionShape VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author 9 minutes ago, Animefan8888 said: No...why doesn't the internet tell you why the error is caused. I'm kinda disappointed in it. The problem is your method signature is wrong. Look in the Block class and find the method called getCollisionShape Yes, That's what I was saying, in Block.java the parameters are: @Deprecated public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { } when I was using public VoxelShape getCollisionShape(IBlockReader worldIn, BlockPos pos, ISelectionContext context) { } and it worked! it affected the boundaries, of course, it still looks like a block(those little black lines that show the boundaries) but it's not. Edited August 27, 20196 yr by MrNoodles75
August 27, 20196 yr 2 minutes ago, MrNoodles75 said: of course, it still looks like a block but it's not. Use a different create method then, VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 13 minutes ago, Animefan8888 said: Use a different create method then, I used another one but it still shows those black lines as if it were a block Edited August 27, 20196 yr by MrNoodles75
August 27, 20196 yr 4 minutes ago, MrNoodles75 said: I used another one but it still shows those black lines as if it were a block You also need to override getRaytraceShape VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 9 minutes ago, Animefan8888 said: You also need to override getRaytraceShape I did @Override public VoxelShape getRaytraceShape(BlockState state, IBlockReader worldIn, BlockPos pos) { return VoxelShapes.create(blocksize); } but it does not work public static AxisAlignedBB blocksize = new AxisAlignedBB(0.500, 0.600, 0.500, 0.125, 0, 0.125); Edited August 27, 20196 yr by MrNoodles75
August 27, 20196 yr 9 minutes ago, MrNoodles75 said: but it does not work What does this mean? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 2 minutes ago, Animefan8888 said: What does this mean? it means the thin black lines that indicate the block boundaries still make the block look like a full-sized block when it should look like a block with custom boundaries it looks like this:
August 27, 20196 yr 3 minutes ago, MrNoodles75 said: it means the thin black lines that indicate the block boundaries still make the block look like a full-sized block when it should look like a block with custom boundaries There is also another method apparently, I'm not sure why Minecraft decided it needed 4 different Shape methods for the Block. You can actually just override getShape and it will be called in all the other shape methods (getCollisionShape, getRenderShape, getRaytraceShape) VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 27, 20196 yr Author @Animefan8888 7 minutes ago, Animefan8888 said: There is also another method apparently, I'm not sure why Minecraft decided it needed 4 different Shape methods for the Block. You can actually just override getShape and it will be called in all the other shape methods (getCollisionShape, getRenderShape, getRaytraceShape) It Works!!! Thank You!
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.