package jaredbgreat.climaticbiome.generation.biome;

import java.util.StringTokenizer;

import jaredbgreat.climaticbiome.generation.generator.ChunkTile;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.registries.IForgeRegistry;

public class WetDoubleBiome implements IBiomeSpecifier {
	private final int a, b, boundary;
	
	
	public WetDoubleBiome(int a, int boundary, int b) {
		this.a = a;
		this.b = b;
		this.boundary = boundary;
	}
	
	
	public WetDoubleBiome(Biome a, int boundary, Biome b) {
		this.a = Biome.getIdForBiome(a);
		this.b = Biome.getIdForBiome(b);
		this.boundary = boundary;
	}
	
	
	public WetDoubleBiome(String a, int boundary, String b, IForgeRegistry biomeReg) {
		StringTokenizer tokens = new StringTokenizer(a, ":");
		if(tokens.countTokens() < 3) {
			this.a = Biome.getIdForBiome((Biome)biomeReg.getValue(new ResourceLocation(a)));
		} else {
			this.a = Biome.getIdForBiome((Biome)biomeReg
					.getValue(new ResourceLocation(tokens.nextToken() + ":" + tokens.nextToken())))
					+ (Integer.parseInt(tokens.nextToken()) << 8);
		}
		tokens = new StringTokenizer(a, ":");
		if(tokens.countTokens() < 3) {
			this.b = Biome.getIdForBiome((Biome)biomeReg.getValue(new ResourceLocation(a)));
		} else {
			this.b = Biome.getIdForBiome((Biome)biomeReg
					.getValue(new ResourceLocation(tokens.nextToken() + ":" + tokens.nextToken())))
					+ (Integer.parseInt(tokens.nextToken()) << 8);
		}
		this.boundary = boundary;
	}
	

	@Override
	public int getBiome(ChunkTile tile) {
		int r = tile.getBiomeSeed();
		if((tile.getWet() + (r & 1) - ((r & 2) >> 1)) < boundary) {
			return a;
		} else {
			return b;
		}
	}


	@Override
	public boolean isEmpty() {
		return false;
	}

}

@@ -1138,33 +1138,33 @@
 StringTokenizer(
-a
+b
 , %22:%22);%0A%09%09if(tok
@@ -1258,33 +1258,33 @@
 esourceLocation(
-a
+b
 )));%0A%09%09%7D else %7B%0A

fix wetness noise biome registration