本文整理了Java中net.minecraft.world.World.getTotalWorldTime()
方法的一些代码示例,展示了World.getTotalWorldTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getTotalWorldTime()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getTotalWorldTime
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public boolean isCellBlinking( final int slot )
{
final long now = this.world.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
return false;
}
return ( ( this.state >> ( slot * 3 + 2 ) ) & 0x01 ) == 0x01;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public void blinkCell( final int slot )
{
final long now = this.world.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
this.state = 0;
}
this.lastStateChange = now;
this.state |= 1 << ( slot * 3 + 2 );
this.recalculateDisplay();
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
protected boolean readFromStream( final ByteBuf data ) throws IOException
{
final boolean c = super.readFromStream( data );
final int oldState = this.state;
this.state = data.readByte();
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
this.lastStateChange = this.world.getTotalWorldTime();
return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || c;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
protected void writeToStream( final ByteBuf data ) throws IOException
{
super.writeToStream( data );
if( this.world.getTotalWorldTime() - this.lastStateChange > 8 )
{
this.state = 0;
}
else
{
this.state &= 0x24924924; // just keep the blinks...
}
for( int x = 0; x < this.getCellCount(); x++ )
{
this.state |= ( this.getCellStatus( x ) << ( 3 * x ) );
}
if( this.isPowered() )
{
this.state |= 0x40;
}
else
{
this.state &= ~0x40;
}
data.writeByte( this.state );
data.writeByte( this.paintedColor.ordinal() );
}
代码示例来源:origin: ldtteam/minecolonies
/**
* Should the barbs despawn.
*
* @return true if so.
*/
private boolean shouldDespawn()
{
return worldTimeAtSpawn != 0 && (world.getTotalWorldTime() - worldTimeAtSpawn) >= TICKS_TO_DESPAWN;
}
代码示例来源:origin: ForestryMC/ForestryMC
public boolean hasTriggered(World world, int ticks) {
long currentTime = world.getTotalWorldTime();
if (currentTime >= ticks + startTime || startTime > currentTime) {
startTime = currentTime;
return true;
}
return false;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final long k = this.getWorld().getTotalWorldTime();
final List<NextTickListEntry> list = this.getWorld().getPendingBlockUpdates( c, false );
if( list != null )
代码示例来源:origin: ForestryMC/ForestryMC
private void markChunkUpdate(long chunkPos) {
if (world != null) {
chunkUpdates.put(chunkPos, world.getTotalWorldTime());
}
}
代码示例来源:origin: Vazkii/Botania
private void emitParticles(ItemStack stack, IManaSpreader spreader, boolean redstone) {
float rotationYaw = -(spreader.getRotationX() + 90F);
float rotationPitch = spreader.getRotationY();
// Lots of EntityThrowable copypasta
float f = 0.3F;
float mx = (float) (MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D);
float mz = (float) (-(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D);
float my = (float) (MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI) * f / 2D);
int storedColor = ItemLens.getStoredColor(stack);
int hex = -1;
TileEntity tile = (TileEntity) spreader;
if(storedColor == 16) {
hex = Color.HSBtoRGB(tile.getWorld().getTotalWorldTime() * 2 % 360 / 360F, 1F, 1F);
} else if(storedColor >= 0) {
hex = EnumDyeColor.byMetadata(storedColor).colorValue;
}
float r = ((hex & 0xFF0000) >> 16) / 255F;
float g = ((hex & 0xFF00) >> 8) / 255F;
float b = (hex & 0xFF) / 255F;
Botania.proxy.wispFX(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, r, g, b, 0.4F, mx, my, mz);
}
代码示例来源:origin: SleepyTrousers/EnderIO
private boolean recievedRfThisTick() {
if (recievedTicks == null || recievedTicks.get(side) == null || bundle == null) {
return false;
}
long curTick = getBundle().getBundleworld().getTotalWorldTime();
long recT = recievedTicks.get(side);
if (curTick - recT <= 5) {
return true;
}
return false;
}
代码示例来源:origin: Vazkii/Quark
@SideOnly(Side.CLIENT)
private double wobble(World worldIn, double angle) {
if(worldIn.getTotalWorldTime() != lastUpdateTick) {
lastUpdateTick = worldIn.getTotalWorldTime();
double relAngle = angle - rotation;
relAngle = MathHelper.positiveModulo(relAngle + 0.5, 1.0) - 0.5;
rota += relAngle * 0.1;
rota *= 0.8;
rotation = MathHelper.positiveModulo(rotation + rota, 1.0);
}
return rotation;
}
代码示例来源:origin: SleepyTrousers/EnderIO
private boolean updateStackNBT(@Nonnull ItemStack stack, @Nonnull World world, int timeLeft) {
LAST_USED_TICK.setLong(stack, world.getTotalWorldTime());
// half a second before it costs you
if (timeLeft > (ItemConfig.rodOfReturnTicksToActivate.get() - 10)) {
return false;
}
return useEnergy(stack, timeLeft);
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public @Nonnull ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
long lastUsed = LAST_USED_TICK.getLong(stack);
if ((lastUsed < 0 || (world.getTotalWorldTime() - lastUsed) > 20) && getEnergyStored(stack) > 0) {
player.setActiveHand(hand);
}
return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void doUpdate() {
super.doUpdate();
if (world.isRemote && isActive() && world.getTotalWorldTime() % 2 == 0) {
doLoadingParticles();
}
}
代码示例来源:origin: CoFH/ThermalFoundation
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isSelected) {
if (!isEmpowered(stack)) {
return;
}
NBTTagCompound tag = entity.getEntityData();
tag.setLong(TFProps.EXPERIENCE_TIMER, entity.world.getTotalWorldTime());
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void onEntityCollidedWithBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Entity entity) {
if (!world.isRemote && entity instanceof EntityPlayerMP) {
long time = entity.world.getTotalWorldTime();
EntityPlayerMP player = (EntityPlayerMP) entity;
if (time % FluidConfig.nutrientFoodBoostDelay.get() == 0 && player.getEntityData().getLong("eioLastFoodBoost") != time) {
player.getFoodStats().addStats(1, 0.1f);
player.getEntityData().setLong("eioLastFoodBoost", time);
}
}
super.onEntityCollidedWithBlock(world, pos, state, entity);
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void updateScreen() {
super.updateScreen();
if (getTileEntity().getWorld().getTotalWorldTime() % 20 == 0) {
refreshButtons();
}
}
代码示例来源:origin: Vazkii/Quark
@Override
public void update() {
if(getWorld() != null && !getWorld().isRemote && getWorld().getTotalWorldTime() % 20L == 0L) {
blockType = getBlockType();
if(blockType instanceof BlockRainDetector)
((BlockRainDetector) blockType).updatePower(getWorld(), pos);
}
}
代码示例来源:origin: WayofTime/BloodMagic
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
if (world.isRemote || player.capabilities.isCreativeMode)
return;
boolean shouldSyphon = player.getHealth() / player.getMaxHealth() > HEALTHREQ && getStoredLP(stack) < CAPACITY;
if (shouldSyphon & world.getTotalWorldTime() % INTERVAL == 0) {
NetworkHelper.getSoulNetwork(player).hurtPlayer(player, 1.0F);
LPContainer.addLPToItem(stack, CONVERSION, CAPACITY);
}
if (getStoredLP(stack) > CAPACITY)
setStoredLP(stack, CAPACITY);
}
代码示例来源:origin: sinkillerj/ProjectE
@SubscribeEvent
public void onJump(LivingEvent.LivingJumpEvent evt)
{
if (evt.getEntityLiving() instanceof EntityPlayer && evt.getEntityLiving().getEntityWorld().isRemote)
{
lastJumpTracker.put(evt.getEntityLiving().getEntityId(), evt.getEntityLiving().getEntityWorld().getTotalWorldTime());
}
}
内容来源于网络,如有侵权,请联系作者删除!