net.minecraft.world.World.getTotalWorldTime()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(263)

本文整理了Java中net.minecraft.world.World.getTotalWorldTime()方法的一些代码示例,展示了World.getTotalWorldTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getTotalWorldTime()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getTotalWorldTime

World.getTotalWorldTime介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. public boolean isCellBlinking( final int slot )
  3. {
  4. final long now = this.world.getTotalWorldTime();
  5. if( now - this.lastStateChange > 8 )
  6. {
  7. return false;
  8. }
  9. return ( ( this.state >> ( slot * 3 + 2 ) ) & 0x01 ) == 0x01;
  10. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. public void blinkCell( final int slot )
  3. {
  4. final long now = this.world.getTotalWorldTime();
  5. if( now - this.lastStateChange > 8 )
  6. {
  7. this.state = 0;
  8. }
  9. this.lastStateChange = now;
  10. this.state |= 1 << ( slot * 3 + 2 );
  11. this.recalculateDisplay();
  12. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. protected boolean readFromStream( final ByteBuf data ) throws IOException
  3. {
  4. final boolean c = super.readFromStream( data );
  5. final int oldState = this.state;
  6. this.state = data.readByte();
  7. final AEColor oldPaintedColor = this.paintedColor;
  8. this.paintedColor = AEColor.values()[data.readByte()];
  9. this.lastStateChange = this.world.getTotalWorldTime();
  10. return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || c;
  11. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. protected void writeToStream( final ByteBuf data ) throws IOException
  3. {
  4. super.writeToStream( data );
  5. if( this.world.getTotalWorldTime() - this.lastStateChange > 8 )
  6. {
  7. this.state = 0;
  8. }
  9. else
  10. {
  11. this.state &= 0x24924924; // just keep the blinks...
  12. }
  13. for( int x = 0; x < this.getCellCount(); x++ )
  14. {
  15. this.state |= ( this.getCellStatus( x ) << ( 3 * x ) );
  16. }
  17. if( this.isPowered() )
  18. {
  19. this.state |= 0x40;
  20. }
  21. else
  22. {
  23. this.state &= ~0x40;
  24. }
  25. data.writeByte( this.state );
  26. data.writeByte( this.paintedColor.ordinal() );
  27. }

代码示例来源:origin: ldtteam/minecolonies

  1. /**
  2. * Should the barbs despawn.
  3. *
  4. * @return true if so.
  5. */
  6. private boolean shouldDespawn()
  7. {
  8. return worldTimeAtSpawn != 0 && (world.getTotalWorldTime() - worldTimeAtSpawn) >= TICKS_TO_DESPAWN;
  9. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. public boolean hasTriggered(World world, int ticks) {
  2. long currentTime = world.getTotalWorldTime();
  3. if (currentTime >= ticks + startTime || startTime > currentTime) {
  4. startTime = currentTime;
  5. return true;
  6. }
  7. return false;
  8. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. final long k = this.getWorld().getTotalWorldTime();
  2. final List<NextTickListEntry> list = this.getWorld().getPendingBlockUpdates( c, false );
  3. if( list != null )

代码示例来源:origin: ForestryMC/ForestryMC

  1. private void markChunkUpdate(long chunkPos) {
  2. if (world != null) {
  3. chunkUpdates.put(chunkPos, world.getTotalWorldTime());
  4. }
  5. }

代码示例来源:origin: Vazkii/Botania

  1. private void emitParticles(ItemStack stack, IManaSpreader spreader, boolean redstone) {
  2. float rotationYaw = -(spreader.getRotationX() + 90F);
  3. float rotationPitch = spreader.getRotationY();
  4. // Lots of EntityThrowable copypasta
  5. float f = 0.3F;
  6. float mx = (float) (MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D);
  7. float mz = (float) (-(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D);
  8. float my = (float) (MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI) * f / 2D);
  9. int storedColor = ItemLens.getStoredColor(stack);
  10. int hex = -1;
  11. TileEntity tile = (TileEntity) spreader;
  12. if(storedColor == 16) {
  13. hex = Color.HSBtoRGB(tile.getWorld().getTotalWorldTime() * 2 % 360 / 360F, 1F, 1F);
  14. } else if(storedColor >= 0) {
  15. hex = EnumDyeColor.byMetadata(storedColor).colorValue;
  16. }
  17. float r = ((hex & 0xFF0000) >> 16) / 255F;
  18. float g = ((hex & 0xFF00) >> 8) / 255F;
  19. float b = (hex & 0xFF) / 255F;
  20. 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);
  21. }

代码示例来源:origin: SleepyTrousers/EnderIO

  1. private boolean recievedRfThisTick() {
  2. if (recievedTicks == null || recievedTicks.get(side) == null || bundle == null) {
  3. return false;
  4. }
  5. long curTick = getBundle().getBundleworld().getTotalWorldTime();
  6. long recT = recievedTicks.get(side);
  7. if (curTick - recT <= 5) {
  8. return true;
  9. }
  10. return false;
  11. }

代码示例来源:origin: Vazkii/Quark

  1. @SideOnly(Side.CLIENT)
  2. private double wobble(World worldIn, double angle) {
  3. if(worldIn.getTotalWorldTime() != lastUpdateTick) {
  4. lastUpdateTick = worldIn.getTotalWorldTime();
  5. double relAngle = angle - rotation;
  6. relAngle = MathHelper.positiveModulo(relAngle + 0.5, 1.0) - 0.5;
  7. rota += relAngle * 0.1;
  8. rota *= 0.8;
  9. rotation = MathHelper.positiveModulo(rotation + rota, 1.0);
  10. }
  11. return rotation;
  12. }

代码示例来源:origin: SleepyTrousers/EnderIO

  1. private boolean updateStackNBT(@Nonnull ItemStack stack, @Nonnull World world, int timeLeft) {
  2. LAST_USED_TICK.setLong(stack, world.getTotalWorldTime());
  3. // half a second before it costs you
  4. if (timeLeft > (ItemConfig.rodOfReturnTicksToActivate.get() - 10)) {
  5. return false;
  6. }
  7. return useEnergy(stack, timeLeft);
  8. }

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public @Nonnull ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
  3. ItemStack stack = player.getHeldItem(hand);
  4. long lastUsed = LAST_USED_TICK.getLong(stack);
  5. if ((lastUsed < 0 || (world.getTotalWorldTime() - lastUsed) > 20) && getEnergyStored(stack) > 0) {
  6. player.setActiveHand(hand);
  7. }
  8. return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
  9. }

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public void doUpdate() {
  3. super.doUpdate();
  4. if (world.isRemote && isActive() && world.getTotalWorldTime() % 2 == 0) {
  5. doLoadingParticles();
  6. }
  7. }

代码示例来源:origin: CoFH/ThermalFoundation

  1. @Override
  2. public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isSelected) {
  3. if (!isEmpowered(stack)) {
  4. return;
  5. }
  6. NBTTagCompound tag = entity.getEntityData();
  7. tag.setLong(TFProps.EXPERIENCE_TIMER, entity.world.getTotalWorldTime());
  8. }

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public void onEntityCollidedWithBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Entity entity) {
  3. if (!world.isRemote && entity instanceof EntityPlayerMP) {
  4. long time = entity.world.getTotalWorldTime();
  5. EntityPlayerMP player = (EntityPlayerMP) entity;
  6. if (time % FluidConfig.nutrientFoodBoostDelay.get() == 0 && player.getEntityData().getLong("eioLastFoodBoost") != time) {
  7. player.getFoodStats().addStats(1, 0.1f);
  8. player.getEntityData().setLong("eioLastFoodBoost", time);
  9. }
  10. }
  11. super.onEntityCollidedWithBlock(world, pos, state, entity);
  12. }

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public void updateScreen() {
  3. super.updateScreen();
  4. if (getTileEntity().getWorld().getTotalWorldTime() % 20 == 0) {
  5. refreshButtons();
  6. }
  7. }

代码示例来源:origin: Vazkii/Quark

  1. @Override
  2. public void update() {
  3. if(getWorld() != null && !getWorld().isRemote && getWorld().getTotalWorldTime() % 20L == 0L) {
  4. blockType = getBlockType();
  5. if(blockType instanceof BlockRainDetector)
  6. ((BlockRainDetector) blockType).updatePower(getWorld(), pos);
  7. }
  8. }

代码示例来源:origin: WayofTime/BloodMagic

  1. @Override
  2. public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
  3. if (world.isRemote || player.capabilities.isCreativeMode)
  4. return;
  5. boolean shouldSyphon = player.getHealth() / player.getMaxHealth() > HEALTHREQ && getStoredLP(stack) < CAPACITY;
  6. if (shouldSyphon & world.getTotalWorldTime() % INTERVAL == 0) {
  7. NetworkHelper.getSoulNetwork(player).hurtPlayer(player, 1.0F);
  8. LPContainer.addLPToItem(stack, CONVERSION, CAPACITY);
  9. }
  10. if (getStoredLP(stack) > CAPACITY)
  11. setStoredLP(stack, CAPACITY);
  12. }

代码示例来源:origin: sinkillerj/ProjectE

  1. @SubscribeEvent
  2. public void onJump(LivingEvent.LivingJumpEvent evt)
  3. {
  4. if (evt.getEntityLiving() instanceof EntityPlayer && evt.getEntityLiving().getEntityWorld().isRemote)
  5. {
  6. lastJumpTracker.put(evt.getEntityLiving().getEntityId(), evt.getEntityLiving().getEntityWorld().getTotalWorldTime());
  7. }
  8. }

相关文章

World类方法