2013-10-17 07:32:13 +00:00
|
|
|
package biomesoplenty.asm.smoothing;
|
|
|
|
|
2013-10-18 07:42:18 +00:00
|
|
|
import net.minecraft.client.Minecraft;
|
2013-10-17 07:32:13 +00:00
|
|
|
import net.minecraft.launchwrapper.IClassTransformer;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.biome.BiomeGenBase;
|
2013-10-18 07:42:18 +00:00
|
|
|
import net.minecraftforge.common.ForgeDummyContainer;
|
2013-10-17 07:32:13 +00:00
|
|
|
import biomesoplenty.asm.smoothing.block.BlockFluid;
|
|
|
|
import biomesoplenty.asm.smoothing.block.BlockGrass;
|
|
|
|
import biomesoplenty.asm.smoothing.block.BlockLeaves;
|
|
|
|
import biomesoplenty.asm.smoothing.block.BlockTallGrass;
|
|
|
|
import biomesoplenty.configuration.configfile.BOPConfigurationMisc;
|
|
|
|
|
|
|
|
public class BOPBiomeTransitionSmoothing implements IClassTransformer
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public byte[] transform(String name, String newname, byte[] bytes)
|
|
|
|
{
|
|
|
|
if (name.equals("net.minecraft.block.BlockFluid"))
|
|
|
|
{
|
|
|
|
return BlockFluid.patchColourMultiplier(newname, bytes, false);
|
|
|
|
}
|
2013-10-17 09:22:29 +00:00
|
|
|
if (name.equals("apc"))
|
2013-10-17 07:32:13 +00:00
|
|
|
{
|
|
|
|
return BlockFluid.patchColourMultiplier(newname, bytes, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name.equals("net.minecraft.block.BlockGrass"))
|
|
|
|
{
|
|
|
|
return BlockGrass.patchColourMultiplier(newname, bytes, false);
|
|
|
|
}
|
2013-10-17 09:22:29 +00:00
|
|
|
if (name.equals("aon"))
|
2013-10-17 07:32:13 +00:00
|
|
|
{
|
|
|
|
return BlockGrass.patchColourMultiplier(newname, bytes, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name.equals("net.minecraft.block.BlockLeaves"))
|
|
|
|
{
|
|
|
|
return BlockLeaves.patchColourMultiplier(newname, bytes, false);
|
|
|
|
}
|
2013-10-17 09:22:29 +00:00
|
|
|
if (name.equals("aoz"))
|
2013-10-17 07:32:13 +00:00
|
|
|
{
|
|
|
|
return BlockLeaves.patchColourMultiplier(newname, bytes, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name.equals("net.minecraft.block.BlockTallGrass"))
|
|
|
|
{
|
|
|
|
return BlockTallGrass.patchColourMultiplier(newname, bytes, false);
|
|
|
|
}
|
2013-10-17 09:22:29 +00:00
|
|
|
if (name.equals("aqv"))
|
2013-10-17 07:32:13 +00:00
|
|
|
{
|
|
|
|
return BlockTallGrass.patchColourMultiplier(newname, bytes, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int getGrassColourMultiplier(IBlockAccess world, int ox, int oy, int oz)
|
|
|
|
{
|
2013-10-18 07:42:18 +00:00
|
|
|
int distance = Minecraft.getMinecraft().gameSettings.fancyGraphics ? BOPConfigurationMisc.grassColourSmoothingArea : 1;
|
2013-10-17 07:32:13 +00:00
|
|
|
|
|
|
|
int r = 0;
|
|
|
|
int g = 0;
|
|
|
|
int b = 0;
|
|
|
|
|
|
|
|
int divider = 0;
|
|
|
|
|
|
|
|
for (int x = -distance; x <= distance; ++x)
|
|
|
|
{
|
|
|
|
for (int z = -distance; z <= distance; ++z)
|
|
|
|
{
|
|
|
|
BiomeGenBase biome = world.getBiomeGenForCoords(ox + x, oz + z);
|
|
|
|
int colour = biome.getBiomeGrassColor();
|
|
|
|
r += (colour & 0xFF0000) >> 16;
|
|
|
|
g += (colour & 0x00FF00) >> 8;
|
|
|
|
b += colour & 0x0000FF;
|
|
|
|
divider++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int getLeavesColourMultiplier(IBlockAccess world, int ox, int oy, int oz)
|
|
|
|
{
|
2013-10-18 07:42:18 +00:00
|
|
|
int distance = Minecraft.getMinecraft().gameSettings.fancyGraphics ? BOPConfigurationMisc.leavesColourSmoothingArea : 1;
|
2013-10-17 07:32:13 +00:00
|
|
|
|
|
|
|
int r = 0;
|
|
|
|
int g = 0;
|
|
|
|
int b = 0;
|
|
|
|
|
|
|
|
int divider = 0;
|
|
|
|
|
|
|
|
for (int x = -distance; x <= distance; ++x)
|
|
|
|
{
|
|
|
|
for (int z = -distance; z <= distance; ++z)
|
|
|
|
{
|
|
|
|
BiomeGenBase biome = world.getBiomeGenForCoords(ox + x, oz + z);
|
|
|
|
int colour = biome.getBiomeFoliageColor();
|
|
|
|
r += (colour & 0xFF0000) >> 16;
|
|
|
|
g += (colour & 0x00FF00) >> 8;
|
|
|
|
b += colour & 0x0000FF;
|
|
|
|
divider++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int getWaterColourMultiplier(IBlockAccess world, int ox, int oy, int oz)
|
|
|
|
{
|
2013-10-18 07:42:18 +00:00
|
|
|
int distance = Minecraft.getMinecraft().gameSettings.fancyGraphics ? BOPConfigurationMisc.waterColourSmoothingArea : 1;
|
2013-10-17 07:32:13 +00:00
|
|
|
|
|
|
|
int r = 0;
|
|
|
|
int g = 0;
|
|
|
|
int b = 0;
|
|
|
|
|
|
|
|
int divider = 0;
|
|
|
|
|
|
|
|
for (int x = -distance; x <= distance; ++x)
|
|
|
|
{
|
|
|
|
for (int z = -distance; z <= distance; ++z)
|
|
|
|
{
|
|
|
|
BiomeGenBase biome = world.getBiomeGenForCoords(ox + x, oz + z);
|
|
|
|
int colour = biome.getWaterColorMultiplier();
|
|
|
|
r += (colour & 0xFF0000) >> 16;
|
|
|
|
g += (colour & 0x00FF00) >> 8;
|
|
|
|
b += colour & 0x0000FF;
|
|
|
|
divider++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255;
|
|
|
|
}
|
|
|
|
}
|