Add Custom Colors support for texture packs
This commit is contained in:
parent
9385f10f71
commit
40dd2025f2
2 changed files with 39 additions and 25 deletions
|
|
@ -88,6 +88,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
initialize(x0, y0, z0);
|
initialize(x0, y0, z0);
|
||||||
worldheight = w.getMaxHeight();
|
worldheight = w.getMaxHeight();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final void initialize(int x0, int y0, int z0) {
|
public final void initialize(int x0, int y0, int z0) {
|
||||||
this.x = x0;
|
this.x = x0;
|
||||||
this.y = y0;
|
this.y = y0;
|
||||||
|
|
@ -108,18 +109,21 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
else
|
else
|
||||||
typeid = blkdata = 0;
|
typeid = blkdata = 0;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getBlockTypeID() {
|
public final int getBlockTypeID() {
|
||||||
if(typeid < 0) {
|
if(typeid < 0) {
|
||||||
typeid = snap.getBlockTypeId(bx, y, bz);
|
typeid = snap.getBlockTypeId(bx, y, bz);
|
||||||
}
|
}
|
||||||
return typeid;
|
return typeid;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getBlockData() {
|
public final int getBlockData() {
|
||||||
if(blkdata < 0) {
|
if(blkdata < 0) {
|
||||||
blkdata = snap.getBlockData(bx, y, bz);
|
blkdata = snap.getBlockData(bx, y, bz);
|
||||||
}
|
}
|
||||||
return blkdata;
|
return blkdata;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public int getBlockSkyLight() {
|
public int getBlockSkyLight() {
|
||||||
try {
|
try {
|
||||||
return snap.getBlockSkyLight(bx, y, bz);
|
return snap.getBlockSkyLight(bx, y, bz);
|
||||||
|
|
@ -127,6 +131,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getBlockEmittedLight() {
|
public final int getBlockEmittedLight() {
|
||||||
try {
|
try {
|
||||||
return snap.getBlockEmittedLight(bx, y, bz);
|
return snap.getBlockEmittedLight(bx, y, bz);
|
||||||
|
|
@ -196,7 +201,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final BiomeMap getBiome() {
|
public final BiomeMap getBiome() {
|
||||||
try {
|
try {
|
||||||
return biomemap[x - x_base][z - z_base];
|
return biomemap[x - x_base][z - z_base];
|
||||||
|
|
@ -205,15 +210,15 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
return BiomeMap.NULL;
|
return BiomeMap.NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getSmoothGrassColorMultiplier(int[] colormap, int width) {
|
public final int getSmoothGrassColorMultiplier(int[] colormap) {
|
||||||
int mult = 0xFFFFFF;
|
int mult = 0xFFFFFF;
|
||||||
try {
|
try {
|
||||||
int rx = x - x_base;
|
int rx = x - x_base;
|
||||||
int rz = z - z_base;
|
int rz = z - z_base;
|
||||||
BiomeMap bm = biomemap[rx][rz];
|
BiomeMap bm = biomemap[rx][rz];
|
||||||
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
||||||
mult = bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup(width)]);
|
mult = bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup()]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int raccum = 0;
|
int raccum = 0;
|
||||||
|
|
@ -222,7 +227,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
for(int xoff = -1; xoff < 2; xoff++) {
|
for(int xoff = -1; xoff < 2; xoff++) {
|
||||||
for(int zoff = -1; zoff < 2; zoff++) {
|
for(int zoff = -1; zoff < 2; zoff++) {
|
||||||
bm = biomemap[rx+xoff][rz+zoff];
|
bm = biomemap[rx+xoff][rz+zoff];
|
||||||
int rmult = bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup(width)]);
|
int rmult = bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup()]);
|
||||||
raccum += (rmult >> 16) & 0xFF;
|
raccum += (rmult >> 16) & 0xFF;
|
||||||
gaccum += (rmult >> 8) & 0xFF;
|
gaccum += (rmult >> 8) & 0xFF;
|
||||||
baccum += rmult & 0xFF;
|
baccum += rmult & 0xFF;
|
||||||
|
|
@ -236,14 +241,15 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
}
|
}
|
||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
public final int getSmoothFoliageColorMultiplier(int[] colormap, int width) {
|
@Override
|
||||||
|
public final int getSmoothFoliageColorMultiplier(int[] colormap) {
|
||||||
int mult = 0xFFFFFF;
|
int mult = 0xFFFFFF;
|
||||||
try {
|
try {
|
||||||
int rx = x - x_base;
|
int rx = x - x_base;
|
||||||
int rz = z - z_base;
|
int rz = z - z_base;
|
||||||
BiomeMap bm = biomemap[rx][rz];
|
BiomeMap bm = biomemap[rx][rz];
|
||||||
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
||||||
mult = bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup(width)]);
|
mult = bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup()]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int raccum = 0;
|
int raccum = 0;
|
||||||
|
|
@ -252,7 +258,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
for(int xoff = -1; xoff < 2; xoff++) {
|
for(int xoff = -1; xoff < 2; xoff++) {
|
||||||
for(int zoff = -1; zoff < 2; zoff++) {
|
for(int zoff = -1; zoff < 2; zoff++) {
|
||||||
bm = biomemap[rx+xoff][rz+zoff];
|
bm = biomemap[rx+xoff][rz+zoff];
|
||||||
int rmult = bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup(width)]);
|
int rmult = bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup()]);
|
||||||
raccum += (rmult >> 16) & 0xFF;
|
raccum += (rmult >> 16) & 0xFF;
|
||||||
gaccum += (rmult >> 8) & 0xFF;
|
gaccum += (rmult >> 8) & 0xFF;
|
||||||
baccum += rmult & 0xFF;
|
baccum += rmult & 0xFF;
|
||||||
|
|
@ -266,7 +272,8 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
}
|
}
|
||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
public final int getSmoothColorMultiplier(int[] colormap, int width, int[] swampmap, int swampwidth) {
|
@Override
|
||||||
|
public final int getSmoothColorMultiplier(int[] colormap, int[] swampmap) {
|
||||||
int mult = 0xFFFFFF;
|
int mult = 0xFFFFFF;
|
||||||
try {
|
try {
|
||||||
int rx = x - x_base;
|
int rx = x - x_base;
|
||||||
|
|
@ -274,10 +281,10 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
BiomeMap bm = biomemap[rx][rz];
|
BiomeMap bm = biomemap[rx][rz];
|
||||||
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
||||||
if(bm == BiomeMap.SWAMPLAND) {
|
if(bm == BiomeMap.SWAMPLAND) {
|
||||||
mult = swampmap[bm.biomeLookup(swampwidth)];
|
mult = swampmap[bm.biomeLookup()];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mult = colormap[bm.biomeLookup(width)];
|
mult = colormap[bm.biomeLookup()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -289,10 +296,10 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
bm = biomemap[rx+xoff][rz+zoff];
|
bm = biomemap[rx+xoff][rz+zoff];
|
||||||
int rmult;
|
int rmult;
|
||||||
if(bm == BiomeMap.SWAMPLAND) {
|
if(bm == BiomeMap.SWAMPLAND) {
|
||||||
rmult = swampmap[bm.biomeLookup(swampwidth)];
|
rmult = swampmap[bm.biomeLookup()];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rmult = colormap[bm.biomeLookup(width)];
|
rmult = colormap[bm.biomeLookup()];
|
||||||
}
|
}
|
||||||
raccum += (rmult >> 16) & 0xFF;
|
raccum += (rmult >> 16) & 0xFF;
|
||||||
gaccum += (rmult >> 8) & 0xFF;
|
gaccum += (rmult >> 8) & 0xFF;
|
||||||
|
|
@ -307,7 +314,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
}
|
}
|
||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getSmoothWaterColorMultiplier() {
|
public final int getSmoothWaterColorMultiplier() {
|
||||||
try {
|
try {
|
||||||
int rx = x - x_base;
|
int rx = x - x_base;
|
||||||
|
|
@ -334,15 +341,15 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
return 0xFFFFFF;
|
return 0xFFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getSmoothWaterColorMultiplier(int[] colormap, int width) {
|
public final int getSmoothWaterColorMultiplier(int[] colormap) {
|
||||||
int mult = 0xFFFFFF;
|
int mult = 0xFFFFFF;
|
||||||
try {
|
try {
|
||||||
int rx = x - x_base;
|
int rx = x - x_base;
|
||||||
int rz = z - z_base;
|
int rz = z - z_base;
|
||||||
BiomeMap bm = biomemap[rx][rz];
|
BiomeMap bm = biomemap[rx][rz];
|
||||||
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */
|
||||||
mult = colormap[bm.biomeLookup(width)];
|
mult = colormap[bm.biomeLookup()];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int raccum = 0;
|
int raccum = 0;
|
||||||
|
|
@ -351,7 +358,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
for(int xoff = -1; xoff < 2; xoff++) {
|
for(int xoff = -1; xoff < 2; xoff++) {
|
||||||
for(int zoff = -1; zoff < 2; zoff++) {
|
for(int zoff = -1; zoff < 2; zoff++) {
|
||||||
bm = biomemap[rx+xoff][rz+zoff];
|
bm = biomemap[rx+xoff][rz+zoff];
|
||||||
int rmult = colormap[bm.biomeLookup(width)];
|
int rmult = colormap[bm.biomeLookup()];
|
||||||
raccum += (rmult >> 16) & 0xFF;
|
raccum += (rmult >> 16) & 0xFF;
|
||||||
gaccum += (rmult >> 8) & 0xFF;
|
gaccum += (rmult >> 8) & 0xFF;
|
||||||
baccum += rmult & 0xFF;
|
baccum += rmult & 0xFF;
|
||||||
|
|
@ -365,16 +372,10 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
}
|
}
|
||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final double getRawBiomeTemperature() {
|
|
||||||
return snap.getRawBiomeTemperature(bx, bz);
|
|
||||||
}
|
|
||||||
public final double getRawBiomeRainfall() {
|
|
||||||
return snap.getRawBiomeRainfall(bx, bz);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Step current position in given direction
|
* Step current position in given direction
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void stepPosition(BlockStep step) {
|
public final void stepPosition(BlockStep step) {
|
||||||
typeid = -1;
|
typeid = -1;
|
||||||
blkdata = -1;
|
blkdata = -1;
|
||||||
|
|
@ -461,6 +462,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
/**
|
/**
|
||||||
* Unstep current position to previous position
|
* Unstep current position to previous position
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BlockStep unstepPosition() {
|
public BlockStep unstepPosition() {
|
||||||
BlockStep ls = laststep;
|
BlockStep ls = laststep;
|
||||||
stepPosition(unstep[ls.ordinal()]);
|
stepPosition(unstep[ls.ordinal()]);
|
||||||
|
|
@ -469,9 +471,11 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
/**
|
/**
|
||||||
* Unstep current position in oppisite director of given step
|
* Unstep current position in oppisite director of given step
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void unstepPosition(BlockStep s) {
|
public void unstepPosition(BlockStep s) {
|
||||||
stepPosition(unstep[s.ordinal()]);
|
stepPosition(unstep[s.ordinal()]);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final void setY(int y) {
|
public final void setY(int y) {
|
||||||
if(y > this.y)
|
if(y > this.y)
|
||||||
laststep = BlockStep.Y_PLUS;
|
laststep = BlockStep.Y_PLUS;
|
||||||
|
|
@ -485,15 +489,19 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
typeid = blkdata = -1;
|
typeid = blkdata = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getX() {
|
public final int getX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getY() {
|
public final int getY() {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getZ() {
|
public final int getZ() {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public final int getBlockTypeIDAt(BlockStep s) {
|
public final int getBlockTypeIDAt(BlockStep s) {
|
||||||
if(s == BlockStep.Y_MINUS) {
|
if(s == BlockStep.Y_MINUS) {
|
||||||
if(y > 0)
|
if(y > 0)
|
||||||
|
|
@ -513,6 +521,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public BlockStep getLastStep() {
|
public BlockStep getLastStep() {
|
||||||
return laststep;
|
return laststep;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,11 @@ use-generated-textures: true
|
||||||
correct-water-lighting: true
|
correct-water-lighting: true
|
||||||
transparent-leaves: true
|
transparent-leaves: true
|
||||||
|
|
||||||
|
# ctm-support: if true, Connected Texture Mod (CTM) in texture packs is enabled (default)
|
||||||
|
ctm-support: true
|
||||||
|
# custom-colors-support: if true, Custom Colors in texture packs is enabled (default)
|
||||||
|
custom-colors-support: true
|
||||||
|
|
||||||
# Control loading of player faces (if set to false, skins are never fetched)
|
# Control loading of player faces (if set to false, skins are never fetched)
|
||||||
#fetchskins: false
|
#fetchskins: false
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue