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

The following examples show how to use net.minecraftforge.event.world.ChunkEvent#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: TileChunkLoadHook.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event) {
    IChunk chunk = event.getChunk();
    Map<BlockPos, TileEntity> tiles = null;
    if (chunk instanceof ChunkPrimerWrapper) {
        chunk = ((ChunkPrimerWrapper) chunk).func_217336_u();
    }
    if (chunk instanceof Chunk) {
        tiles = ((Chunk) chunk).getTileEntityMap();
    }
    if (chunk instanceof ChunkPrimer) {
        tiles = ((ChunkPrimer) chunk).getTileEntities();
    }
    if (tiles != null) {
        for (TileEntity tile : tiles.values()) {
            if (tile instanceof IChunkLoadTile) {
                ((IChunkLoadTile) tile).onChunkLoad();
            }
        }
    }
}
 
Example 2
Source File: CableTickHandler.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@SubscribeEvent
public void chunkLoadedEvent(ChunkEvent.Load event) {

	Map map = event.getChunk().getTileEntityMap();
	Iterator<Entry> iter = map.entrySet().iterator();

	try {
		while(iter.hasNext()) {
			Object obj = iter.next().getValue();

			if(obj instanceof TilePipe) {
				((TilePipe)obj).markDirty();
			}
		}
	} catch ( ConcurrentModificationException e) {
		AdvancedRocketry.logger.warn("You have been visited by the rare pepe.. I mean error of pipes not loading, this is not good, some pipe systems may not work right away.  But it's better than a corrupt world");
	}
}
 
Example 3
Source File: PlayerListener.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Keep track of recently loaded chunks for the magma boss timer.
 */
@SubscribeEvent()
public void onChunkLoad(ChunkEvent.Load e) {
    if (main.getUtils().isOnSkyblock()) {
        int x = e.getChunk().xPosition;
        int z = e.getChunk().zPosition;
        IntPair coords = new IntPair(x, z);
        recentlyLoadedChunks.add(coords);
        main.getScheduler().schedule(Scheduler.CommandType.DELETE_RECENT_CHUNK, 20, x, z);
    }
}
 
Example 4
Source File: EpisodeEventWrapper.java    From malmo with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load cev)
{
    // Pass the event on to the active episode, if there is one:
    this.stateEpisodeLock.readLock().lock();
    if (this.stateEpisode != null && this.stateEpisode.isLive())
    {
        this.stateEpisode.onChunkLoad(cev);
    }
    this.stateEpisodeLock.readLock().unlock();
}
 
Example 5
Source File: WRCoreEventHandler.java    From WirelessRedstone with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event) {
    if (event.world.isRemote)
        return;

    if (RedstoneEther.server() != null)//new world
    {
        RedstoneEther.loadServerWorld(event.world);
        RedstoneEther.server().verifyChunkTransmitters(event.world, event.getChunk().xPosition, event.getChunk().zPosition);
    }
}
 
Example 6
Source File: TileChunkLoadHook.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event) {
    List<TileEntity> list = new ArrayList<TileEntity>(event.getChunk().chunkTileEntityMap.values());
    for(TileEntity t : list)
        if(t instanceof IChunkLoadTile)
            ((IChunkLoadTile)t).onChunkLoad();
}
 
Example 7
Source File: WorldExtensionManager.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event)
{
    if(!worldMap.containsKey(event.world))
        WorldExtensionManager.onWorldLoad(event.world);
    
    createChunkExtension(event.world, event.getChunk());
    
    for(WorldExtension extension : worldMap.get(event.world))
        extension.loadChunk(event.getChunk());
}
 
Example 8
Source File: TickableWorldPipeNetEventHandler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public static void onChunkLoad(ChunkEvent.Load event) {
    getPipeNetsForWorld(event.getWorld()).forEach(it -> it.onChunkLoaded(event.getChunk()));
}
 
Example 9
Source File: ChunkLogger.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event) {
  if (chunks != null) {
  }
}
 
Example 10
Source File: StateEpisode.java    From malmo with MIT License 4 votes vote down vote up
/** Subclass should overrride this to act on chunk load events.*/
protected void onChunkLoad(ChunkEvent.Load cev) {}
 
Example 11
Source File: Events.java    From XRay-Mod with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public static void chunkLoad( ChunkEvent.Load event )
{
	Controller.requestBlockFinder( true );
}
 
Example 12
Source File: PlanetEventHandler.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@SubscribeEvent
public void chunkLoadEvent(ChunkEvent.Load event) {
}
 
Example 13
Source File: MultiblockEventHandler.java    From BeefCore with MIT License 4 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onChunkLoad(ChunkEvent.Load loadEvent) {
	Chunk chunk = loadEvent.getChunk();
	World world = loadEvent.world;
	MultiblockRegistry.onChunkLoaded(world, chunk.xPosition, chunk.zPosition);
}
 
Example 14
Source File: EventHandler.java    From mapwriter with MIT License 4 votes vote down vote up
@SubscribeEvent
public void eventChunkLoad(ChunkEvent.Load event){
	if(event.world.isRemote){
		this.mw.onChunkLoad(event.getChunk());
	}
}