Java Code Examples for net.minecraft.world.World.getChunkFromChunkCoords()

The following are Jave code examples for showing how to use getChunkFromChunkCoords() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Etheric   File: InfertilityEvent.java   Source Code and License Vote up 6 votes
@Override
public void affectChunk(World world) {
	
	Chunk chunk = world.getChunkFromChunkCoords(chunkPos.x, chunkPos.z);
	
	for (int i = 0; i < chunk.getEntityLists().length; i++) {
		if (chunk.getEntityLists()[i] != null) {
			for (EntityAnimal e : chunk.getEntityLists()[i].getByClass(EntityAnimal.class)) {
				if (world.rand.nextInt(3) == 0) {
					e.addTag(TAG);
				}
			}
		}
	}

}
 
Example 2
Project: minecraft-territorialdealings   File: TerritoryHandler.java   Source Code and License Vote up 6 votes
public static boolean isChunkAdjacentToTerritory(World world, UUID factionID, Chunk chunk) 
{
	if (factionID == null) { return false; }
	if (chunk == null) { return false; }
	
	_FactionSaveData faction = saveData.getFactionMap().get(factionID);
	
	if (faction == null) { return false; }	// No faction with that ID exists.
	
	// Once round
	Chunk tempChunk = world.getChunkFromChunkCoords(chunk.xPosition + 1, chunk.zPosition);
	if (tempChunk != null && faction.isChunkClaimed(tempChunk.getChunkCoordIntPair())) { return true; }	// Checks out.
	
	tempChunk = world.getChunkFromChunkCoords(chunk.xPosition - 1, chunk.zPosition);
	if (tempChunk != null && faction.isChunkClaimed(tempChunk.getChunkCoordIntPair())) { return true; }	// Checks out.
	
	tempChunk = world.getChunkFromChunkCoords(chunk.xPosition, chunk.zPosition + 1);
	if (tempChunk != null && faction.isChunkClaimed(tempChunk.getChunkCoordIntPair())) { return true; }	// Checks out.
	
	tempChunk = world.getChunkFromChunkCoords(chunk.xPosition, chunk.zPosition - 1);
	if (tempChunk != null && faction.isChunkClaimed(tempChunk.getChunkCoordIntPair())) { return true; }	// Checks out.
	
	return false;
}
 
Example 3
Project: Zombe-Modpack   File: ZWrapper.java   Source Code and License Vote up 4 votes
public static Chunk getChunkFromBlockCoords(World world, int x, int z) {
    return world.getChunkFromChunkCoords(x >> 4, z >> 4);
}
 
Example 4
Project: Backmemed   File: TileEntityEndGateway.java   Source Code and License Vote up 4 votes
private static Chunk getChunk(World worldIn, Vec3d vec3)
{
    return worldIn.getChunkFromChunkCoords(MathHelper.floor(vec3.xCoord / 16.0D), MathHelper.floor(vec3.zCoord / 16.0D));
}
 
Example 5
Project: CustomWorldGen   File: TileEntityEndGateway.java   Source Code and License Vote up 4 votes
private static Chunk getChunk(World worldIn, Vec3d vec3)
{
    return worldIn.getChunkFromChunkCoords(MathHelper.floor_double(vec3.xCoord / 16.0D), MathHelper.floor_double(vec3.zCoord / 16.0D));
}