add backup to texture color getting
This commit is contained in:
+55
-47
@@ -260,39 +260,55 @@ public class ClientBlockStateColorCache
|
|||||||
&& !quads.isEmpty()
|
&& !quads.isEmpty()
|
||||||
&& quads.get(0) != null)
|
&& quads.get(0) != null)
|
||||||
{
|
{
|
||||||
BakedQuad firstQuad = quads.get(0);
|
try
|
||||||
|
{
|
||||||
|
BakedQuad firstQuad = quads.get(0);
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_11
|
#if MC_VER <= MC_1_21_11
|
||||||
this.needPostTinting = firstQuad.isTinted();
|
this.needPostTinting = firstQuad.isTinted();
|
||||||
#else
|
#else
|
||||||
this.needPostTinting = firstQuad.materialInfo().isTinted();
|
this.needPostTinting = firstQuad.materialInfo().isTinted();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_4
|
#if MC_VER <= MC_1_21_4
|
||||||
this.tintIndex = firstQuad.getTintIndex();
|
this.tintIndex = firstQuad.getTintIndex();
|
||||||
#elif MC_VER <= MC_1_21_11
|
#elif MC_VER <= MC_1_21_11
|
||||||
this.tintIndex = firstQuad.tintIndex();
|
this.tintIndex = firstQuad.tintIndex();
|
||||||
#else
|
#else
|
||||||
this.tintIndex = firstQuad.materialInfo().tintIndex();
|
this.tintIndex = firstQuad.materialInfo().tintIndex();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
this.baseColor = calculateColorFromTexture(
|
this.baseColor = calculateColorFromTexture(
|
||||||
firstQuad.sprite,
|
firstQuad.sprite,
|
||||||
EColorMode.getColorMode(this.blockState.getBlock()));
|
EColorMode.getColorMode(this.blockState.getBlock()));
|
||||||
#elif MC_VER < MC_1_21_5
|
#elif MC_VER < MC_1_21_5
|
||||||
this.baseColor = calculateColorFromTexture(
|
this.baseColor = calculateColorFromTexture(
|
||||||
firstQuad.getSprite(),
|
firstQuad.getSprite(),
|
||||||
EColorMode.getColorMode(this.blockState.getBlock()));
|
EColorMode.getColorMode(this.blockState.getBlock()));
|
||||||
#elif MC_VER <= MC_1_21_11
|
#elif MC_VER <= MC_1_21_11
|
||||||
this.baseColor = calculateColorFromTexture(
|
this.baseColor = calculateColorFromTexture(
|
||||||
firstQuad.sprite(),
|
firstQuad.sprite(),
|
||||||
EColorMode.getColorMode(this.blockState.getBlock()));
|
EColorMode.getColorMode(this.blockState.getBlock()));
|
||||||
#else
|
#else
|
||||||
this.baseColor = calculateColorFromTexture(
|
this.baseColor = calculateColorFromTexture(
|
||||||
firstQuad.materialInfo().sprite(),
|
firstQuad.materialInfo().sprite(),
|
||||||
EColorMode.getColorMode(this.blockState.getBlock()));
|
EColorMode.getColorMode(this.blockState.getBlock()));
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// Shouldn't normally happen, but there was at least
|
||||||
|
// one report of MC's texture being un-loaded
|
||||||
|
// which prevented us from getting the texture.
|
||||||
|
// So we should have some basic backup logic.
|
||||||
|
|
||||||
|
LOGGER.warn("Failed to get texture color for block ["+this.blockStateWrapper.getSerialString()+"] due to: ["+e.getMessage()+"], falling back to particle color.");
|
||||||
|
|
||||||
|
this.needPostTinting = false;
|
||||||
|
this.tintIndex = 0;
|
||||||
|
this.baseColor = this.getParticleIconColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -399,22 +415,14 @@ public class ClientBlockStateColorCache
|
|||||||
int scale = 1;
|
int scale = 1;
|
||||||
if (colorMode == EColorMode.Leaves)
|
if (colorMode == EColorMode.Leaves)
|
||||||
{
|
{
|
||||||
//switch (//FIXME add config option)
|
if (a == 0)
|
||||||
// case BLACK:
|
{
|
||||||
// a = 255; //simulate black background of fast leaves
|
continue; //same long grass
|
||||||
// break;
|
}
|
||||||
// case IGNORE:
|
else
|
||||||
if (a == 0) {
|
{
|
||||||
continue; //same long grass
|
a = 255; //just in case there are semi transparent pixels
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
a = 255; //just in case there are semi transparent pixels
|
|
||||||
}
|
|
||||||
// break;
|
|
||||||
// case TRANSPARENT:
|
|
||||||
// break; //do nothing, let it count towards transparency
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (a == 0 && colorMode != EColorMode.Glass)
|
else if (a == 0 && colorMode != EColorMode.Glass)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user