本文整理了Java中net.minecraft.util.math.MathHelper.ceil()
方法的一些代码示例,展示了MathHelper.ceil()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MathHelper.ceil()
方法的具体详情如下:
包路径:net.minecraft.util.math.MathHelper
类名称:MathHelper
方法名:ceil
暂无
代码示例来源:origin: Vazkii/Botania
@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;
}
代码示例来源:origin: NanamiArihara/FoodCraft-Reloaded
public void calcHealAmount() {
float sour = properties[0] * -10f;
float sweet = properties[1] * 30f;
float bitter = properties[2] * -15f;
float spice = properties[3] * 10f;
float salty = properties[4] * 5f;
setHealAmount(ceil(sour) + ceil(sweet) + ceil(bitter) + ceil(spice) + ceil(salty));
}
}
代码示例来源:origin: OpenMods/OpenModsLib
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;
}
代码示例来源:origin: gegy1000/Terrarium
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();
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
@Override
public String getTextFromScore(String unlocalised, int score) {
return TextHelper.localize(unlocalised + "." + Math.max(0, Math.min(9, MathHelper.ceil(score / 50))));
}
代码示例来源:origin: Ellpeck/ActuallyAdditions
private int calcDeduction(int theoreticalReceived, double highestLoss){
return ConfigBoolValues.LASER_RELAY_LOSS.isEnabled() ? MathHelper.ceil(theoreticalReceived*(highestLoss/100)) : 0;
}
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
@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);
}
}
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
@Override
public void onPlayerPickupXP(PlayerPickupXpEvent event, @Nonnull ItemStack armorStack, EntityEquipmentSlot slot) {
event.getOrb().xpValue = MathHelper.ceil(event.getOrb().xpValue * 1.125F);
}
}
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
@Override
public void onPlayerPickupXP(PlayerPickupXpEvent event, @Nonnull ItemStack armorStack, EntityEquipmentSlot slot) {
event.getOrb().xpValue = MathHelper.ceil(event.getOrb().xpValue * 1.25F);
}
}
代码示例来源:origin: Ellpeck/ActuallyAdditions
public TileEntityAtomicReconstructor() {
super(1, "reconstructor");
int power = ConfigIntValues.RECONSTRUCTOR_POWER.getValue();
int recieve = MathHelper.ceil(power * 0.016666F);
storage = new CustomEnergyStorage(power, recieve, 0);
}
代码示例来源:origin: lawremi/CustomOreGen
@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;
}
代码示例来源:origin: MightyPirates/TIS-3D
private int imageHeight(final int maxWidth) {
return MathHelper.ceil(imageRenderer.getHeight() * scale(maxWidth)) + 4;
}
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
@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;
}
代码示例来源:origin: TehNut/HWYLA
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);
}
代码示例来源:origin: SleepyTrousers/EnderIO
private boolean shouldDoWorkThisTick() {
int impulseHopperSpeedScaled = CapacitorKey.IMPULSE_HOPPER_SPEED.get(getCapacitorData());
if (impulseHopperSpeedScaled > 0) {
return shouldDoWorkThisTick(MathHelper.ceil(BASE_TICK_RATE / impulseHopperSpeedScaled));
}
return false;
}
代码示例来源:origin: NanamiArihara/FoodCraft-Reloaded
@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)));
}
代码示例来源:origin: gegy1000/Terrarium
@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);
}
}
}
}
代码示例来源:origin: gegy1000/Terrarium
@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);
}
}
代码示例来源:origin: NanamiArihara/FoodCraft-Reloaded
@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);
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
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();
}
}
内容来源于网络,如有侵权,请联系作者删除!