All Monitors now adjust their light output based on opacity of the block in front of them.

This commit is contained in:
AlgorithmX2 2014-07-11 20:28:46 -05:00
parent 9068c58ce4
commit f3faba1038

View file

@ -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