Skip to content

Instantly share code, notes, and snippets.

@Keridos
Last active August 29, 2015 14:24
Show Gist options
  • Save Keridos/a5e07df71812523ea78d to your computer and use it in GitHub Desktop.
Save Keridos/a5e07df71812523ea78d to your computer and use it in GitHub Desktop.
MinecraftForge Bounding Box Block
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
TileEntitySmallFloodlight tileEntitySmallFloodlight = (TileEntitySmallFloodlight) world.getTileEntity(x,y,z);
if (tileEntitySmallFloodlight.getRotationState()) {
this.minX = 0;
this.maxX = 0.1875;
this.minY = 0;
this.maxY = 1;
this.minZ = 0.3125;
this.maxZ = 0.6875;
} else {
this.minX = 0;
this.maxX = 0.1875;
this.minY = 0.3125;
this.maxY = 0.6875;
this.minZ = 0;
this.maxZ = 1;
}
double[] newMin = MathUtil.rotateD(minX,minY,minZ,tileEntitySmallFloodlight.getOrientation());
double[] newMax = MathUtil.rotateD(maxX,maxY,maxZ,tileEntitySmallFloodlight.getOrientation());
this.minX = newMin[0];
this.minY = newMin[1];
this.minZ = newMin[2];
this.maxX = newMax[0];
this.maxY = newMax[1];
this.maxZ = newMax[2];
return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment