diff --git a/src/main/java/co/neeve/nae2/common/interfaces/IBeamFormerHost.java b/src/main/java/co/neeve/nae2/common/interfaces/IBeamFormerHost.java index 871bf52..52d2636 100644 --- a/src/main/java/co/neeve/nae2/common/interfaces/IBeamFormerHost.java +++ b/src/main/java/co/neeve/nae2/common/interfaces/IBeamFormerHost.java @@ -1,7 +1,5 @@ package co.neeve.nae2.common.interfaces; public interface IBeamFormerHost { - void notifyBeamFormerState(); - boolean hasBeamFormers(); } diff --git a/src/main/java/co/neeve/nae2/common/parts/implementations/PartBeamFormer.java b/src/main/java/co/neeve/nae2/common/parts/implementations/PartBeamFormer.java index bfd8fca..121deb3 100644 --- a/src/main/java/co/neeve/nae2/common/parts/implementations/PartBeamFormer.java +++ b/src/main/java/co/neeve/nae2/common/parts/implementations/PartBeamFormer.java @@ -19,13 +19,11 @@ import appeng.core.AELog; import appeng.items.parts.PartModels; import appeng.me.GridAccessException; -import appeng.parts.ICableBusContainer; import appeng.parts.PartModel; import appeng.util.Platform; import co.neeve.nae2.Tags; import co.neeve.nae2.client.rendering.BeamRenderer; import co.neeve.nae2.common.features.subfeatures.BeamFeatures; -import co.neeve.nae2.common.interfaces.IBeamFormerHost; import co.neeve.nae2.common.parts.NAEBasePartState; import co.neeve.nae2.server.IBlockStateListener; import co.neeve.nae2.server.WorldListener; @@ -569,9 +567,6 @@ private void drawBeamGT(double x, double y, double z, int dx, int dy, int dz, Bu @Override @SideOnly(Side.CLIENT) public boolean requireDynamicRender() { - if (this.getHost() instanceof ICableBusContainer bc && bc instanceof IBeamFormerHost beamFormerHost) { - beamFormerHost.notifyBeamFormerState(); - } return true; } diff --git a/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinCableBusContainer.java b/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinCableBusContainer.java index 13f8a69..6d4151f 100644 --- a/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinCableBusContainer.java +++ b/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinCableBusContainer.java @@ -1,8 +1,12 @@ package co.neeve.nae2.mixin.beamformer.client; +import appeng.api.parts.IPart; import appeng.parts.CableBusContainer; import co.neeve.nae2.common.interfaces.IBeamFormerHost; +import co.neeve.nae2.common.parts.implementations.PartBeamFormer; +import net.minecraft.util.EnumFacing; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -10,14 +14,11 @@ @Mixin(CableBusContainer.class) public abstract class MixinCableBusContainer implements IBeamFormerHost { - @Unique private boolean nae2$hasBeamFormers = false; - @Override - public void notifyBeamFormerState() { - this.nae2$hasBeamFormers = true; - } + @Shadow(remap = false) + public abstract IPart getPart(EnumFacing side); @Override public boolean hasBeamFormers() { @@ -27,5 +28,12 @@ public boolean hasBeamFormers() { @Inject(method = "partChanged", at = @At("HEAD"), remap = false) public void injectPartChanged(CallbackInfo ci) { this.nae2$hasBeamFormers = false; + for (var facing : EnumFacing.values()) { + var part = this.getPart(facing); + if (part instanceof PartBeamFormer) { + this.nae2$hasBeamFormers = true; + break; + } + } } } diff --git a/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinTileCableBus.java b/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinTileCableBus.java index ccd20f4..68a8b71 100644 --- a/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinTileCableBus.java +++ b/src/main/java/co/neeve/nae2/mixin/beamformer/client/MixinTileCableBus.java @@ -9,9 +9,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(value = TileCableBus.class, remap = false) +@Mixin(value = TileCableBus.class) public abstract class MixinTileCableBus { - @Shadow + @Shadow(remap = false) public abstract CableBusContainer getCableBus(); @Inject(method = "getMaxRenderDistanceSquared", at = @At("HEAD"), cancellable = true)