random touchups

This commit is contained in:
grimmauld 2021-04-23 22:42:34 +02:00
parent 0c89eb0279
commit 61d645c354
3 changed files with 22 additions and 2 deletions

View file

@ -7,6 +7,9 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
public class LightHandlerRenderer<T extends TileEntity & ILightHandler.ILightHandlerProvider> extends SafeTileEntityRenderer<T> { public class LightHandlerRenderer<T extends TileEntity & ILightHandler.ILightHandlerProvider> extends SafeTileEntityRenderer<T> {
public LightHandlerRenderer(TileEntityRendererDispatcher dispatcher) { public LightHandlerRenderer(TileEntityRendererDispatcher dispatcher) {
super(dispatcher); super(dispatcher);
@ -18,4 +21,9 @@ public class LightHandlerRenderer<T extends TileEntity & ILightHandler.ILightHan
.getRenderBeams() .getRenderBeams()
.forEachRemaining(beam -> beam.render(ms, buffer, partialTicks)); .forEachRemaining(beam -> beam.render(ms, buffer, partialTicks));
} }
@Override
public boolean isGlobalRenderer(T te) {
return true;
}
} }

View file

@ -105,4 +105,9 @@ public class AlignerBehaviour extends AbstractLightHandlingBehaviour<AlignerTile
return Iterators.concat(super.getRenderBeams(), collectedBeam == null ? Collections.emptyIterator() : Collections.singleton(collectedBeam) return Iterators.concat(super.getRenderBeams(), collectedBeam == null ? Collections.emptyIterator() : Collections.singleton(collectedBeam)
.iterator()); .iterator());
} }
@Override
protected boolean canUpdateFast() {
return false;
}
} }

View file

@ -40,7 +40,7 @@ public abstract class AbstractLightHandlingBehaviour<T extends SmartTileEntity &
super.tick(); super.tick();
if (properties.scansBeacon && beacon != null && beacon.isRemoved()) if (properties.scansBeacon && beacon != null && beacon.isRemoved())
updateBeaconState(); updateBeaconState();
if (needsBeamUpdate) if (needsBeamUpdate && canUpdateFast())
updateBeams(); updateBeams();
} }
@ -74,7 +74,10 @@ public abstract class AbstractLightHandlingBehaviour<T extends SmartTileEntity &
super.lazyTick(); super.lazyTick();
if (properties.scansBeacon) if (properties.scansBeacon)
updateBeaconState(); updateBeaconState();
if (canUpdateFast())
requestBeamUpdate(); requestBeamUpdate();
else
updateBeams();
} }
public void requestBeamUpdate() { public void requestBeamUpdate() {
@ -112,4 +115,8 @@ public abstract class AbstractLightHandlingBehaviour<T extends SmartTileEntity &
public int getMaxScanRange() { public int getMaxScanRange() {
return properties.scanRange; return properties.scanRange;
} }
protected boolean canUpdateFast() {
return true;
}
} }