Jump to content

[1.9+] Replacement for Block#setBlockBoundsBasedOnState in 1.9.4


Recommended Posts

Posted (edited)

Hello everyone,

I am updating a pretty old project of mine from 1.8.9 to 1.9.4. I migrated almost everything, but I have one problem. Let me explain :

I draw a Block overlay: to do so I find first wich block I look at, but then I have to define bounding boxes to know the form thatI have to draw. So I did it with setBlockBoundsBasedOnState, but now how can I implement it in 1.9.4 since it isnt included anymore ?

 

code:

private void drawBlockOverlay (float partialTicks) {
     if (BlockOverlay.mc.gameSettings.hideGUI) {
       return;
     }
     RayTraceResult mouseOver = BlockOverlay.mc.objectMouseOver;
     if (mouseOver == null || mouseOver.typeOfHit != RayTraceResult.Type.BLOCK) {
       return;
     }
     BlockPos blockPos = mouseOver.getBlockPos();
     Block block = BlockOverlay.mc.theWorld.getBlockState(blockPos).getBlock();
     if (block == Blocks.AIR || block.getBlockState().getBaseState().getMaterial() == Material.WATER) {
       return;
     }
     
     block.setBlockBoundsBasedOnState((IBlockAccess)BlockOverlay.mc.theWorld, blockPos);

then I continue it but the other part should work fine.

Edited by KynaDev
added 1.9+ to the title
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.