Java Code Examples for net.minecraftforge.common.DimensionManager#getIDs()

The following examples show how to use net.minecraftforge.common.DimensionManager#getIDs() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FaweForge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
public String getWorldName(net.minecraft.world.World w) {
    Integer[] ids = DimensionManager.getIDs();
    WorldServer[] worlds = DimensionManager.getWorlds();
    for (int i = 0; i < ids.length; i++) {
        if (worlds[i] == w) {
            return w.getWorldInfo().getWorldName() + ";" + ids[i];
        }
    }
    return w.getWorldInfo().getWorldName() + ";" + w.provider.getDimensionId();
}
 
Example 2
Source File: FaweForge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
public String getWorldName(net.minecraft.world.World w) {
    Integer[] ids = DimensionManager.getIDs();
    WorldServer[] worlds = DimensionManager.getWorlds();
    for (int i = 0; i < ids.length; i++) {
        if (worlds[i] == w) {
            return w.getWorldInfo().getWorldName() + ";" + ids[i];
        }
    }
    return w.getWorldInfo().getWorldName() + ";" + w.provider.dimensionId;
}
 
Example 3
Source File: MoCServerTickHandler.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
private void onTickInGame()
{
    if (MoCreatures.proxy.useCustomSpawner)
    {
    	
        for (int dimension : DimensionManager.getIDs())
        {
            WorldServer worldObj = DimensionManager.getWorld(dimension);

            if (worldObj != null && (worldObj.getWorldInfo().getWorldTime() % MoCreatures.proxy.animalSpawnTickRate == 0L)) 
            {

                int animalSpawns = 0;

                boolean spawnPassive = true;
                if (dimension == 0)
                {
                	spawnPassive = worldObj.isDaytime();
                }
                
                if (worldObj.playerEntities.size() > 0) //&& worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")
                {
                    animalSpawns = MoCreatures.myCustomSpawner.doCustomSpawning(worldObj, false, spawnPassive);
                    if (MoCreatures.proxy.debugLogging) MoCreatures.log.info("Mo'Creatures Spawned " + animalSpawns + " Creatures");// + ",  players on dimension " + dimension + " = " + playersInDimension );
                }
            }

            if (worldObj != null && (worldObj.getWorldInfo().getWorldTime() % MoCreatures.proxy.mobSpawnTickRate == 0L)) 
            {

                int mobSpawns = 0;

                if (worldObj.playerEntities.size() > 0) //&& worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")
                {
                    mobSpawns = MoCreatures.myCustomSpawner.doCustomSpawning(worldObj, worldObj.difficultySetting > 0, false);
                    if (MoCreatures.proxy.debugLogging) MoCreatures.log.info("Mo'Creatures Spawned " + mobSpawns + " Mobs");// + ",  players on dimension " + dimension + " = " + playersInDimension );
                }
            }

            if (MoCreatures.proxy.despawnVanilla && worldObj != null && (worldObj.getWorldInfo().getWorldTime() % MoCreatures.proxy.despawnTickRate == 0L))
            {
            	 
            	if (worldObj.playerEntities.size() > 0)
            	{
            		int numDespawns = MoCreatures.myCustomSpawner.despawnVanillaAnimals(worldObj);
                    if (MoCreatures.proxy.debugLogging)
                    {
                        MoCreatures.log.info("Mo'Creatures DeSpawned " + numDespawns + " Vanilla Creatures");// + ",  players on dimension " + dimension + " = " + playersInDimension);
                    }
            	}
                
            }

            worldObj = null;
        }
    }
}