Java Code Examples for net.minecraft.util.math.AxisAlignedBB#getCenter()

The following examples show how to use net.minecraft.util.math.AxisAlignedBB#getCenter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JesusHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private boolean isStandingOnLiquid(EntityPlayer player)
{
	if(!isLiquidCollisionEnabled(player))
		return false;
	
	World world = WPlayer.getWorld(player);
	boolean foundLiquid = false;
	boolean foundSolid = false;
	
	// check collision boxes below player
	AxisAlignedBB playerBox = player.getEntityBoundingBox();
	playerBox = playerBox.union(playerBox.offset(0, -0.5, 0));
	// Using expand() with negative values doesn't work in 1.10.2.
	
	for(AxisAlignedBB box : world.getCollisionBoxes(player, playerBox))
	{
		BlockPos pos = new BlockPos(box.getCenter());
		Material material = BlockUtils.getMaterial(pos);
		
		if(material == Material.WATER || material == Material.LAVA)
			foundLiquid = true;
		else if(material != Material.AIR)
			foundSolid = true;
	}
	
	return foundLiquid && !foundSolid;
}
 
Example 2
Source File: ChestEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private void renderLines(Vec3d start, ArrayList<AxisAlignedBB> boxes)
{
	for(AxisAlignedBB bb : boxes)
	{
		Vec3d end = bb.getCenter();
		
		GL11.glVertex3d(WVec3d.getX(start), WVec3d.getY(start),
			WVec3d.getZ(start));
		GL11.glVertex3d(WVec3d.getX(end), WVec3d.getY(end),
			WVec3d.getZ(end));
	}
}