@Override public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer world, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) { float f = MathHelper.ceil(entity.fallDistance - 3.0F); double d0 = Math.min(0.2F + f / 15.0F, 10.0F); if (d0 > 2.5D) { d0 = 2.5D; } int i = (int)(150.0D * d0); world.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(ModBlocks.storage.getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.ELEMENTIUM))); return true; }
public GuiComponentSideSelector(int x, int y, double scale, IBlockState blockState, TileEntity te, boolean highlightSelectedSides) { super(x, y); this.scale = scale; this.diameter = MathHelper.ceil(scale * SQRT_3); this.blockState = blockState; this.te = te; this.access = new FakeBlockAccess(blockState, te); this.highlightSelectedSides = highlightSelectedSides; }
private ContainerUi(EntityPlayerMP player, ITextComponent title, Element[] elements) { this.player = player; this.title = title; this.elements = elements; this.rows = MathHelper.ceil((double) elements.length / PADDED_WIDTH); this.resolveRows(); }
@Override public String getTextFromScore(String unlocalised, int score) { return TextHelper.localize(unlocalised + "." + Math.max(0, Math.min(9, MathHelper.ceil(score / 50)))); }
private int calcDeduction(int theoreticalReceived, double highestLoss){ return ConfigBoolValues.LASER_RELAY_LOSS.isEnabled() ? MathHelper.ceil(theoreticalReceived*(highestLoss/100)) : 0; }
@Override protected void keyTyped(char typedChar, int keyCode) throws IOException { if (keyCode == 1 && !viewing.isEmpty()) { viewing = ""; currPage = lastIndexPage; bookTotalPages = MathHelper.ceil(sections.size() / 2F) + 1; updateButtons(); } else { super.keyTyped(typedChar, keyCode); } }
@Override public void onPlayerPickupXP(PlayerPickupXpEvent event, @Nonnull ItemStack armorStack, EntityEquipmentSlot slot) { event.getOrb().xpValue = MathHelper.ceil(event.getOrb().xpValue * 1.125F); } }
@Override public void onPlayerPickupXP(PlayerPickupXpEvent event, @Nonnull ItemStack armorStack, EntityEquipmentSlot slot) { event.getOrb().xpValue = MathHelper.ceil(event.getOrb().xpValue * 1.25F); } }
public TileEntityAtomicReconstructor() { super(1, "reconstructor"); int power = ConfigIntValues.RECONSTRUCTOR_POWER.getValue(); int recieve = MathHelper.ceil(power * 0.016666F); storage = new CustomEnergyStorage(power, recieve, 0); }
@Override public double getAverageOreCount() { int segLen = MathHelper.ceil(this.clSize.mean / 8.0F) * 2; double volume = 0; for (int s = 0; s < segLen; s++) { float rad = adjustRadius(this.clSize.mean / 64.0F, (double)s / (double)segLen); volume += VolumeHelper.cylindricalVolume(1.0F, rad); } return volume; }
private int imageHeight(final int maxWidth) { return MathHelper.ceil(imageRenderer.getHeight() * scale(maxWidth)) + 4; } }
@Override public boolean shouldEscapeWaterFast() { int radiusXZ = 4; for(BlockPos pos : BlockPos.getAllInBox(MathHelper.floor(this.posX - radiusXZ), MathHelper.floor(this.posY), MathHelper.floor(this.posZ - radiusXZ), MathHelper.ceil(this.posX + radiusXZ), MathHelper.ceil(this.posY), MathHelper.ceil(this.posZ + radiusXZ))) { if(!world.getBlockState(pos).getMaterial().isLiquid()) { return false; } } return false; }
public Point getSize(IWidget parent) { int sx = -1; if (this.fracSizeX) sx = MathHelper.ceil(parent.getSize().getX() * this.sx / 100D); if (!this.fracSizeX) sx = (int) this.sx; int sy = -1; if (this.fracSizeY) sy = MathHelper.ceil(parent.getSize().getY() * this.sy / 100D); if (!this.fracSizeY) sy = (int) this.sy; return new Point(sx, sy); }
private boolean shouldDoWorkThisTick() { int impulseHopperSpeedScaled = CapacitorKey.IMPULSE_HOPPER_SPEED.get(getCapacitorData()); if (impulseHopperSpeedScaled > 0) { return shouldDoWorkThisTick(MathHelper.ceil(BASE_TICK_RATE / impulseHopperSpeedScaled)); } return false; }
@Override public List<ItemStack> onSheared(@Nonnull ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { return Collections.singletonList(new ItemStack(FoodCraftReloadedMod.getProxy().getLoaderManager().getLoader(FruitEnumLoader.class).get().getInstanceMap(ItemFruit.class).get(fruitType), MathHelper.ceil(quantityDroppedWithBonus(fortune, ((World) world).rand) * 1.5))); }
@Override public void adapt(RegionData data, int x, int z, int width, int height) { ShortRasterTile heightTile = data.getOrExcept(this.heightComponent); short[] heightBuffer = heightTile.getShortData(); for (int localZ = 0; localZ < height; localZ++) { for (int localX = 0; localX < width; localX++) { int index = localX + localZ * width; int scaledHeight = MathHelper.ceil(heightBuffer[index] * this.heightScale); heightBuffer[index] = (short) MathHelper.clamp(scaledHeight + this.heightOffset, 1, this.maxHeight); } } } }
@Override public DataView getParentView(DataView view) { Coordinate minRegionCoordinateBlock = view.getMinCoordinate().to(this.scaledState); Coordinate maxRegionCoordinateBlock = view.getMaxCoordinate().to(this.scaledState); Coordinate minRegionCoordinate = Coordinate.min(minRegionCoordinateBlock, maxRegionCoordinateBlock); Coordinate maxRegionCoordinate = Coordinate.max(minRegionCoordinateBlock, maxRegionCoordinateBlock); int minSampleX = MathHelper.floor(minRegionCoordinate.getX()) - this.lowerSampleBuffer; int minSampleY = MathHelper.floor(minRegionCoordinate.getZ()) - this.lowerSampleBuffer; int maxSampleX = MathHelper.ceil(maxRegionCoordinate.getX()) + this.upperSampleBuffer; int maxSampleY = MathHelper.ceil(maxRegionCoordinate.getZ()) + this.upperSampleBuffer; return new DataView(minSampleX, minSampleY, maxSampleX - minSampleX, maxSampleY - minSampleY); } }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { String s = I18n.format("container.pressure_cooker"); Optional.ofNullable(fluidTank.getFluid()).ifPresent(fluidStack -> { int fluidHeight = MathHelper.ceil(((float) fluidTank.getFluidAmount() / (float) fluidTank.getCapacity()) * (float) fluidBar.getHeight()); GuiUtils.renderTiledFluid(fluidBar.getX() + guiLeft, fluidBar.getY() + guiTop + (fluidBar.getHeight() - fluidHeight), fluidBar.getWidth(), fluidHeight, this.zLevel, fluidStack); }); this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 4, 4210752); this.fontRenderer.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 4, 4210752); }
public void managePowerGeneration() { float dimValue = machine.getDimensionalValue(); float chargePercent = (float) machine.charge / (float) TileEntityMachineDimensionalPylon.MAX_CHARGE; energyGenPerTick = (int) (dimValue * MAX_POWER_GEN_PER_TICK) + (int) (CHARGE_ENERGY_INCREASE * chargePercent); matterDrainPerSec = MathHelper.ceil(dimValue * 20) + (int) (CHARGE_MATTER_INCREASE * chargePercent); IMatterHandler storage = machine.getCapability(MatterOverdriveCapabilities.MATTER_HANDLER, null); if (storage.getMatterStored() >= matterDrainPerSec && machine.getEnergyStorage().getEnergyStored() < machine.getEnergyStorage().getMaxEnergyStored()) { machine.getEnergyStorage().modifyEnergyStored(energyGenPerTick); storage.modifyMatterStored(matterDrainPerSec); machine.UpdateClientPower(); } }