Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Rotor Holder Lighting #2681

Merged
merged 2 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.gregtechceu.gtceu.client.renderer.machine;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.data.chemical.material.Material;
import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey;
import com.gregtechceu.gtceu.api.machine.MachineDefinition;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IRotorHolderMachine;
import com.gregtechceu.gtceu.client.util.StaticFaceBakery;
import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour;

import com.lowdragmc.lowdraglib.client.model.ModelFactory;

Expand Down Expand Up @@ -53,17 +56,21 @@ public void renderMachine(List<BakedQuad> quads, MachineDefinition definition, @
var aabb = new AABB(-1, -1, -0.01, 2, 2, 1.01);
if (!rotorHolderMachine.getControllers().isEmpty()) {
quads.add(StaticFaceBakery.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(BASE_RING),
modelState, -101, 15, true, false));
modelState, -101, 0, true, false));
quads.add(StaticFaceBakery.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(BASE_BG),
modelState, -101, 15, true, false));
modelState, -101, 0, true, false));
if (rotorHolderMachine.hasRotor()) {
Material mat = TurbineRotorBehaviour.getBehaviour(rotorHolderMachine.getRotorStack())
.getPartMaterial(rotorHolderMachine.getRotorStack());
boolean emissive = mat.hasProperty(PropertyKey.ORE) &&
mat.getProperty(PropertyKey.ORE).isEmissive();
if (rotorHolderMachine.isRotorSpinning()) {
quads.add(
StaticFaceBakery.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(SPINNING),
modelState, 2, 0, true, true));
modelState, 2, emissive ? 12 : 5, true, true));
} else {
quads.add(StaticFaceBakery.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(IDLE),
modelState, 2, 0, true, true));
modelState, 2, emissive ? 12 : 5, true, true));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private void onRotorInventoryChanged() {

@Override
public boolean hasRotor() {
return rotorColor != 0;
return inventory.getStackInSlot(0) != ItemStack.EMPTY;
}

protected void updateRotorSubscription() {
Expand Down
Loading