Fix hex plating glow tint pollution from leaked ambient occlusion state (#101)

This commit is contained in:
boubou19 authored and GitHub committed 2026-08-09 16:59:25 +07:00
1 parent c1ac213eab
commit ff70c8b2e3
5 files changed
+30 -12

No files matched your search

+5 -4
View File
@@ -5305,6 +5305,7 @@ public enum Features {
}
};
public static final Features[] VALUES = values();
private static final String[] dyeOres = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple",
"dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta",
"dyeOrange", "dyeWhite" };
@@ -5320,7 +5321,7 @@ public enum Features {
private static void loadBlocks() {
Chisel.logger.info("Loading blocks...");
int num = 0;
for (Features f : values()) {
for (Features f : VALUES) {
if (f.enabled()) {
f.addBlocks();
++num;
@@ -5337,7 +5338,7 @@ public enum Features {
private static void loadItems() {
Chisel.logger.info("Loading items...");
int num = 0;
for (Features f : values()) {
for (Features f : VALUES) {
if (f.enabled()) {
f.addItems();
++num;
@@ -5351,7 +5352,7 @@ public enum Features {
private static void loadRecipes() {
Chisel.logger.info("Loading recipes...");
int num = 0;
for (Features f : values()) {
for (Features f : VALUES) {
if (f.enabled()) {
if (f.needsMetaRecipes()) {
for (int i = 0; i < 16; i++) {
@@ -5387,7 +5388,7 @@ public enum Features {
}
public static boolean oneModdedFeatureLoaded() {
for (Features f : values()) {
for (Features f : VALUES) {
if (f.hasRequiredMod()) {
return true;
}
@@ -37,6 +37,8 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
STACK,
REVERSION;
public static final Upgrade[] VALUES = values();
public String getUnlocalizedName() {
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
return "item.upgrade_" + this.name()
@@ -380,7 +382,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
return itemStack.getItem() instanceof IChiselItem;
default:
return Features.AUTO_CHISEL_UPGRADES.enabled() && itemStack.getItem() == ChiselItems.upgrade
&& Upgrade.values()[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
&& Upgrade.VALUES[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
}
}
@@ -465,7 +467,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
String unloc = name == null ? null : String.format(base, name);
return StatCollector.translateToLocal(unloc);
} else {
return Upgrade.values()[slotNumber - MIN_UPGRADE].getLocalizedName();
return Upgrade.VALUES[slotNumber - MIN_UPGRADE].getLocalizedName();
}
}
@@ -40,13 +40,28 @@ public class RendererLayeredGlow implements ISimpleBlockRenderingHandler {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks renderer) {
final Tessellator tessellator = Tessellator.instance;
tessellator.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]);
final boolean prevEnableAO = renderer.enableAO;
final int tint = Configurations.configColors[world.getBlockMetadata(x, y, z)];
tessellator.setColorOpaque_I(tint);
tessellator.setBrightness(0xF000F0);
setFullbrightColor(renderer, tint);
Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture());
renderer.enableAO = prevEnableAO;
renderer.renderStandardBlock(block, x, y, z);
return true;
}
private static void setFullbrightColor(RenderBlocks renderer, int color) {
final float r = (color >> 16 & 255) / 255.0F;
final float g = (color >> 8 & 255) / 255.0F;
final float b = (color & 255) / 255.0F;
renderer.enableAO = true;
renderer.colorRedTopLeft = renderer.colorRedBottomLeft = renderer.colorRedBottomRight = renderer.colorRedTopRight = r;
renderer.colorGreenTopLeft = renderer.colorGreenBottomLeft = renderer.colorGreenBottomRight = renderer.colorGreenTopRight = g;
renderer.colorBlueTopLeft = renderer.colorBlueBottomLeft = renderer.colorBlueBottomRight = renderer.colorBlueTopRight = b;
renderer.brightnessTopLeft = renderer.brightnessBottomLeft = renderer.brightnessTopRight = renderer.brightnessBottomRight = 0xF000F0;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
@@ -303,7 +303,7 @@ public class Configurations {
}
/* features */
for (Features feature : Features.values()) {
for (Features feature : Features.VALUES) {
features.put(
featureName(feature),
config.get("features", featureName(feature), true)
@@ -26,12 +26,12 @@ public class ItemUpgrade extends BaseItem {
@Override
public IIcon getIconFromDamage(int meta) {
// using modulo throughout to prevent AIOB
return this.icons[meta % Upgrade.values().length];
return this.icons[meta % Upgrade.VALUES.length];
}
@Override
public void registerIcons(IIconRegister reg) {
Upgrade[] upgrades = Upgrade.values();
Upgrade[] upgrades = Upgrade.VALUES;
for (int i = 0; i < upgrades.length; i++) {
this.icons[i] = reg.registerIcon(
Chisel.MOD_ID + ":upgrade_"
@@ -43,14 +43,14 @@ public class ItemUpgrade extends BaseItem {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < Upgrade.values().length; i++) {
for (int i = 0; i < Upgrade.VALUES.length; i++) {
list.add(new ItemStack(item, 1, i));
}
}
@Override
public String getUnlocalizedName(ItemStack stack) {
Upgrade[] upgrades = Upgrade.values();
Upgrade[] upgrades = Upgrade.VALUES;
return upgrades[stack.getItemDamage() % upgrades.length].getUnlocalizedName();
}
}