Created
December 31, 2015 02:08
mapChunk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SubscribeEvent(priority=EventPriority.LOWEST) | |
public void onChunkLoad(ChunkEvent.Load event) { | |
int chunkX = event.getChunk().xPosition; | |
int chunkZ = event.getChunk().zPosition; | |
int cornerX = chunkX*16; | |
int cornerZ = chunkZ*16; | |
//System.out.println("chunk at " + chunkX + ", " + chunkZ + " getting loaded"); | |
//System.out.println("Boundries at " + cornerX + ", " + cornerZ); | |
//System.out.println("-----------------------------"); | |
RadChunk chunk = new RadChunk(chunkX,chunkZ); | |
radChunks.add(chunk); | |
for(int i = cornerX; i < cornerX+16; i++){ | |
for(int k = cornerZ; k < cornerZ+16; k++){ | |
for(int j = 0; j < 256; j++){ | |
Block sourceBlock = event.world.getBlock(i, j, k); | |
String sourceName = sourceBlock.getUnlocalizedName(); | |
int sourceMeta = event.world.getBlockMetadata(i, j, k); | |
RadObj source = RadObjects.findObj(sourceName + "/" + sourceMeta); | |
if(source != null && source.radStrength > 0 && source.radValue > 0){ | |
chunk.addLoc(new Coord3D(i,j,k)); | |
System.out.println("Found new sourceblock at " + i + ", " + j + ", " + k); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment