Fix forge pipeline block shifts (#3789)

This commit is contained in:
Vincent Lee 2017-05-01 19:53:17 -05:00 committed by LexManos
parent 27a5b60c89
commit 0b41a0a822
3 changed files with 9 additions and 14 deletions

View File

@ -25,6 +25,7 @@ import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
public class BlockInfo public class BlockInfo
@ -61,22 +62,16 @@ public class BlockInfo
public void updateShift() public void updateShift()
{ {
updateShift(false); Vec3d offset = state.getOffset(world, blockPos);
shx = (float) offset.xCoord;
shy = (float) offset.yCoord;
shz = (float) offset.zCoord;
} }
@Deprecated
public void updateShift(boolean ignoreY) public void updateShift(boolean ignoreY)
{ {
long rand = 0; updateShift();
if(state.getBlock().getOffsetType() != EnumOffsetType.NONE)
{
rand = MathHelper.getCoordinateRandom(blockPos.getX(), ignoreY ? 0 : blockPos.getY(), blockPos.getZ());
shx = ((float)((rand >> 16) & 0xF) / 0xF - .5f) * .5f;
shz = ((float)((rand >> 24) & 0xF) / 0xF - .5f) * .5f;
if(state.getBlock().getOffsetType() == EnumOffsetType.XYZ)
{
shy = ((float)((rand >> 20) & 0xF) / 0xF - 1) * .2f;
}
}
} }
public void setWorld(IBlockAccess world) public void setWorld(IBlockAccess world)

View File

@ -286,6 +286,6 @@ public class VertexLighterFlat extends QuadGatheringTransformer
public void updateBlockInfo() public void updateBlockInfo()
{ {
blockInfo.updateShift(true); blockInfo.updateShift();
} }
} }

View File

@ -182,7 +182,7 @@ public class VertexLighterSmoothAo extends VertexLighterFlat
@Override @Override
public void updateBlockInfo() public void updateBlockInfo()
{ {
blockInfo.updateShift(false); super.updateBlockInfo();
blockInfo.updateLightMatrix(); blockInfo.updateLightMatrix();
} }
} }