Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How do i make a block with a model, that it two blocks high?


Drachenbauer
 Share

Recommended Posts

Hello

i have some blocks, their models are two blocks high.

 

But if i aim at their uper half, their boundingboxes disappear.

i also cannot place blocks on top of them.

The new block appears behind them.

 

How do i make them fully act as a stack of two blocks (but still placing and destroying them as one single block)?

Link to comment
Share on other sites

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

The maximum size for a block’s bounding box is 1x1.5x1. You need multiple blocks to achieve this

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

54 minutes ago, Drachenbauer said:

but a door is two blocks kigh and can be placed as one single block.

The door is two blocks, the top half still exists as a separate block with code that causes the two halves to function as desired. It is entirely possible to use world edit to place only the top, or only the bottom, half. 

 

The same goes for the bed, cactus, reeds, and other such blocks. 

 

The reason for this has to do with things like pathfinding. Remember how animals used to perpetually try and jump over fences? That was caused by fences breaking the 1x1x1 boundary rule and the AI not having been updated to account for it. 

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Not necessarily. Block models can be up to 3x3x3.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

do i need two block-classes, one for the bottom and one for the top?

 

in the door-class i found something named "DoubleBlockHalf"

There are many positions in that file, wich use this.

But i´m not shure, wich of them i need to reproduce for the most basic usage of this...

Edited by Drachenbauer
Link to comment
Share on other sites

You just need 2 blocks in the world, how you implement it is completely up to you 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

The details of the implement are simple. Override all methods that are called when a block is destroyed OR a block near a block is destroyed and handle removing both blocks (be careful not to go into an infinite loop). In your item block place method, place down your second block.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

That’s up to how you decide to implement it

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

3 hours ago, Cadiboo said:

Override all methods that are called when a block is destroyed OR a block near a block is destroyed and handle removing both blocks (be careful not to go into an infinite loop). In your item block place method, place down your second block.

That’s how I would do it

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I want to have the bottom part renders the 3d model, just like it already does and the top one actually is invisible, just makes another boundingbox with slightly different size-vaules.

 

It´s a balloon, tied to a string.

So the bottom part should have a narrow boundingbox and the top a whider one.

Edited by Drachenbauer
Link to comment
Share on other sites

If that’s how you want to implement it. You could also implement it in 1 Block or in a bottom block. I personally would use a top block.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

  • 1 month later...

There are no limitations on the collisions, but for AI pathing to work, you need to have 2 separate blocks.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

But this does not tell me how to make an invisible seccond block, that appears on the onBlockPlacedBy method ontop of the block with the model.

 

I exactly mean the way how to make a block, that adds voxelshapes, but no visible model.

Edited by Drachenbauer
Link to comment
Share on other sites

You can use World#setBlockState to place the 2nd block, and just have your 2nd block have an empty model with the particle texture being the same as your 1st blocks model. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

  • 3 months later...
1 hour ago, Drachenbauer said:

How do i check, if there is enough space (one block of air above the choosen position) for the model, bevor placing?

 

And how exactly do i use World#setBlockState (and how do i find the position above the first block)?

You could use World#isAirBlock. To get the position above you simply can call .up() on the original blocks position to translate it up by 1.

World#setBlockState will take in the state to place and the position to place it at. EX:

world.setBlockState(pos, Blocks.STONE_BRICKS.getDefaultState())

If you were setting a state property like direction you could do it here, example with furnace:

world.setBlockState(pos, Blocks.FURNACE.getDefaultState().with(FurnaceBlock.FACING, Direction.NORTH))

 

Link to comment
Share on other sites

Now i have this:

    @Override
    public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
            ItemStack stack)
    {
        worldIn.setBlockState(pos.up(), AngryBirdsBlocks.balloon_block_top.getDefaultState());
        super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
    }
    
    @Override
    public void onBlockHarvested(World worldIn, BlockPos pos, BlockState state, PlayerEntity player)
    {
        worldIn.setBlockState(pos.up(), Blocks.AIR.getDefaultState());
        super.onBlockHarvested(worldIn, pos, state, player);
    }

 

But i ned a third method, one, that is called bevore i cam place the bottom half and if i try to place it ina just one block tall gap (where the player is unable to enter), it should not be placed (like try to place a bed, where it has not enough room).

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.

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

 Share




×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.