Jump to content

[SOLVED][1.20.4] has someone figured out how to check if a block is solid ??


Recommended Posts

Posted (edited)

the removing of the Material class has mess up bad mi code now have to many broken things after updating mi code to 1.20.4

this are mi pipes they conect each others but to have it right i have to made a custome BlockItem 
the thing its that i need to check the block im looking at 
if its some something like grass or wheat i need to ignore and replace whit mi pipe block
but if its something like leaves then it must respect it and set the pipe above or at the side 

in x < 1.9just check the material the target block is made of 

 

  Reveal hidden contents

 in 1.20 cannot be done like this soo i was trying to make a list of solid blocks but is much work and also it don't have in account blocks from other mods  

 

 

  Reveal hidden contents

 

 

 

 

Edited by perromercenary00
solved
Posted

no thats not 
 

// ########## ########## ########## ##########
@Override
public boolean canBeReplaced(BlockState p_56373_, BlockPlaceContext p_56374_) {
return false;
}

this is the check to select if wanna reset the block or put another on top of the block 
i need something to know  what is a block made of

 

Posted

ya ya i get it

	boolean find = false;
int count = 0;
BlockState dblkstate;
BlockPos bpos = null;
BlockPos dpos = null;
for(BlockPos cursor : todos_los_blockes ){
dpos = cursor;
target.particle(cursor.getCenter());
dblkstate = warudo.getBlockState(cursor);

if( !dblkstate.canBeReplaced() ){  //<----------
//if( dblkstate .getBlock() instanceof tubo ){
find = true;
break;
}
bpos = cursor;
count ++;
}
	

for this case setting blocks i can know discrimaniting by the  canbereplaced tag 
 

 

thanks 

  • perromercenary00 changed the title to [SOLVED][1.20.4] has someone figured out how to check if a block is solid ??

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.