package net.tropicraft.world.genlayer; import net.minecraft.world.gen.layer.IntCache; public class GenLayerTropicraftSmooth extends GenLayerTropicraft { public GenLayerTropicraftSmooth(long seed, GenLayerTropicraft parent) { super(seed); super.parent = parent; this.setZoom(1); } /** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ public int[] getInts(int x, int y, int width, int length) { int x2 = x - 1; int y2 = y - 1; int width2 = width + 2; int length2 = length + 2; int[] biomeMap = this.parent.getInts(x2, y2, width2, length2); int[] resultMap = IntCache.getIntCache(width * length); for(int j = 0; j < length; ++j) { for(int i = 0; i < width; ++i) { int backX = biomeMap[i + 0 + (j + 1) * width2]; int forwardX = biomeMap[i + 2 + (j + 1) * width2]; int backY = biomeMap[i + 1 + (j + 0) * width2]; int forwardY = biomeMap[i + 1 + (j + 2) * width2]; int cur = biomeMap[i + 1 + (j + 1) * width2]; if(backX == forwardX && backY == forwardY) { this.initChunkSeed((long) (i + x), (long) (j + y)); if(this.nextInt(2) == 0) { cur = backX; } else { cur = backY; } } else { if(backX == forwardX) { cur = backX; } if(backY == forwardY) { cur = backY; } } resultMap[i + j * width] = cur; } } return resultMap; } @Override public void setZoom(int zoom) { this.zoom = zoom; this.parent.setZoom(zoom); } }