mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 05:02:25 +00:00
Fix overlay lighting on model machines.
Somewhat hacky but seems to work fine
This commit is contained in:
1 parent
510cf06738
commit
1e085eb35f
3 files changed
+18
-4
No files matched your search
@@ -3,12 +3,15 @@ package crazypants.enderio.machine;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.render.CustomCubeRenderer;
|
||||
import crazypants.render.CustomRenderBlocks;
|
||||
import crazypants.render.IRenderFace;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.ForgeDirectionOffsets;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vertex;
|
||||
@@ -27,6 +30,11 @@ public class OverlayRenderer implements IRenderFace {
|
||||
boolean translateToXyz) {
|
||||
|
||||
if(te != null && par1Block instanceof AbstractMachineBlock) {
|
||||
BlockCoord bc = new BlockCoord(x, y, z);
|
||||
if(par1Block.isOpaqueCube()) {
|
||||
bc = bc.getLocation(face);
|
||||
}
|
||||
RenderUtil.setTesselatorBrightness(Minecraft.getMinecraft().theWorld, bc.x, bc.y, bc.z);
|
||||
Vector3d offset = ForgeDirectionOffsets.offsetScaled(face, 0.001);
|
||||
Tessellator.instance.addTranslation((float) offset.x, (float) offset.y, (float) offset.z);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
|
||||
import crazypants.render.CustomCubeRenderer;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.render.TechneModelRenderer;
|
||||
import crazypants.render.VertexRotationFacing;
|
||||
import crazypants.render.VertexTransform;
|
||||
@@ -37,14 +38,15 @@ public class TechneMachineRenderer<T extends AbstractMachineEntity> extends Tech
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
T te = (T) world.getTileEntity(x, y, z);
|
||||
|
||||
if(te != null) {
|
||||
setFacingDir(te.getFacingDir());
|
||||
overlay.setTile(te);
|
||||
ccr.renderBlock(world, block, x, y, z, overlay);
|
||||
}
|
||||
|
||||
return super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
|
||||
super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
|
||||
ccr.renderBlock(world, block, x, y, z, overlay);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setFacingDir(ForgeDirection dir) {
|
||||
|
||||
@@ -29,12 +29,16 @@ public final class BlockCoord {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
|
||||
public BlockCoord(double x, double y, double z) {
|
||||
this(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z));
|
||||
}
|
||||
|
||||
public BlockCoord(TileEntity tile) {
|
||||
this(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
|
||||
public BlockCoord(Entity e) {
|
||||
this(MathHelper.floor_double(e.posX), MathHelper.floor_double(e.posY), MathHelper.floor_double(e.posZ));
|
||||
this(e.posX, e.posY, e.posZ);
|
||||
}
|
||||
|
||||
public BlockCoord(BlockCoord bc) {
|
||||
|
||||
Reference in new issue
Block a user