Java Code Examples for net.minecraftforge.event.world.WorldEvent#Load

The following examples show how to use net.minecraftforge.event.world.WorldEvent#Load . 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: EventHandlerPneumaticCraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event){
    if(!event.world.isRemote) {
        if(event.world.provider.dimensionId == 0) {
            GlobalVariableManager.overworld = event.world;
            event.world.loadItemData(GlobalVariableManager.class, GlobalVariableManager.DATA_KEY);
        }
    }
}
 
Example 2
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(WorldEvent.Load e) {
    if (!e.world.isRemote && e.world.provider.dimensionId == 0) {
        Gadomancy.loadModData();

        GolemEnumHelper.validateSavedMapping();
        GolemEnumHelper.reorderEnum();

        TCMazeHandler.init();
    }

    GameRules rules = e.world.getGameRules();
    rules.theGameRules.put("mobGriefing", new ValueOverride(this, String.valueOf(rules.getGameRuleBooleanValue("mobGriefing"))));
}
 
Example 3
Source File: PlanetEventHandler.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@SubscribeEvent
public void worldLoadEvent(WorldEvent.Load event) {
	if(!event.getWorld().isRemote)
		AtmosphereHandler.registerWorld(event.getWorld().provider.getDimension());
	else if(Configuration.skyOverride && event.getWorld().provider.getDimension() == 0)
		event.getWorld().provider.setSkyRenderer(new RenderPlanetarySky());
}
 
Example 4
Source File: NetworkStorage.java    From Signals with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void onWorldLoad(WorldEvent.Load event){
    if(!event.getWorld().isRemote && event.getWorld().provider.getDimension() == 0) {
        overworld = event.getWorld();
        overworld.loadData(NetworkStorage.class, DATA_KEY);
    }
}
 
Example 5
Source File: TankSynchroniser.java    From EnderStorage with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
    if (event.getWorld().isRemote()) {
        clientState = new PlayerItemTankCache();
    } else if (playerItemTankStates == null) {
        playerItemTankStates = new HashMap<>();
    }
}
 
Example 6
Source File: TofuEventLoader.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@SubscribeEvent
public void worldTick(WorldEvent.Load event) {
    String s = TofuVillageCollection.fileNameForProvider(event.getWorld().provider);

    TofuVillageCollection tofuVillageCollection = (TofuVillageCollection) event.getWorld().getPerWorldStorage().getOrLoadData(TofuVillageCollection.class, s);

    if (tofuVillageCollection == null) {
        tofuVillageCollection = new TofuVillageCollection(event.getWorld());
        event.getWorld().getPerWorldStorage().setData(s, tofuVillageCollection);
    } else {
        tofuVillageCollection.setWorldsForAll(event.getWorld());
    }
}
 
Example 7
Source File: CyberwareDataHandler.java    From Cyberware with MIT License 5 votes vote down vote up
@SubscribeEvent
public void worldLoad(WorldEvent.Load event)
{
	GameRules rules = event.getWorld().getGameRules();
	if(!rules.hasRule(KEEP_WARE_GAMERULE))
	{
		rules.addGameRule(KEEP_WARE_GAMERULE, Boolean.toString(CyberwareConfig.DEFAULT_KEEP), ValueType.BOOLEAN_VALUE);
	}
	if(!rules.hasRule(DROP_WARE_GAMERULE))
	{
		rules.addGameRule(DROP_WARE_GAMERULE, Boolean.toString(CyberwareConfig.DEFAULT_DROP), ValueType.BOOLEAN_VALUE);
	}
}
 
Example 8
Source File: YUNoMakeGoodMap.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event)
{
    //Load a 3x3 around spawn to make sure that it populates and calls our hooks.
    if (!event.getWorld().isRemote && event.getWorld() instanceof WorldServer)
    {
        WorldServer world = (WorldServer)event.getWorld();
        int spawnX = (int)(event.getWorld().getWorldInfo().getSpawnX() / world.provider.getMovementFactor() / 16);
        int spawnZ = (int)(event.getWorld().getWorldInfo().getSpawnZ() / world.provider.getMovementFactor() / 16);
        for (int x = -1; x <= 1; x++)
            for (int z = -1; z <= 1; z++)
                world.getChunkProvider().loadChunk(spawnX + x, spawnZ + z);
    }
}
 
Example 9
Source File: WRCoreEventHandler.java    From WirelessRedstone with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
    if (event.world.isRemote)
        RedstoneEther.loadClientEther(event.world);
    else
        RedstoneEther.loadServerWorld(event.world);
}
 
Example 10
Source File: WorldLoadHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event)
{
	if(event.getWorld().provider.getDimension() == 0)
	{
		Timekeeper.initialize(event.getWorld());
	}
}
 
Example 11
Source File: TickRateService.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
  timeLastTimeUpdate = -1;
  TICK_DATA.onWorldLoaded();
}
 
Example 12
Source File: WorldEventService.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
  event.getWorld().addEventListener(WORLD_LISTENER);
  MinecraftForge.EVENT_BUS.post(new WorldChangeEvent(event.getWorld()));
}
 
Example 13
Source File: LogoutSpot.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
  reset();
}
 
Example 14
Source File: EnderStorageManager.java    From EnderStorage with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
    if (event.getWorld().isRemote()) {
        reloadManager(true);
    }
}
 
Example 15
Source File: PositionRotationManager.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
  gState.setInitialized(false);
}
 
Example 16
Source File: EventHandler.java    From Signals with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event){
    event.getWorld().addEventListener(this);
}
 
Example 17
Source File: ServerHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@SubscribeEvent
public void loadEvent(WorldEvent.Load event) {
    if (!event.getWorld().isRemote) {
        NEIServerConfig.load(event.getWorld());
    }
}
 
Example 18
Source File: ForgeEventHandler.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void worldUnload(WorldEvent.Load evt) {
	Game.events().publish(new nova.core.event.WorldEvent.Load(WorldConverter.instance().toNova(evt.getWorld())));
}
 
Example 19
Source File: FakePlayerPool.java    From OpenModsLib with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load evt) {
	worldPools.put(evt.getWorld(), new WorldPool());
}
 
Example 20
Source File: ForgeEventHandler.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void worldUnload(WorldEvent.Load evt) {
	Game.events().publish(new nova.core.event.WorldEvent.Load(WorldConverter.instance().toNova(evt.world)));
}