Example usage for net.minecraftforge.event.world ChunkEvent.Load getChunk

List of usage examples for net.minecraftforge.event.world ChunkEvent.Load getChunk

Introduction

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

Prototype

public IChunk getChunk() 

Source Link

Usage

From source file:appeng.hooks.TickHandler.java

License:Open Source License

@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load load) {
    for (Object te : load.getChunk().chunkTileEntityMap.values()) {
        if (te instanceof AEBaseTile) {
            ((AEBaseTile) te).onChunkLoad();
        }//from   w  w w.j a va2 s .  c  o m
    }
}

From source file:appeng.server.subcommands.ChunkLogger.java

License:Open Source License

@SubscribeEvent
public void onChunkLoadEvent(ChunkEvent.Load event) {
    if (!event.world.isRemote) {
        AELog.info("Chunk Loaded:   " + event.getChunk().xPosition + ", " + event.getChunk().zPosition);
        this.displayStack();
    }// w w  w  .  java 2 s  .  c  o  m
}

From source file:com.kegare.bedrocklayer.handler.BedrockEventHooks.java

License:Minecraft Mod Public

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onChunkLoad(ChunkEvent.Load event) {
    World world = event.world;//from  ww w.j a v a  2  s  . c om

    if (world.isRemote || Config.flattenType != 0) {
        return;
    }

    Chunk chunk = event.getChunk();
    long chunkSeed = ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition)
            ^ world.provider.getDimensionId();

    if (chunk.isLoaded() && (!Config.useLayeredCache || !layeredChunks.contains(chunkSeed))) {
        for (FlattenEntry entry : flattenEntries) {
            Property prop = entry.getConfigProperty(BedrockLayerAPI.getConfig());

            if (prop == null || !prop.isBooleanValue() || prop.getBoolean()) {
                entry.flatten(chunk);
            }
        }

        if (Config.useLayeredCache) {
            layeredChunks.add(chunkSeed);
        }
    }
}

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

License:Open Source License

@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event) {
    if (!event.getWorld().isRemote) {
        Iterator<TileOreGenerator> iterator = generatorQueue.iterator();
        while (iterator.hasNext()) {
            TileOreGenerator gen = iterator.next();
            BlockPos at = gen.getPos();//  w ww  . j a  v  a2 s .c  o m
            if (event.getChunk().getPos().equals(new ChunkPos(at))) {
                event.getChunk().getTileEntityMap().put(gen.getPos(), gen);
                iterator.remove();
            }
        }
    }
}

From source file:hellfirepvp.astralsorcery.common.starlight.network.TransmissionChunkTracker.java

License:Open Source License

@SubscribeEvent
public void onChLoad(ChunkEvent.Load event) {
    TransmissionWorldHandler handle = StarlightTransmissionHandler.getInstance()
            .getWorldHandler(event.getWorld());
    if (handle != null) {
        Chunk ch = event.getChunk();
        handle.informChunkLoad(new ChunkPos(ch.xPosition, ch.zPosition));
    }/*from   www.  jav a  2s. c om*/
}

From source file:hellfirepvp.astralsorcery.common.world.retrogen.RetroGenController.java

License:Open Source License

@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event) {
    ChunkPos pos = event.getChunk().getPos();
    if (event.getWorld().isRemote || !event.getChunk().isTerrainPopulated() || retroGenActive.contains(pos))
        return;//from   w w  w.  j av  a2 s.  c o  m

    Integer chunkVersion = -1;
    if (((AnvilChunkLoader) ((WorldServer) event.getWorld()).getChunkProvider().chunkLoader)
            .chunkExists(event.getWorld(), pos.chunkXPos, pos.chunkZPos)) {
        chunkVersion = ChunkVersionController.instance.getGenerationVersion(pos);
        if (chunkVersion == null) {
            return;
        }
    }
    retroGenActive.add(pos);
    CommonProxy.worldGenerator.handleRetroGen(event.getWorld(), pos, chunkVersion);
    retroGenActive.remove(pos);
}

From source file:net.katsstuff.temporalgateway.handler.SnapshotHandler.java

License:MIT License

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onChunkLoad(ChunkEvent.Load event) {
    if (lastSnapshot != null) {
        lastSnapshot.addChunk(event.getChunk());
    }//from  ww  w  .j  a v a 2 s. c  o  m
}