Jump to content

Recommended Posts

Posted (edited)

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

2019-08-26_17_24_26.png.4399974c41219ab6f838152a5b1eeacd.png

2019-08-26_17_09_12.thumb.png.771adb13ee39386312875b078db93060.png

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

 

2019-08-26_17.09.07.png

 

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 by MrNoodles75
Topic has been Answered
Posted
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.

Posted (edited)

@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 by MrNoodles75
Posted
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.

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

Posted (edited)

@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 by MrNoodles75
Posted
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.

Posted (edited)

@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 by MrNoodles75
Posted
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.

Posted
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

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

Posted (edited)
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 by MrNoodles75
Posted (edited)

@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 by MrNoodles75
Posted

@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:

2019-08-27_15_57_54.png.b89e04cc4354da4b361c5b92da121d85.png

2019-08-27_15_57_19.png.a7a2a7c07978c57f29bd87ea82fd8058.png

2019-08-27_15_57_47.png.e3ad6778fe1340cde736bbca9df89aed.png

 

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

Posted

@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!!!

2019-08-27_16_11_57.thumb.png.cbdf3b8488520c57abc486a8917ac49b.png

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.

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.