More thread safe (#508)

* More thread safe

I don't love this but the icons are a bit of a clusterfuck as to how they're set, this will at least guard against nulls and not crash

* spotlessApply

---------

Co-authored-by: GitHub GTNH Actions <>
This commit is contained in:
Jason MitchellandGitHub GTNH Actions authored and GitHub committed 2024-04-21 16:12:02 -05:00
1 parent 2da11c0cdc
commit d0d04bd696
4 files changed
+17 -4

No files matched your search

@@ -31,6 +31,8 @@ import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.ISimplifiedBundle;
import appeng.block.AEBaseBlock;
import appeng.block.networking.BlockCableBus;
import appeng.client.texture.FlippableIcon;
import appeng.client.texture.MissingIcon;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.tile.AEBaseTile;
@@ -441,7 +443,12 @@ public final class BusRenderHelper implements IPartRenderHelper {
final BlockRenderInfo info = block.getRendererInstance();
final ForgeDirection forward = BusRenderHelper.instances.get().az;
final ForgeDirection up = BusRenderHelper.instances.get().ay;
boolean isTemp = false;
if (!info.isValid() && !info.hasTemporaryRenderIcons()) {
final FlippableIcon i = new FlippableIcon(new MissingIcon(this));
info.setTemporaryRenderIcon(i);
isTemp = true;
}
renderer.uvRotateBottom = info.getTexture(ForgeDirection.DOWN)
.setFlip(BaseBlockRender.getOrientation(ForgeDirection.DOWN, forward, up));
renderer.uvRotateTop = info.getTexture(ForgeDirection.UP)
@@ -470,6 +477,9 @@ public final class BusRenderHelper implements IPartRenderHelper {
this.az);
renderer.renderStandardBlock(block, x, y, z);
if (isTemp) {
info.setTemporaryRenderIcon(null);
}
}
}