Skip to content

Commit

Permalink
Fix this mistake in item context's resolvePreset
Browse files Browse the repository at this point in the history
(Broken since "API: Material property TriState")
  • Loading branch information
spiralhalo committed Jan 21, 2024
1 parent 8cfa226 commit 2a40489
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;

import io.vram.frex.api.material.MaterialConstants;
import io.vram.frex.api.material.MaterialMap;
import io.vram.frex.api.math.MatrixStack;
import io.vram.frex.api.model.ItemModel;
Expand Down Expand Up @@ -96,6 +97,29 @@ protected void applyMaterialDefaults() {
}
}

@Override
protected void resolvePreset() {
if (finder.preset() == MaterialConstants.PRESET_DEFAULT) {
finder.preset(inputContext.defaultPreset());
}

if (finder.preset() == MaterialConstants.PRESET_TRANSLUCENT) {
// Special case for translucent items
finder.transparency(MaterialConstants.TRANSPARENCY_TRANSLUCENT)
.cutout(inputContext.isBlockItem() ? MaterialConstants.CUTOUT_NONE : MaterialConstants.CUTOUT_TENTH)
.unmipped(false)
.target(inputContext.drawTranslucencyToMainTarget() ? MaterialConstants.TARGET_SOLID : MaterialConstants.TARGET_ENTITIES)
.sorted(!inputContext.drawTranslucencyToMainTarget());

// Importantly
finder.preset(MaterialConstants.PRESET_NONE);

return;
}

super.resolvePreset();
}

@Override
protected void shadeQuad() {
emitter.applyFlatLighting(inputContext.flatBrightness(emitter));
Expand Down

0 comments on commit 2a40489

Please sign in to comment.