public static Direction entityLivingHorizontalViewDirection(EntityLivingBase entityLiving) { int dirx = MathHelper.floor_double((double) (entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (dirx == 3) return Direction.XP; if (dirx == 0) return Direction.ZP; if (dirx == 1) return Direction.XN; return Direction.ZN; }
public static void SetVolume(float volume) { Volume = MathHelper.clamp_float(volume, 0, 1); } public static float GetVolume()
/** * Sets the vertical location where the potion timers are rendered. * @param y * @return the new y location */ public static int SetVerticalLocation(int y) { potionLocY = MathHelper.clamp_int(y, 0, mc.displayHeight); return potionLocY; }
public void rotateAroundZ(Vec3 v, float par1) { float f1 = MathHelper.cos(par1); float f2 = MathHelper.sin(par1); double d0 = v.xCoord * (double) f1 + v.yCoord * (double) f2; double d1 = v.yCoord * (double) f1 - v.xCoord * (double) f2; double d2 = v.zCoord; v.xCoord = d0; v.yCoord = d1; v.zCoord = d2; }
float sin = MathHelper.sin(alphaX); float cos = MathHelper.cos(alphaX); float sin = MathHelper.sin(alphaY); float cos = MathHelper.cos(alphaY); float xFloor = MathHelper.floor_float(x); float yFloor = MathHelper.floor_float(y); float zFloor = MathHelper.floor_float(z);
float xFloor = MathHelper.floor_float(x); float yFloor = MathHelper.floor_float(y); float zFloor = MathHelper.floor_float(z);
i1 = Math.round((float) i1 * MathHelper.cos(f));
@Override protected void onImpact(MovingObjectPosition mop) { if (!inGround) { for (int l = 0; l < 4; ++l) { worldObj.spawnParticle(EnumParticleTypes.CRIT, posX, posY, posZ, 0.0D, 0.0D, 0.0D); } } if (mop.entityHit != null && !inGround) { mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 2.0F); } else { this.motionX = (double)((float)(mop.hitVec.xCoord - this.posX)); this.motionY = (double)((float)(mop.hitVec.yCoord - this.posY)); this.motionZ = (double)((float)(mop.hitVec.zCoord - this.posZ)); float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / (double) f2 * 0.05000000074505806D; this.posY -= this.motionY / (double) f2 * 0.05000000074505806D; this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D; inGround = true; } if (!worldObj.isRemote) { //setDead(); } }
@Override public void process(double time) { energy -= powerResistor.getP() * time; if (inventory.getStackInSlot(EggIncubatorContainer.EggSlotId) != null) { descriptor.setState(powerResistor, true); if (energy <= 0) { inventory.decrStackSize(EggIncubatorContainer.EggSlotId, 1); EntityChicken chicken = new EntityChicken(node.coordonate.world()); chicken.setGrowingAge(-24000); EntityLiving entityliving = (EntityLiving) chicken; entityliving.setLocationAndAngles(node.coordonate.x + 0.5, node.coordonate.y + 0.5, node.coordonate.z + 0.5, MathHelper.wrapAngleTo180_float(node.coordonate.world().rand.nextFloat() * 360.0F), 0.0F); entityliving.rotationYawHead = entityliving.rotationYaw; entityliving.renderYawOffset = entityliving.rotationYaw; //entityliving.func_110161_a((EntityLivingData)null); 1.6.4 node.coordonate.world().spawnEntityInWorld(entityliving); entityliving.playLivingSound(); //node.coordonate.world().spawnEntityInWorld()); resetEnergy(); needPublish(); } } else { descriptor.setState(powerResistor, false); resetEnergy(); } if (Math.abs(powerLoad.getU() - lastVoltagePublish) / descriptor.nominalVoltage > 0.1) needPublish(); }
public static Direction entityLivingViewDirection(EntityLivingBase entityLiving) { if (entityLiving.rotationPitch > 45) return Direction.YN; if (entityLiving.rotationPitch < -45) return Direction.YP; int dirx = MathHelper.floor_double((double) (entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (dirx == 3) return Direction.XP; if (dirx == 0) return Direction.ZP; if (dirx == 1) return Direction.XN; return Direction.ZN; }
/** * Sets the horizontal location where the potion timers are rendered. * @param x * @return the new x location */ public static int SetHorizontalLocation(int x) { infoLineLocX = MathHelper.clamp_int(x, 0, mc.displayWidth); return infoLineLocX; }
/** * Sets the alpha value of the unsafe marks * @param alpha the alpha value of the unsafe marks, must be between (0.101, 1] * @return the updated alpha value */ public float SetUnsafeOverlayTransparency(float alpha) { return unsafeOverlayTransparency = MathHelper.clamp_float(alpha, unsafeOverlayMinTransparency, unsafeOverlayMaxTransparency); } /**
public static Block getBlock(World world, double x, double y, double z) { Block block = world.getBlock(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)); return block; }
/** * Sets the vertical location where the potion timers are rendered. * @param y * @return the new y location */ public static int SetVerticalLocation(int y) { infoLineLocY = MathHelper.clamp_int(y, 0, mc.displayHeight); return infoLineLocY; } }
public static boolean isBlockLoaded(World world, double x, double y, double z) { return world.blockExists(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)); }
public static void SetLowHealthSoundThreshold(int lowHealthSoundThreshold) { LowHealthSoundThreshold = MathHelper.clamp_int(lowHealthSoundThreshold, 1, 20); } public static int GetLowHealthSoundThreshold()
protected static String CalculateBiomeForInfoLine() { int xCoord = MathHelper.floor_double(mc.thePlayer.posX); int zCoord = MathHelper.floor_double(mc.thePlayer.posZ); String biomeName = mc.theWorld.getBiomeGenForCoords(new BlockPos(xCoord, 64, zCoord)).biomeName; return EnumChatFormatting.WHITE + biomeName; }
/** * Sets the vertical location where the durability icons are rendered. * @param y * @return the new y location */ public static int SetVerticalLocation(int y) { durabalityLocY = MathHelper.clamp_int(y, 0, mc.displayHeight); equipmentLocY = durabalityLocY; return durabalityLocY; }
z += v.zCoord; Block block = world.getBlock(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)); if (block != Blocks.air && block != Eln.instance.lightBlock /*&& Block.blocksList[blockId].isOpaqueCube() == false*/) { x -= v.xCoord; Block block = world.getBlock(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)); if (block == Blocks.air || block == Eln.instance.lightBlock) { LightBlockEntity.addLight(world, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), light, 10); return;/*
/** * Sets the current draw distance. * @param newDrawDistance the new draw distance * @return the updated draw distance */ public int SetDrawDistance(int newDrawDistance) { drawDistance = MathHelper.clamp_int(newDrawDistance, minDrawDistance, maxDrawDistance); return drawDistance; }