Java Code Examples for net.minecraft.util.Vec3#lengthVector()
The following examples show how to use
net.minecraft.util.Vec3#lengthVector() .
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: EntityTrackUpgradeHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private boolean isEntityWithinPlayerFOV(EntityPlayer player, Entity entity){ // code used from the Enderman player looking code. Vec3 vec3 = player.getLook(1.0F).normalize(); Vec3 vec31 = Vec3.createVectorHelper(entity.posX - player.posX, entity.boundingBox.minY + entity.height / 2.0F - (player.posY + player.getEyeHeight()), entity.posZ - player.posZ); double d0 = vec31.lengthVector(); vec31 = vec31.normalize(); double d1 = vec3.dotProduct(vec31); return d1 > 1.0D - 2.5D / d0; // return d1 > 1.0D - 0.025D / d0; }
Example 2
Source File: RenderTarget.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private boolean isPlayerLookingAtTarget(){ // code used from the Enderman player looking code. EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer; World world = FMLClientHandler.instance().getClient().theWorld; Vec3 vec3 = player.getLook(1.0F).normalize(); Vec3 vec31 = Vec3.createVectorHelper(entity.posX - player.posX, entity.boundingBox.minY + entity.height / 2.0F - (player.posY + player.getEyeHeight()), entity.posZ - player.posZ); double d0 = vec31.lengthVector(); vec31 = vec31.normalize(); double d1 = vec3.dotProduct(vec31); return d1 > 1.0D - 0.050D / d0; }
Example 3
Source File: RenderBlockTarget.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private boolean isPlayerLookingAtTarget(){ Vec3 vec3 = player.getLook(1.0F).normalize(); Vec3 vec31 = Vec3.createVectorHelper(blockX + 0.5D - player.posX, blockY + 0.5D - player.posY + player.getEyeHeight(), blockZ + 0.5D - player.posZ); double d0 = vec31.lengthVector(); vec31 = vec31.normalize(); double d1 = vec3.dotProduct(vec31); return d1 > 1.0D - 0.025D / d0; }