Drachenbauer Posted August 2, 2019 Author Posted August 2, 2019 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? Quote
z0code0z Posted August 2, 2019 Posted August 2, 2019 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 Quote
Animefan8888 Posted August 2, 2019 Posted August 2, 2019 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 there as ItemStack? I'm not sure what you mean here. Please elaborate. Quote 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.
Drachenbauer Posted August 2, 2019 Author Posted August 2, 2019 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. Quote
Animefan8888 Posted August 2, 2019 Posted August 2, 2019 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. Quote 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.
Drachenbauer Posted August 2, 2019 Author Posted August 2, 2019 (edited) i will store it in the blockstate. I dont know, where exactly in the method, i have to use BlockState#get(IProperty)... I cannot find any tutorials about the pickBlock-method. Edited August 2, 2019 by Drachenbauer Quote
Drachenbauer Posted August 2, 2019 Author Posted August 2, 2019 (edited) 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 August 2, 2019 by Drachenbauer Quote
Animefan8888 Posted August 2, 2019 Posted August 2, 2019 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(...) Quote 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.
Drachenbauer Posted August 2, 2019 Author Posted August 2, 2019 (edited) 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 August 2, 2019 by Drachenbauer Quote
Drachenbauer Posted August 2, 2019 Author Posted August 2, 2019 (edited) 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 August 2, 2019 by Drachenbauer Quote
Drachenbauer Posted August 4, 2019 Author Posted August 4, 2019 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. Quote
Drachenbauer Posted August 5, 2019 Author Posted August 5, 2019 (edited) 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 August 5, 2019 by Drachenbauer Quote
Drachenbauer Posted August 8, 2019 Author Posted August 8, 2019 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 Quote
Recommended Posts
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.