@Override protected int getNumAugmentSlots(int level) { return NUM_AUGMENTS[MathHelper.clamp(level, CoreProps.LEVEL_MIN, CoreProps.LEVEL_MAX)]; }
public static int getEntityFacingCardinal(EntityLivingBase living) { int quadrant = cofh.core.util.helpers.MathHelper.floor(living.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; switch (quadrant) { case 0: return 2; case 1: return 5; case 2: return 3; default: return 4; } }
@Override public int getScaledSpeed(int scale) { if (!isActive) { return 0; } return MathHelper.round(scale * boostTime / BOOST_TIME); }
this.motionZ *= 0.699999988079071D; BlockPos posFloor = new BlockPos(MathHelper.floor(posX), MathHelper.floor(posY), MathHelper.floor(posZ)); BlockPos posCeli = new BlockPos(MathHelper.ceil(posX), MathHelper.ceil(posY), MathHelper.ceil(posZ)); if (this.particleGravity > 0) { double d0 = MathHelper.floor(this.posY) + 1 - BlockLiquid.getLiquidHeightPercent(state.getBlock().getMetaFromState(state)); if (this.posY < d0) { this.setExpired(); double d0 = MathHelper.ceil(this.posY) + 1 - BlockLiquid.getLiquidHeightPercent(state.getBlock().getMetaFromState(state)); if (this.posY > d0) { this.setExpired();
public static int approachExpI(int a, int b, double ratio) { int r = (int) Math.round(approachExp(a, b, ratio)); return r == a ? b : r; }
@Override public void update() { getNumPlayers(); if (numUsingPlayers > 0 && !world.isRemote && world.getTotalWorldTime() % 200 == 0) { world.addBlockEvent(pos, getBlockType(), 1, numUsingPlayers); } prevLidAngle = lidAngle; lidAngle = MathHelper.approachLinear(lidAngle, numUsingPlayers > 0 ? 1F : 0F, 0.1F); if (prevLidAngle >= 0.5 && lidAngle < 0.5) { world.playSound(null, pos, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); } else if (prevLidAngle == 0 && lidAngle > 0) { world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); } }
@Override protected int getPlayerInventoryVerticalOffset() { return 30 + 18 * MathHelper.clamp(storageIndex, 2, 9); }
@Override public int getScaledSpeed(int scale) { if (!isActive) { return 0; } return MathHelper.round(scale * boostTime / boostCycles); }
@Override protected int getPlayerInventoryVerticalOffset() { return 30 + 18 * MathHelper.clamp(storageIndex, 2, 9); }
case DOWN: case UP: int facing = MathHelper.floor(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; if (facing % 2 == 0) { harvestPos = new BlockPos(x, y, z - 1);
@Override public int getScaledSpeed(int scale) { if (!isActive) { return 0; } return MathHelper.round(scale * boostTime / boostCycles); }
@Override protected int getNumAugmentSlots(int level) { return numAugments[MathHelper.clamp(level, CoreProps.LEVEL_MIN, CoreProps.LEVEL_MAX)]; }
case DOWN: case UP: int facing = MathHelper.floor(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; if (facing % 2 == 0) { adjPos = new BlockPos(x, y, z - 1);
protected int getScaled() { if (storage.getMaxEnergyStored() <= 0) { return sizeY; } long fraction = (long) storage.getEnergyStored() * sizeY / storage.getMaxEnergyStored(); return alwaysShowMinimum && storage.getEnergyStored() > 0 ? Math.max(1, MathHelper.round(fraction)) : MathHelper.round(fraction); }
@Override public float transformY(float dx, float dy) { return MathHelper.clamp(dy, y0, y1); }
public int getScaledEnergyStored(int scale) { return MathHelper.round((long) energyStorage.getEnergyStored() * scale / getMaxCapacity(level, enchantHolding)); }
@Override public float transformX(float dx, float dy) { return MathHelper.clamp(dx, x0, x1); }