Java 类cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent 实例源码

项目:Structures    文件:VirtualSpawnerInstance.java   
@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;
    }
  }

}
项目:TechNodefirmacraftMod    文件:STickHandler.java   
@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)
{

}
  }
项目:Imperium    文件:WorldTickEvents.java   
@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);
            }
        }
    }
}
项目:Gizmos    文件:FlamingArrows.java   
@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();
                    }
                }
            }
        }
    }
}
项目:TFCPrimitiveTech    文件:ServerTickHandler.java   
@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)
{

}
  }
项目:TFC-Tweaker    文件:ServerTickHandling.java   
@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();
        }
       }
   }
项目:TFCTech    文件:ServerTickHandler.java   
@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();
        }
    } 
}
项目:TerraFirmaProgressivePack    文件:ServerTickHandler.java   
@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)
{

}
  }
项目:LambdaLib    文件:LIFMLGameEventDispatcher.java   
@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);
    }
}
项目:Logistic-Storage    文件:TickHandler.java   
@SubscribeEvent
public void onTick(WorldTickEvent evt)
{
    if(evt.phase == Phase.END)
    {
        LogisticStorage.network.get().updateFields(evt.world);
    }
    else
    {
        handleTicks(evt.world);
    }
}
项目:TickDynamic    文件:WorldEventHandler.java   
@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);
    }
  }
项目:vsminecraft    文件:CommonWorldTickHandler.java   
@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);
        }
    }
}
项目:DecorationsTFC    文件:ServerTickHandler.java   
@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);
        }
    }
}
项目:Imperium    文件:WorldTickEvents.java   
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();
}
项目:MerchantsTFC    文件:ServerTickHandler.java   
@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);
        }
    }
}
项目:LanternsTFC    文件:ServerTickHandler.java   
@SubscribeEvent
public void onServerWorldTick(WorldTickEvent event)
{
    World world = event.world;

    if(event.phase == Phase.START)
    {
        if(world.provider.dimensionId == 0 && !Recipes.areAnvilRecipesRegistered())
        {
            Recipes.registerAnvilRecipes();
        }
    }
}
项目:N-API    文件:EventHandlerFML.java   
@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));
}
项目:DecorationsTFC    文件:ServerTickHandler.java   
@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);
        }
    }
}
项目:MeteorsMod    文件:HandlerMeteorTick.java   
@SubscribeEvent
public void onWorldTick(WorldTickEvent event) {
    int dim = event.world.provider.dimensionId;
    if (climateUpdaters.containsKey(dim)) {
        climateUpdaters.get(dim).onWorldTick(event);
    }
}
项目:connor41-etfuturum2    文件:WorldTickEventHandler.java   
@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;
}
项目:ThermalRecycling    文件:EntityItemMergeHandler.java   
@SubscribeEvent
public void onWorldTickEvent(final WorldTickEvent event) {
    if (event.side == Side.SERVER && event.phase == Phase.END && doMerge()) {
        mergeItems(event.world);
    }
}
项目:amunra    文件:TickHandlerServer.java   
@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)
}
项目:Et-Futurum    文件:WorldTickEventHandler.java   
@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;
}