Created
July 10, 2017 04:15
-
-
Save dazsim/79c5bb71b20e9db4665ce77137c4c3ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB blockBounds, List list, Entity collidingEntity) { | |
// you should use blockBounds as a "mask". Only the intersection of all BoundingBoxes and blockBounds should be added | |
// (this basically means that you should offset your bounding box by the block's position) | |
// The list is the list you should add your bounding boxes to by calling list.add(AxisAlignedBoundBox); | |
// Also by sure that you add different bounding box objects for every bounding box. The bounds are NOT copied when you add | |
// it to the list so changes to the added box will be reflected in the list. Just instantiate a new AxisAlignedBoundingBox for | |
// every box you add. | |
// You may use collidingEntity to let different entities board (only players?) | |
//this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); | |
int m = world.getBlockMetadata(x, y, z); | |
System.out.println("meta = "+m); | |
switch (m) { | |
case 2: this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 0.2F); | |
case 3: this.setBlockBounds(0.0F, 0.0F, 0.8F, 1.0F, 2.0F, 1.0F); | |
case 4: this.setBlockBounds(0.8F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); | |
case 5: this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.2F, 2.0F, 1.0F); | |
} | |
super.addCollisionBoxesToList(world,x,y,z,blockBounds,list,collidingEntity); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment