Fix Vertex Transformer for breaking models (#3132)

* Add setTexture to IVertexConsumer and propagate it.
This commit is contained in:
AlgorithmX2 2016-08-04 18:37:59 -05:00 committed by LexManos
parent 7c4ffde39c
commit bc6b008364
6 changed files with 35 additions and 1 deletions

View file

@ -19,6 +19,7 @@
package net.minecraftforge.client.model.pipeline; package net.minecraftforge.client.model.pipeline;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -37,6 +38,6 @@ public interface IVertexConsumer
void setQuadTint(int tint); void setQuadTint(int tint);
void setQuadOrientation(EnumFacing orientation); void setQuadOrientation(EnumFacing orientation);
void setApplyDiffuseLighting(boolean diffuse); void setApplyDiffuseLighting(boolean diffuse);
void setTexture(TextureAtlasSprite texture);
void put(int element, float... data); void put(int element, float... data);
} }

View file

@ -102,6 +102,14 @@ public class LightUtil
public static void putBakedQuad(IVertexConsumer consumer, BakedQuad quad) public static void putBakedQuad(IVertexConsumer consumer, BakedQuad quad)
{ {
try
{
consumer.setTexture(quad.getSprite());
}
catch(AbstractMethodError e)
{
// catch missing method errors caused by change to IVertexConsumer
}
consumer.setQuadOrientation(quad.getFace()); consumer.setQuadOrientation(quad.getFace());
if(quad.hasTintIndex()) if(quad.hasTintIndex())
{ {

View file

@ -66,6 +66,14 @@ public class UnpackedBakedQuad extends BakedQuad
{ {
consumer.setQuadTint(getTintIndex()); consumer.setQuadTint(getTintIndex());
} }
try
{
consumer.setTexture(sprite);
}
catch(AbstractMethodError e)
{
// catch missing method errors caused by change to IVertexConsumer
}
consumer.setQuadOrientation(getFace()); consumer.setQuadOrientation(getFace());
for(int v = 0; v < 4; v++) for(int v = 0; v < 4; v++)
{ {

View file

@ -20,6 +20,7 @@
package net.minecraftforge.client.model.pipeline; package net.minecraftforge.client.model.pipeline;
import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -77,4 +78,5 @@ public class VertexBufferConsumer implements IVertexConsumer
public void setQuadTint(int tint) {} public void setQuadTint(int tint) {}
public void setQuadOrientation(EnumFacing orientation) {} public void setQuadOrientation(EnumFacing orientation) {}
public void setApplyDiffuseLighting(boolean diffuse) {} public void setApplyDiffuseLighting(boolean diffuse) {}
public void setTexture(TextureAtlasSprite texture ) {}
} }

View file

@ -24,6 +24,7 @@ import javax.vecmath.Vector3f;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -262,6 +263,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
} }
public void setQuadOrientation(EnumFacing orientation) {} public void setQuadOrientation(EnumFacing orientation) {}
public void setQuadCulled() {} public void setQuadCulled() {}
public void setTexture( TextureAtlasSprite texture ) {}
public void setApplyDiffuseLighting(boolean diffuse) public void setApplyDiffuseLighting(boolean diffuse)
{ {
this.diffuse = diffuse; this.diffuse = diffuse;

View file

@ -19,6 +19,7 @@
package net.minecraftforge.client.model.pipeline; package net.minecraftforge.client.model.pipeline;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -41,6 +42,18 @@ public class VertexTransformer implements IVertexConsumer
parent.setQuadTint(tint); parent.setQuadTint(tint);
} }
public void setTexture(TextureAtlasSprite texture)
{
try
{
parent.setTexture(texture);
}
catch(AbstractMethodError e)
{
// catch missing method errors caused by change to IVertexConsumer
}
}
public void setQuadOrientation(EnumFacing orientation) public void setQuadOrientation(EnumFacing orientation)
{ {
parent.setQuadOrientation(orientation); parent.setQuadOrientation(orientation);