Advertisement
Guest User

Untitled

a guest
Mar 9th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. public abstract void initColllisionBoxes();
  2.     public abstract List<CollisionBox> getCollisionBoxes(IExtendedBlockState state);
  3.    
  4.     @Override
  5.     public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState rawState, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
  6.        
  7.         AxisAlignedBB originMask = mask.offset(-pos.getX(), -pos.getY(), -pos.getZ());
  8.        
  9.         boolean eNull = collidingEntity == null;
  10.        
  11.        
  12.         IBlockState plainState = world.getBlockState(pos);
  13.         IExtendedBlockState state = (IExtendedBlockState) getExtendedState(plainState, world, pos);
  14.        
  15.         if(CatwalksMod.developmentEnvironment) initColllisionBoxes();
  16.         List<CollisionBox> boxes = getCollisionBoxes(state);
  17.        
  18.         if(boxes == null) {
  19.             Logs.error("ERROR: Collision box list null!");
  20.         }
  21.        
  22.         for (CollisionBox box : boxes) {
  23.             if(!state.getValue(box.enableProperty))
  24.                 continue;
  25.             Cuboid6 cuboid = (eNull || !collidingEntity.isSneaking()) ? box.normal : box.sneak;
  26.            
  27.             if(cuboid.aabb().intersectsWith(originMask)) {
  28.                 list.add(cuboid.aabb().offset(pos.getX(), pos.getY(), pos.getZ()));
  29.             }
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement