@SubscribeEvent public void update(WorldTickEvent evt) { if(evt.world != world) { return; } if(activeCondition != null && !activeCondition.isConditionMet(world, structure, worldPos)) { return; } spawnActiveParticles(); if(spawnCondition != null && !spawnCondition.isConditionMet(world, structure, worldPos)) { return; } remainingSpawnTries = behaviour.getNumberSpawned() + behaviour.getMaxSpawnRetries(); for (int i = 0; i < behaviour.getNumberSpawned() && remainingSpawnTries > 0; ++i) { if(!trySpawnEntity()) { break; } } }
@SubscribeEvent public void onServerWorldTick(WorldTickEvent e) { if (e.phase == Phase.START) { if (e.world.provider.dimensionId == 0 && !ModRecipes.ScriptsReloaded) { //ModRecipes.initialiseAnvil(); } } else if(e.phase == Phase.END) { } }
@SubscribeEvent public void onWorldTick(WorldTickEvent event) { if(event.side == Side.SERVER && event.phase == Phase.END) { World world = event.world; if (world.provider.dimensionId == 0) { // only operate on overworld (for now) Long thisTick = world.getWorldTime(); if (instantTickDelay == 0) { if (WorldTickEvents.eventPendingInstant) { if (eventPendingInstantUsers.size() > 0) { // player instants doPlayerInstants(); } } instantTickDelay = instantTickDelayReset; } instantTickDelay--; if (thisTick % ticksPerQuartHour == 0) { // check for stuff every in-game quarter-hour globalTicker(event); } } } }
@SubscribeEvent public void handle(WorldTickEvent wte) { if(burningArrowCache.containsKey(wte.world)) { HashSet<EntityArrow> arrows=burningArrowCache.get(wte.world); synchronized(arrows) { Iterator<EntityArrow> iter=arrows.iterator(); while(iter.hasNext()) { Entity e=iter.next(); if(e.worldObj==wte.world) { try { if(arrowDotIsInGround.getBoolean(e)) { iter.remove(); int x=(int) (e.posX-.5); int y=(int) (e.posY); int z=(int) (e.posZ-.5); if(wte.world.getBlock(x,y,z) ==Blocks.air) wte.world.setBlock(x,y,z, Blocks.fire); } } catch (Exception except) { except.printStackTrace(); } } } } } }
@SubscribeEvent public void onServerWorldTick(WorldTickEvent e) { if (e.phase == Phase.START) { if (e.world.provider.dimensionId == 0) ModRecipes.initialiseAnvil(); } else if(e.phase == Phase.END) { } }
@SubscribeEvent public void onServerTick(WorldTickEvent event) { if(event.phase == Phase.START) { if(event.world.provider.dimensionId == 0 && AnvilRecipeHandler.world == null) { AnvilRecipeHandler.world = event.world; AnvilRecipeHandler.getInstance().registerRecipes(); } } }
@SubscribeEvent public void onServerWorldTick(WorldTickEvent e) { if (e.phase == Phase.START) { if (e.world.provider.dimensionId == 0 && e.world.getWorldInfo().getSeed() != wSeed) { ModRecipes.initialiseAnvil(e.world); wSeed = e.world.getWorldInfo().getSeed(); } } }
@SubscribeEvent public void onServerWorldTick(WorldTickEvent e) { if (e.phase == Phase.START) { if (e.world.provider.dimensionId == 0) TFCPPRecipes.initialiseAnvil(); } else if(e.phase == Phase.END) { } }
@SubscribeEvent public void onWorldTick(WorldTickEvent event) { if (!addWorldTick.isEmpty()) { hWorldTick.addAll(addWorldTick); addWorldTick.clear(); } for (Iterator<LIHandler> it = hWorldTick.iterator(); it.hasNext(); ) { LIHandler handler = it.next(); if (handler.isDead()) it.remove(); else handler.trigger(event); } }
@SubscribeEvent public void onTick(WorldTickEvent evt) { if(evt.phase == Phase.END) { LogisticStorage.network.get().updateFields(evt.world); } else { handleTicks(evt.world); } }
@SubscribeEvent public void worldTickEvent(WorldTickEvent event) { Profiler profiler = event.world.theProfiler; if(!(profiler instanceof CustomProfiler)) return; CustomProfiler customProfiler = (CustomProfiler)profiler; if(event.phase == Phase.START) { customProfiler.setStage(CustomProfiler.Stage.BeforeLoop); } else { customProfiler.setStage(CustomProfiler.Stage.None); } }
@SubscribeEvent public void onTick(WorldTickEvent event) { if(event.side == Side.SERVER) { if(event.phase == Phase.START) { tickStart(event.world); } else if(event.phase == Phase.END) { tickEnd(event.world); } } }
@SubscribeEvent public void onServerWorldTick(WorldTickEvent event) { World world = event.world; if(event.phase == Phase.START) { if(world.provider.dimensionId == 0 && !Recipes.areAnvilRecipesRegistered()) { Recipes.registerAnvilRecipes(world); } } }
private void globalTicker(WorldTickEvent event) { World world = event.world; Long timeOfDay = world.getWorldTime() % 24000L; if (timeOfDay == ticksDawn) { // new day has dawned WorldData.worldDay += 1; sendGlobalMessage(StatCollector.translateToLocalFormatted("text.newDayDawns", WorldData.worldDay)); WorldEvents.saveSettings(world, "global"); } doPlayerEvents(); }
@SubscribeEvent public void onServerWorldTick(WorldTickEvent event) { World world = event.world; if(event.phase == Phase.START) { if(world.provider.dimensionId == 0 && !Recipes.areAnvilRecipesRegistered()) { Recipes.registerAnvilRecipes(); } } }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void onWorldTick(WorldTickEvent event) { //Update N-API isClient so Forge mods and N-API mods get along better. event.world.isClient = event.world.isRemote; EventFactory.fireEvent(new EventWorldTicked(event.world)); }
@SubscribeEvent public void onWorldTick(WorldTickEvent event) { int dim = event.world.provider.dimensionId; if (climateUpdaters.containsKey(dim)) { climateUpdaters.get(dim).onWorldTick(event); } }
@SubscribeEvent public void tick(WorldTickEvent event) { if (event.side != Side.SERVER || event.phase != Phase.END || isReplacing) return; if (replacements == null) { replacements = new HashMap<Block, Block>(); if (EtFuturum.enableBrewingStands) replacements.put(Blocks.brewing_stand, ModBlocks.brewing_stand); if (EtFuturum.enableColourfulBeacons) replacements.put(Blocks.beacon, ModBlocks.beacon); if (EtFuturum.enableEnchants) replacements.put(Blocks.enchanting_table, ModBlocks.enchantment_table); if (EtFuturum.enableInvertedDaylightSensor) replacements.put(Blocks.daylight_detector, ModBlocks.daylight_sensor); } if (replacements.isEmpty()) return; isReplacing = true; World world = event.world; for (int i = 0; i < world.loadedTileEntityList.size(); i++) { TileEntity tile = (TileEntity) world.loadedTileEntityList.get(i); int x = tile.xCoord; int y = tile.yCoord; int z = tile.zCoord; Block replacement = replacements.get(world.getBlock(x, y, z)); if (replacement != null && ((IConfigurable) replacement).isEnabled()) { NBTTagCompound nbt = new NBTTagCompound(); tile.writeToNBT(nbt); if (tile instanceof IInventory) { IInventory invt = (IInventory) tile; for (int j = 0; j < invt.getSizeInventory(); j++) invt.setInventorySlotContents(j, null); } world.setBlock(x, y, z, replacement); TileEntity newTile = world.getTileEntity(x, y, z); newTile.readFromNBT(nbt); break; } } isReplacing = false; }
@SubscribeEvent public void onWorldTickEvent(final WorldTickEvent event) { if (event.side == Side.SERVER && event.phase == Phase.END && doMerge()) { mergeItems(event.world); } }
@SubscribeEvent public void onWorldTick(WorldTickEvent event) { if (event.phase == Phase.START) { final WorldServer world = (WorldServer) event.world; if (world.provider instanceof MothershipWorldProvider) { // ((MothershipWorldProvider)world.provider).update(); final Object[] entityList = world.loadedEntityList.toArray(); for (final Object o : entityList) { if (o instanceof Entity) { final Entity e = (Entity) o; // failsafe? if (e.worldObj.provider instanceof MothershipWorldProvider) { if(e.posY < 0) { CelestialBody parent = ((MothershipWorldProvider)e.worldObj.provider).getParent(); if(parent == null) { // jumped off mid-transit if(e instanceof EntityLivingBase) { ((EntityLivingBase)e).attackEntityFrom(DamageSourceAR.dsFallOffShip, 9001); } else { e.worldObj.removeEntity(e); } } else { if(!parent.getReachable() || (parent.getTierRequirement() > AmunRa.config.mothershipMaxTier)) { // crash into if(e instanceof EntityLivingBase) { ((EntityLivingBase)e).attackEntityFrom(DamageSourceAR.getDSCrashIntoPlanet(parent), 9001); } else { e.worldObj.removeEntity(e); } } else { if(e instanceof EntityPlayerMP && e.ridingEntity instanceof EntityShuttle) { sendPlayerInShuttleToPlanet((EntityPlayerMP)e, (EntityShuttle)e.ridingEntity, world, parent.getDimensionID()); } else if(e instanceof EntityShuttle && e.riddenByEntity instanceof EntityPlayerMP) { sendPlayerInShuttleToPlanet((EntityPlayerMP)e.riddenByEntity, (EntityShuttle)e, world, parent.getDimensionID()); } else { // go there naked, as GC intended WorldUtil.transferEntityToDimension(e, parent.getDimensionID(), world, false, null); } } } } else { // if(e.posY < 0) { if(e instanceof EntityAutoRocket) { EntityAutoRocket rocket = (EntityAutoRocket)e; MothershipWorldProvider msProvider = (MothershipWorldProvider)e.worldObj.provider; if(msProvider.isInTransit()) { if(rocket.launchPhase == EnumLaunchPhase.IGNITED.ordinal()) { rocket.cancelLaunch(); } else if(rocket.launchPhase == EnumLaunchPhase.LAUNCHED.ordinal()) { if(rocket instanceof EntityShuttle) { ((EntityShuttle)rocket).setLanding(); } else { rocket.dropShipAsItem(); rocket.setDead(); } } } } } } // if (e.worldObj.provider instanceof MothershipWorldProvider) } // if (o instanceof Entity) } // for (final Object o : entityList) } // if (world.provider instanceof MothershipWorldProvider) } // (event.phase == Phase.START) }