本文整理汇总了Java中net.minecraft.util.math.MathHelper.floor_float方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.floor_float方法的具体用法?Java MathHelper.floor_float怎么用?Java MathHelper.floor_float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.MathHelper
的用法示例。
在下文中一共展示了MathHelper.floor_float方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
float f = (float)(rand.nextInt(3) + 4);
for (int i = 0; f > 0.5F; --i)
{
for (int j = MathHelper.floor_float(-f); j <= MathHelper.ceiling_float_int(f); ++j)
{
for (int k = MathHelper.floor_float(-f); k <= MathHelper.ceiling_float_int(f); ++k)
{
if ((float)(j * j + k * k) <= (f + 1.0F) * (f + 1.0F))
{
this.setBlockAndNotifyAdequately(worldIn, position.add(j, i, k), Blocks.END_STONE.getDefaultState());
}
}
}
f = (float)((double)f - ((double)rand.nextInt(2) + 0.5D));
}
return true;
}
示例2: SPacketSpawnObject
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public SPacketSpawnObject(Entity entityIn, int typeIn, int dataIn)
{
this.entityId = entityIn.getEntityId();
this.uniqueId = entityIn.getUniqueID();
this.x = entityIn.posX;
this.y = entityIn.posY;
this.z = entityIn.posZ;
this.pitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F);
this.yaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F);
this.type = typeIn;
this.data = dataIn;
double d0 = 3.9D;
this.speedX = (int)(MathHelper.clamp_double(entityIn.motionX, -3.9D, 3.9D) * 8000.0D);
this.speedY = (int)(MathHelper.clamp_double(entityIn.motionY, -3.9D, 3.9D) * 8000.0D);
this.speedZ = (int)(MathHelper.clamp_double(entityIn.motionZ, -3.9D, 3.9D) * 8000.0D);
}
示例3: computeStackSize
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Compute the new stack size, Returns the stack with the new size. Args : dragSlots, dragMode, dragStack,
* slotStackSize
*/
public static void computeStackSize(Set<Slot> dragSlotsIn, int dragModeIn, ItemStack stack, int slotStackSize)
{
switch (dragModeIn)
{
case 0:
stack.stackSize = MathHelper.floor_float((float)stack.stackSize / (float)dragSlotsIn.size());
break;
case 1:
stack.stackSize = 1;
break;
case 2:
stack.stackSize = stack.getMaxStackSize();
}
stack.stackSize += slotStackSize;
}
示例4: calcRedstoneFromInventory
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static int calcRedstoneFromInventory(@Nullable IInventory inv)
{
if (inv == null)
{
return 0;
}
else
{
int i = 0;
float f = 0.0F;
for (int j = 0; j < inv.getSizeInventory(); ++j)
{
ItemStack itemstack = inv.getStackInSlot(j);
if (itemstack != null)
{
f += (float)itemstack.stackSize / (float)Math.min(inv.getInventoryStackLimit(), itemstack.getMaxStackSize());
++i;
}
}
f = f / (float)inv.getSizeInventory();
return MathHelper.floor_float(f * 14.0F) + (i > 0 ? 1 : 0);
}
}
示例5: create
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/** first and last are both inclusive values (use 0, 12, 3 to create an array of [0, 3, 6, 9, 12]) */
public static BuildCraftProperty<Integer> create(String name, int first, int last, int difference) {
int actualDiff = Math.abs(difference);
int number = MathHelper.floor_float(Math.abs(first - last) / (float) actualDiff + 1);
Integer[] array = new Integer[number];
int addedDiff = actualDiff * (first > last ? -1 : 1);
int current = first;
for (int i = 0; i < array.length; i++) {
array[i] = current;
current += addedDiff;
}
return new BuildCraftProperty<Integer>(name, Integer.class, array);
}
示例6: getPotionDurationString
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static String getPotionDurationString(PotionEffect p_188410_0_, float p_188410_1_)
{
if (p_188410_0_.getIsPotionDurationMax())
{
return "**:**";
}
else
{
int i = MathHelper.floor_float((float)p_188410_0_.getDuration() * p_188410_1_);
return StringUtils.ticksToElapsedTime(i);
}
}
示例7: createCrown
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private void createCrown(World worldIn, int x, int z, int y, int p_150541_5_, Random rand)
{
int i = rand.nextInt(5) + (this.useBaseHeight ? this.baseHeight : 3);
int j = 0;
for (int k = y - i; k <= y; ++k)
{
int l = y - k;
int i1 = p_150541_5_ + MathHelper.floor_float((float)l / (float)i * 3.5F);
this.growLeavesLayerStrict(worldIn, new BlockPos(x, k, z), i1 + (l > 0 && i1 == j && (k & 1) == 0 ? 1 : 0));
j = i1;
}
}
示例8: generateLoot
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* generates loot and puts it in an inventory
*/
public void generateLoot(Collection<ItemStack> stacks, Random rand, LootContext context)
{
if (LootConditionManager.testAllConditions(this.poolConditions, rand, context))
{
int i = this.rolls.generateInt(rand) + MathHelper.floor_float(this.bonusRolls.generateFloat(rand) * context.getLuck());
for (int j = 0; j < i; ++j)
{
this.createLootRoll(stacks, rand, context);
}
}
}
示例9: EntityTrackerEntry
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public EntityTrackerEntry(Entity entityIn, int rangeIn, int maxRangeIn, int updateFrequencyIn, boolean sendVelocityUpdatesIn)
{
this.trackedEntity = entityIn;
this.range = rangeIn;
this.maxRange = maxRangeIn;
this.updateFrequency = updateFrequencyIn;
this.sendVelocityUpdates = sendVelocityUpdatesIn;
this.encodedPosX = EntityTracker.getPositionLong(entityIn.posX);
this.encodedPosY = EntityTracker.getPositionLong(entityIn.posY);
this.encodedPosZ = EntityTracker.getPositionLong(entityIn.posZ);
this.encodedRotationYaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F);
this.encodedRotationPitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F);
this.lastHeadMotion = MathHelper.floor_float(entityIn.getRotationYawHead() * 256.0F / 360.0F);
this.onGround = entityIn.onGround;
}
示例10: initProcessor
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public void initProcessor(IBlockAccess sourceIn, EntityLiving mob)
{
this.blockaccess = sourceIn;
this.entity = mob;
this.pointMap.clearMap();
this.entitySizeX = MathHelper.floor_float(mob.width + 1.0F);
this.entitySizeY = MathHelper.floor_float(mob.height + 1.0F);
this.entitySizeZ = MathHelper.floor_float(mob.width + 1.0F);
}
示例11: updateTask
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Updates the task
*/
public void updateTask()
{
double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.getEntityBoundingBox().minY, this.attackTarget.posZ);
boolean flag = this.entityHost.getEntitySenses().canSee(this.attackTarget);
if (flag)
{
++this.seeTime;
}
else
{
this.seeTime = 0;
}
if (d0 <= (double)this.maxAttackDistance && this.seeTime >= 20)
{
this.entityHost.getNavigator().clearPathEntity();
}
else
{
this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed);
}
this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F);
if (--this.rangedAttackTime == 0)
{
if (d0 > (double)this.maxAttackDistance || !flag)
{
return;
}
float f = MathHelper.sqrt_double(d0) / this.attackRadius;
float lvt_5_1_ = MathHelper.clamp_float(f, 0.1F, 1.0F);
this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, lvt_5_1_);
this.rangedAttackTime = MathHelper.floor_float(f * (float)(this.maxRangedAttackTime - this.attackIntervalMin) + (float)this.attackIntervalMin);
}
else if (this.rangedAttackTime < 0)
{
float f2 = MathHelper.sqrt_double(d0) / this.attackRadius;
this.rangedAttackTime = MathHelper.floor_float(f2 * (float)(this.maxRangedAttackTime - this.attackIntervalMin) + (float)this.attackIntervalMin);
}
}
示例12: calculateChatboxWidth
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static int calculateChatboxWidth(float scale)
{
int i = 320;
int j = 40;
return MathHelper.floor_float(scale * 280.0F + 40.0F);
}
示例13: calculateChatboxHeight
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static int calculateChatboxHeight(float scale)
{
int i = 180;
int j = 20;
return MathHelper.floor_float(scale * 160.0F + 20.0F);
}
示例14: getShort
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public short getShort()
{
return (short)(MathHelper.floor_float(this.data) & 65535);
}
示例15: getByte
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public byte getByte()
{
return (byte)(MathHelper.floor_float(this.data) & 255);
}