mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-11 04:22:00 +01:00
fix a contraption lighting glitch
This commit is contained in:
parent
93353b61d6
commit
1874b267b3
3 changed files with 11 additions and 7 deletions
|
@ -21,6 +21,7 @@ public class NonStationaryLighter<C extends Contraption> extends ContraptionLigh
|
|||
|
||||
@Override
|
||||
public void tick(RenderedContraption owner) {
|
||||
super.tick(owner);
|
||||
GridAlignedBB contraptionBounds = getContraptionBounds();
|
||||
|
||||
if (!contraptionBounds.sameAs(bounds)) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class RenderedContraption {
|
|||
|
||||
public final ContraptionKineticRenderer kinetics;
|
||||
|
||||
private Contraption contraption;
|
||||
public Contraption contraption;
|
||||
|
||||
private Matrix4f model;
|
||||
|
||||
|
|
|
@ -2,11 +2,6 @@ package com.simibubi.create.foundation.render.light;
|
|||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
import com.simibubi.create.foundation.render.contraption.RenderedContraption;
|
||||
import net.minecraft.util.math.SectionPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import static com.simibubi.create.foundation.render.RenderMath.nextPowerOf2;
|
||||
|
||||
public abstract class ContraptionLighter<C extends Contraption> {
|
||||
protected final C contraption;
|
||||
|
@ -14,6 +9,8 @@ public abstract class ContraptionLighter<C extends Contraption> {
|
|||
|
||||
protected GridAlignedBB bounds;
|
||||
|
||||
protected boolean scheduleRebuild;
|
||||
|
||||
protected ContraptionLighter(C contraption) {
|
||||
this.contraption = contraption;
|
||||
|
||||
|
@ -22,6 +19,7 @@ public abstract class ContraptionLighter<C extends Contraption> {
|
|||
lightVolume = new LightVolume(contraptionBoundsToVolume(bounds));
|
||||
|
||||
lightVolume.initialize(contraption.entity.world);
|
||||
scheduleRebuild = true;
|
||||
}
|
||||
|
||||
protected GridAlignedBB contraptionBoundsToVolume(GridAlignedBB bounds) {
|
||||
|
@ -33,7 +31,12 @@ public abstract class ContraptionLighter<C extends Contraption> {
|
|||
return bounds;
|
||||
}
|
||||
|
||||
public void tick(RenderedContraption owner) {}
|
||||
public void tick(RenderedContraption owner) {
|
||||
if (scheduleRebuild) {
|
||||
lightVolume.initialize(owner.contraption.entity.world);
|
||||
scheduleRebuild = false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract GridAlignedBB getContraptionBounds();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue