From f3faba10382c31375909eca888a6cd775f9a436b Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Fri, 11 Jul 2014 20:28:46 -0500 Subject: [PATCH] All Monitors now adjust their light output based on opacity of the block in front of them. --- parts/reporting/PartMonitor.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/parts/reporting/PartMonitor.java b/parts/reporting/PartMonitor.java index 8dea75c5..45600335 100644 --- a/parts/reporting/PartMonitor.java +++ b/parts/reporting/PartMonitor.java @@ -7,6 +7,7 @@ import java.io.IOException; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.IPowerChannelState; import appeng.api.implementations.parts.IPartMonitor; @@ -46,6 +47,12 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann getHost().markForUpdate(); } + @Override + public void onNeighborChanged() + { + getHost().markForUpdate(); + } + @MENetworkEventSubscribe public void powerRender(MENetworkPowerStatusChange c) { @@ -91,7 +98,14 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann @Override public int getLightLevel() { - return isPowered() ? (notLightSource ? 9 : 15) : 0; + return blockLight( isPowered() ? (notLightSource ? 9 : 15) : 0 ); + } + + private int blockLight(int emit) + { + TileEntity te = this.getTile(); + float opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ ); + return (int) (emit * (opacity / 255.0f)); } @Override