Reygok

DrawBlockHighlightEvent

Jun 27th, 2015
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.04 KB | None | 0 0
  1. @SubscribeEvent
  2.     public void drawSelectionBox(DrawBlockHighlightEvent e)
  3.     {
  4.         ///*
  5.         if(e.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
  6.         {
  7.             BlockPos blockpos = e.target.getBlockPos();
  8.             World world = e.player.worldObj;
  9.             TileEntity tileEntity = world.getTileEntity(blockpos);
  10.  
  11.             if(tileEntity instanceof TileEntityTinyDirt)
  12.             {
  13.                 TileEntityTinyDirt tileEntityTinyDirt = (TileEntityTinyDirt) tileEntity;
  14.                 TinyDirt block = (TinyDirt) world.getBlockState(blockpos).getBlock();
  15.  
  16.                 if(tileEntityTinyDirt.isBot_nw())
  17.                 {
  18.                     block.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 0.5F);
  19.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  20.                 }
  21.                 if(tileEntityTinyDirt.isBot_ne())
  22.                 {
  23.                     block.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F);
  24.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  25.                 }
  26.                 if(tileEntityTinyDirt.isBot_se())
  27.                 {
  28.                     block.setBlockBounds(0.5F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
  29.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  30.                 }
  31.                 if(tileEntityTinyDirt.isBot_sw())
  32.                 {
  33.                     block.setBlockBounds(0.0F, 0.0F, 0.5F, 0.5F, 0.5F, 1.0F);
  34.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  35.                 }
  36.                 if(tileEntityTinyDirt.isTop_nw())
  37.                 {
  38.                     block.setBlockBounds(0.0F, 0.5F, 0.0F, 0.5F, 1.0F, 0.5F);
  39.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  40.                 }
  41.                 if(tileEntityTinyDirt.isTop_ne())
  42.                 {
  43.                     block.setBlockBounds(0.5F, 0.5F, 0.0F, 1.0F, 1.0F, 0.5F);
  44.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  45.                 }
  46.                 if(tileEntityTinyDirt.isTop_se())
  47.                 {
  48.                     block.setBlockBounds(0.5F, 0.5F, 0.5F, 1.0F, 1.0F, 1.0F);
  49.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  50.                 }
  51.                 if(tileEntityTinyDirt.isTop_sw())
  52.                 {
  53.                     block.setBlockBounds(0.0F, 0.5F, 0.5F, 0.5F, 1.0F, 1.0F);
  54.                     e.context.drawSelectionBox(e.player, e.target, 0, e.partialTicks);
  55.                 }
  56.                 e.setCanceled(true);
  57.  
  58.             }
  59.  
  60.             //*/
  61.         }
  62.     }
Advertisement
Add Comment
Please, Sign In to add comment