Jump to content

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


Drachenbauer

Recommended Posts

Ok, now i found this:

    @Override
    public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player)
    {
        return new ItemStack(AngryBirdsBlocks.balloon_block);
    }

But how do i add the color of the placed block to the ItemStack, if i finished the blockcolors later?

And for my other blocks, how do i check a specific position to return the block there as ItemStack?

Link to comment
Share on other sites

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

i dont really know how to help ya, but your source code helped me understand the way forge works alot better than most tutorials and docs simply cuz you kept most of it in the main file rather than like 5 different files, so just wanted to say thanks

Link to comment
Share on other sites

52 minutes ago, Drachenbauer said:

But how do i add the color of the placed block to the ItemStack, if i finished the blockcolors later?

You have access to the block state.

ย 

54 minutes ago, Drachenbauer said:

And for my other blocks, how do i check a specific position to return the block t๏ปฟhere as ItemStack?

I'm not sure what you mean here. Please elaborate.

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.

Link to comment
Share on other sites

17 minutes ago, Animefan8888 said:

You have access to the block state.

ย 

I'm not sure what you mean here. Please elaborate.

My slingshot-block has invisible blocks at both sides, wich i use for both slingshot-models.

So they should scheck wich of the two different slingshot-blocks is located next to them in the direction indicated by the rotation of the model.

I know how to use theese directions in setBlockState, but i donยดt know, how to use this in the pickBlock-method.

Link to comment
Share on other sites

2 minutes ago, Drachenbauer said:

I'm not sure what you mean here. Please elaborate. ๏ปฟ

If you store the blocks color in the BlockState you can get it from the BlockState you are given in the parameters. If you are storing it in a TileEntity you can get the TileEntity by doing world.getTileEntity(...)

ย 

5 minutes ago, Drachenbauer said:

My slingshot-block has invisible blocks at both sides, wich i use for both slingshot-models.

So they should scheck wich of the two different slingshot-blocks is located next to them in the direction indicated by the rotation of the model.

I know how to use theese directions in setBlockState, but i donยดt know, how to use this in the pickBlock-method.

Umm if you store the value in the BlockState you can use BlockState#get(IProperty) to get the 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.

Link to comment
Share on other sites

Actually i have this:

    @Override
    public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player)
    {
        return new ItemStack(AngryBirdsBlocks.balloon_block);
    }

But i need something to replace the blockname, that i can navigate to the already placed main-block of the construct, using the pos-value, to get access to itยดs specific blockstates.

And i need a way to access theese blockstates (i donยดt know, where to insert BlockState#get(IProperty)).

Every time, i try something about blockstates inside the brachets behind "ItemStack", it changes the type of the whoole content to something (maybe BlockState), that does not fit there

Edited by Drachenbauer
Link to comment
Share on other sites

2 minutes ago, Drachenbauer said:

And i need a way to access theese blockstates (i donยดt know, where to insert BlockState#get(IProperty)).

2 minutes ago, Drachenbauer said:

BlockState state

state.get(...)

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.

Link to comment
Share on other sites

I find no way to insert " state.get(...) " in this line.

And i also think, here "state" is the BlockState from the block, that holds this codt, not from the other block, that should be copyed as an item.

Sample:

The code is in the top-block of the balloon, but i want a way to access the Blockstate of itยดs already placed bottom block by using "pos.down()" to get a correct colored copy of it.

ย 

for short:

I need " pos.down() " andย " state.get(...) ", but i find no way to assemble them to a line of code, that works here.

Edited by Drachenbauer
Link to comment
Share on other sites

Now i found " getItem ", that includes all needed contents and fitยดs behind "return".

But itยดs deprecated and does not give me the pos down block.

What is the actual replacement for it?

ย 

Now i have this:

    @Override
    public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player)
    {
        return super.getPickBlock(state, target, world, pos.down(), player);
    }

But i donยดt get the bottom block...

I thaught, if iย  add down to the position, it will give the block below this one.

But this doesnยดt happen.

Why not?

Edited by Drachenbauer
Link to comment
Share on other sites

I still found no way to get the block below te one with the pickBlock-action, i try to write, by using " pos.down() " andย " state.get(...) " .

I really need help for the exact setup of the code-line, that i have to place in the method.

I found no tutorial, how to do this.

Link to comment
Share on other sites

I tryad around very much on "getPickBlock" without success.

with

Return new ItemStack(...);

i found no way to use " pos.down() " andย " state.get(...) ".

And with

return getItem (...);

and

return super.getPickBlock(...);

I can put in " pos.down() " andย " state.get(...) ", but it does not have any effect.

I get no item and in the console a warning appears:

[Client thread/WARN] [ne.mi.co.ForgeHooks/]: Picking on: [BLOCK] angrybirdsmod:balloon_block_top gave null item

ย 

ย I think, if anyone found a way to get this getPickBlock-thing to work, the best way is, to put the whoole method with itยดs content here.

Edited by Drachenbauer
Link to comment
Share on other sites

Iยดm still waiting for a solution:

For each block of a multible-block-model, i just created, the pickBlock-function should give a copy of the main-block (the one with the BlockItem) with itยดs actual color-blockstate.

Actually i can get a copy of the BlockItem (main-block) only by using the pickBlock-click on the main-block of the model, but not on the other part-blocks.

I still naad a way to get a block by position and then get itยดs property for the BlockItem

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