Example usage for net.minecraftforge.event.world WorldEvent.Load getWorld

List of usage examples for net.minecraftforge.event.world WorldEvent.Load getWorld

Introduction

In this page you can find the example usage for net.minecraftforge.event.world WorldEvent.Load getWorld.

Prototype

public IWorld getWorld() 

Source Link

Usage

From source file:blusunrize.immersiveengineering.common.util.FakePlayerUtil.java

@SubscribeEvent
public static void onLoad(WorldEvent.Load ev) {
    World world = ev.getWorld();
    if (world instanceof WorldServer)
        fakePlayerInstances.put(world, FakePlayerFactory.get((WorldServer) world, IE_PROFILE));
}

From source file:com.gmail.socraticphoenix.forge.randore.RandoresWorldEventListener.java

License:Open Source License

@SubscribeEvent
public void onWorldLoad(WorldEvent.Load ev) throws IOException {
    Logger logger = Randores.getInstance().getLogger();
    World world = ev.getWorld();
    if (!world.isRemote) {
        long seed = Randores.getRandoresSeed(world);
        if (!MaterialDefinitionRegistry.contains(seed)) {
            logger.info("Generating definitions for Randores seed: " + seed);
            List<MaterialDefinition> definitions = MaterialDefinitionGenerator
                    .makeDefinitions(MaterialDefinitionGenerator.generateColors(new Random(seed)), seed);
            MaterialDefinitionGenerator.logStatistics(definitions);
            MaterialDefinitionRegistry.put(seed, definitions);
            for (int i = 0; i < 300; i++) {
                Item.ToolMaterial toolMaterial = definitions.get(i).getToolMaterial();
                ItemArmor.ArmorMaterial armorMaterial = definitions.get(i).getArmorMaterial();
                FlexibleItemRegistry.getHoe(i).registerBacker(seed, toolMaterial);
                FlexibleItemRegistry.getSword(i).registerBacker(seed, toolMaterial);
                FlexibleItemRegistry.getAxe(i).registerBacker(seed, toolMaterial);
                FlexibleItemRegistry.getSpade(i).registerBacker(seed, toolMaterial);
                FlexibleItemRegistry.getPickaxe(i).registerBacker(seed, toolMaterial);
                FlexibleItemRegistry.getHelmet(i).registerBacker(seed, armorMaterial);
                FlexibleItemRegistry.getChestplate(i).registerBacker(seed, armorMaterial);
                FlexibleItemRegistry.getLeggings(i).registerBacker(seed, armorMaterial);
                FlexibleItemRegistry.getBoots(i).registerBacker(seed, armorMaterial);
            }/* ww  w  . ja  va 2  s  .co  m*/
        }
        this.loaded.add(seed);
    }
}

From source file:cubicchunks.CommonEventHandler.java

License:MIT License

@SubscribeEvent
public void onWorldLoad(WorldEvent.Load evt) {
    if (!(evt.getWorld().getWorldType() instanceof ICubicWorldType)) {
        return;//from ww  w.  j  a v a2s .  c  o  m
    }

    CubicChunks.LOGGER
            .info("Initializing world " + evt.getWorld() + " with type " + evt.getWorld().getWorldType());
    ICubicWorld world = (ICubicWorld) evt.getWorld();

    WorldType type = evt.getWorld().getWorldType();
    if (type instanceof ICubicWorldType) {
        WorldProvider provider = ((ICubicWorldType) type).getReplacedProviderFor(world.getProvider());
        ReflectionUtil.setFieldValueSrg(world, "field_73011_w", provider);
    }

    world.initCubicWorld();

    if (!world.isRemote()) {
        SpawnCubes.update(world);
    }
}

From source file:de.canitzp.rarmor.event.CommonEvents.java

@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
    doData(event.getWorld());
}

From source file:de.ellpeck.actuallyadditions.mod.event.CommonEvents.java

@SubscribeEvent
public void onLoad(WorldEvent.Load event) {
    WorldData.load(event.getWorld());
}

From source file:de.sanandrew.mods.turretmod.client.world.ClientWorldEventListener.java

License:Creative Commons License

@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
    event.getWorld().addEventListener(this);
}

From source file:de.sanandrew.mods.turretmod.registry.turret.GuiTcuRegistry.java

License:Creative Commons License

@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
    if (!event.getWorld().isRemote) {
        PacketRegistry.sendToAll(new PacketSyncTcuGuis());
    }//from  www.j  a  v  a2 s.  c o  m
}

From source file:de.sanandrew.mods.turretmod.util.PlayerList.java

License:Creative Commons License

@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
    if (!event.getWorld().isRemote) {
        MapStorage storage = event.getWorld().getMapStorage();
        if (storage != null) {
            PlayerList result = (PlayerList) storage.getOrLoadData(PlayerList.class, WSD_NAME);
            if (result == null) {
                result = this;
            }/*  ww w.ja v a  2s.com*/

            this.playerMap.putAll(result.playerMap);
            storage.setData(WSD_NAME, this);
            this.syncList();
        }
    }
}

From source file:hellfirepvp.astralsorcery.common.base.CelestialGatewaySystem.java

License:Open Source License

@SubscribeEvent
public void onWorldInit(WorldEvent.Load event) {
    if (startup)//from  ww  w .  j  a  v a 2  s .c  o  m
        return; //We're already loading up there.

    World world = event.getWorld();
    if (world.isRemote)
        return;

    loadWorldCache(world);
    syncToAll();
}

From source file:hellfirepvp.astralsorcery.common.event.listener.EventHandlerIO.java

License:Open Source License

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onLoad(WorldEvent.Load event) {
    World w = event.getWorld();
    int id = w.provider.getDimension();
    if (!(w.provider instanceof WorldProviderEnd) && !(w.provider instanceof WorldProviderHell)
            && !Config.weakSkyRendersWhitelist.contains(w.provider.getDimension())) {
        AstralSorcery.log.info("[AstralSorcery] Found worldProvider in Dimension " + id + " : "
                + w.provider.getClass().getName());
        w.provider = new WorldProviderBrightnessInj(w, w.provider);
        AstralSorcery.log.info(/*from  w  w w .j  a v a 2s  .  c  om*/
                "[AstralSorcery] Injected WorldProvider into dimension " + id + " (chaining old provider.)");
    }
}