Updated various rendering-related patches and classes to 1.8.8; forge still uses vecmath.
This commit is contained in:
parent
98125a97c9
commit
e833ee81fb
22 changed files with 323 additions and 422 deletions
|
@ -1,15 +1,12 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java
|
||||
@@ -580,6 +580,14 @@
|
||||
@@ -580,6 +580,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public void checkAndGrow()
|
||||
+ {
|
||||
+ if (this.rawBufferIndex >= this.bufferSize - this.vertexFormat.getNextOffset())
|
||||
+ {
|
||||
+ this.growBuffer(2097152);
|
||||
+ }
|
||||
+ this.func_181670_b(vertexFormat.getNextOffset()/* / 4 * 4 */);
|
||||
+ }
|
||||
+
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java
|
||||
@@ -25,32 +25,9 @@
|
||||
|
||||
for (int j = 0; j < list.size(); ++j)
|
||||
{
|
||||
+ // moved to VertexFormatElement.preDraw
|
||||
VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j);
|
||||
- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage();
|
||||
- int k = vertexformatelement.getType().getGlConstant();
|
||||
- int l = vertexformatelement.getIndex();
|
||||
- bytebuffer.position(vertexformat.func_181720_d(j));
|
||||
-
|
||||
- switch (vertexformatelement$enumusage)
|
||||
- {
|
||||
- case POSITION:
|
||||
- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
- break;
|
||||
- case UV:
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l);
|
||||
- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
- break;
|
||||
- case COLOR:
|
||||
- GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
|
||||
- break;
|
||||
- case NORMAL:
|
||||
- GL11.glNormalPointer(k, i, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
- }
|
||||
+ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer);
|
||||
}
|
||||
|
||||
GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount());
|
||||
@@ -59,26 +36,8 @@
|
||||
for (int j1 = list.size(); i1 < j1; ++i1)
|
||||
{
|
||||
VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1);
|
||||
- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage();
|
||||
- int k1 = vertexformatelement1.getIndex();
|
||||
-
|
||||
- switch (vertexformatelement$enumusage1)
|
||||
- {
|
||||
- case POSITION:
|
||||
- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
- break;
|
||||
- case UV:
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1);
|
||||
- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
- break;
|
||||
- case COLOR:
|
||||
- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
|
||||
- GlStateManager.resetColor();
|
||||
- break;
|
||||
- case NORMAL:
|
||||
- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
- }
|
||||
+ // moved to VertexFormatElement.postDraw
|
||||
+ vertexformatelement1.getUsage().postDraw(vertexformat, j1, i, bytebuffer);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,3 +12,57 @@
|
|||
int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade);
|
||||
EnumFacing enumfacing = getFacingFromVertexData(aint);
|
||||
|
||||
@@ -34,11 +39,17 @@
|
||||
this.func_178408_a(aint, enumfacing);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing);
|
||||
return new BakedQuad(aint, face.tintIndex, enumfacing);
|
||||
}
|
||||
|
||||
private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade)
|
||||
{
|
||||
+ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, p_178405_5_, p_178405_6_, p_178405_7_, shade);
|
||||
+ }
|
||||
+
|
||||
+ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade)
|
||||
+ {
|
||||
int[] aint = new int[28];
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
@@ -89,7 +100,12 @@
|
||||
|
||||
private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
|
||||
{
|
||||
- EnumFacing enumfacing = modelRotationIn.rotateFace(facing);
|
||||
+ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, modelRotationIn, partRotation, uvLocked, shade);
|
||||
+ }
|
||||
+
|
||||
+ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
|
||||
+ {
|
||||
+ EnumFacing enumfacing = modelRotationIn.rotate(facing);
|
||||
int i = shade ? this.getFaceShadeColor(enumfacing) : -1;
|
||||
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex);
|
||||
Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]);
|
||||
@@ -155,14 +171,19 @@
|
||||
|
||||
public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked)
|
||||
{
|
||||
+ return rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked);
|
||||
+ }
|
||||
+
|
||||
+ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked)
|
||||
+ {
|
||||
if (modelRotationIn == ModelRotation.X0_Y0)
|
||||
{
|
||||
return vertexIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
- this.rotateScale(position, new Vector3f(0.5F, 0.5F, 0.5F), modelRotationIn.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F));
|
||||
- return modelRotationIn.rotateVertex(facing, vertexIndex);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix());
|
||||
+ return modelRotationIn.rotate(facing, vertexIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
|
||||
@@ -132,7 +132,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- iblockaccess = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
|
||||
+ iblockaccess = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
|
||||
p_178581_4_.setCompiledChunk(compiledchunk);
|
||||
}
|
||||
finally
|
||||
@@ -159,7 +159,7 @@
|
||||
lvt_10_1_.func_178606_a(blockpos$mutableblockpos);
|
||||
}
|
||||
|
@ -9,7 +18,18 @@
|
|||
{
|
||||
TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos));
|
||||
TileEntitySpecialRenderer<TileEntity> tileentityspecialrenderer = TileEntityRendererDispatcher.instance.<TileEntity>getSpecialRenderer(tileentity);
|
||||
@@ -190,6 +190,7 @@
|
||||
@@ -175,7 +175,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer();
|
||||
+ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) {
|
||||
+ if(!block.canRenderInLayer(enumworldblocklayer1)) continue;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1);
|
||||
int j = enumworldblocklayer1.ordinal();
|
||||
|
||||
if (block.getRenderType() != -1)
|
||||
@@ -190,6 +192,7 @@
|
||||
|
||||
aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer);
|
||||
}
|
||||
|
@ -17,7 +37,7 @@
|
|||
}
|
||||
|
||||
for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values())
|
||||
@@ -386,6 +387,26 @@
|
||||
@@ -386,6 +389,26 @@
|
||||
return this.needsUpdate;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,14 +9,58 @@
|
|||
this.registerItems();
|
||||
}
|
||||
|
||||
@@ -250,6 +250,10 @@
|
||||
{
|
||||
GlStateManager.scale(2.0F, 2.0F, 2.0F);
|
||||
@@ -227,7 +227,7 @@
|
||||
k = k | -16777216;
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount());
|
||||
+ }
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
- this.renderQuad(renderer, bakedquad, k);
|
||||
+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +297,11 @@
|
||||
modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory");
|
||||
}
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ // TODO: add back getModel; maybe switch to the smart player model / normal smart item model?
|
||||
+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount());
|
||||
+ }
|
||||
|
||||
if (modelresourcelocation != null)
|
||||
{
|
||||
@@ -318,14 +323,9 @@
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.pushMatrix();
|
||||
- ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms();
|
||||
- itemcameratransforms.func_181689_a(cameraTransformType);
|
||||
+ // TODO: check if negative scale is a thing
|
||||
+ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType);
|
||||
|
||||
- if (this.func_183005_a(itemcameratransforms.func_181688_b(cameraTransformType)))
|
||||
- {
|
||||
- GlStateManager.cullFace(1028);
|
||||
- }
|
||||
-
|
||||
this.renderItem(stack, model);
|
||||
GlStateManager.cullFace(1029);
|
||||
GlStateManager.popMatrix();
|
||||
@@ -353,7 +353,7 @@
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setupGuiTransform(x, y, ibakedmodel.isGui3d());
|
||||
- ibakedmodel.getItemCameraTransforms().func_181689_a(ItemCameraTransforms.TransformType.GUI);
|
||||
+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI);
|
||||
this.renderItem(stack, ibakedmodel);
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
@@ -1048,6 +1048,7 @@
|
||||
this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block");
|
||||
this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block");
|
||||
this.registerBlock(Blocks.dragon_egg, "dragon_egg");
|
||||
+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher);
|
||||
}
|
||||
|
||||
public void onResourceManagerReload(IResourceManager resourceManager)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java
|
||||
@@ -144,10 +144,17 @@
|
||||
NORMAL("Normal"),
|
||||
COLOR("Vertex Color"),
|
||||
UV("UV"),
|
||||
+ // As of 1.8.8 - unused in vanilla; use GENERIC for now
|
||||
+ @Deprecated
|
||||
MATRIX("Bone Matrix"),
|
||||
+ @Deprecated
|
||||
BLEND_WEIGHT("Blend Weight"),
|
||||
- PADDING("Padding");
|
||||
+ PADDING("Padding"),
|
||||
+ GENERIC("Generic");
|
||||
|
||||
+ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); }
|
||||
+ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); }
|
||||
+
|
||||
private final String displayName;
|
||||
private static final String __OBFID = "CL_00002397";
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
catch (Exception var6)
|
||||
{
|
||||
- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation);
|
||||
+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, exception);
|
||||
+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var6);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -48,6 +48,22 @@
|
|||
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle")));
|
||||
SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite);
|
||||
|
||||
@@ -465,13 +476,13 @@
|
||||
BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing);
|
||||
TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture)));
|
||||
|
||||
- if (blockpartface.cullFace == null)
|
||||
+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix()))
|
||||
{
|
||||
simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
|
||||
}
|
||||
else
|
||||
{
|
||||
- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
|
||||
+ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,6 +492,11 @@
|
||||
|
||||
private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_)
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
+ // moved to VertexFormatElement.preDraw
|
||||
vertexformatelement = (VertexFormatElement)iterator.next();
|
||||
- enumusage = vertexformatelement.getUsage();
|
||||
- k = vertexformatelement.getType().getGlConstant();
|
||||
- int l = vertexformatelement.getIndex();
|
||||
-
|
||||
- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()])
|
||||
- {
|
||||
- case 1:
|
||||
- bytebuffer.position(vertexformatelement.getOffset());
|
||||
- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, j, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
- break;
|
||||
- case 2:
|
||||
- bytebuffer.position(vertexformatelement.getOffset());
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l);
|
||||
- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, j, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
- break;
|
||||
- case 3:
|
||||
- bytebuffer.position(vertexformatelement.getOffset());
|
||||
- GL11.glColorPointer(vertexformatelement.getElementCount(), k, j, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
|
||||
- break;
|
||||
- case 4:
|
||||
- bytebuffer.position(vertexformatelement.getOffset());
|
||||
- GL11.glNormalPointer(k, j, bytebuffer);
|
||||
- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
- }
|
||||
+ vertexformatelement.getUsage().preDraw(vertexformatelement, j, bytebuffer);
|
||||
}
|
||||
|
||||
GL11.glDrawArrays(p_178177_1_.getDrawMode(), 0, p_178177_1_.getVertexCount());
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 2
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
+ // moved to VertexFormatElement.postDraw
|
||||
vertexformatelement = (VertexFormatElement)iterator.next();
|
||||
- enumusage = vertexformatelement.getUsage();
|
||||
- k = vertexformatelement.getIndex();
|
||||
-
|
||||
- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()])
|
||||
- {
|
||||
- case 1:
|
||||
- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
- break;
|
||||
- case 2:
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k);
|
||||
- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
- break;
|
||||
- case 3:
|
||||
- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
|
||||
- GlStateManager.resetColor();
|
||||
- break;
|
||||
- case 4:
|
||||
- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
- }
|
||||
+ vertexformatelement.getUsage().postDraw(vertexformatelement, j, bytebuffer);
|
||||
}
|
||||
}
|
||||
|
||||
++++ END PATCH
|
|
@ -1,57 +0,0 @@
|
|||
++++ REJECTED PATCH 2
|
||||
this.func_178408_a(aint, enumfacing1);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1);
|
||||
return new BakedQuad(aint, face.tintIndex, enumfacing1);
|
||||
}
|
||||
|
||||
private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade)
|
||||
{
|
||||
+ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, (net.minecraftforge.client.model.ITransformation)p_178405_5_, p_178405_6_, p_178405_7_, shade);
|
||||
+ }
|
||||
+
|
||||
+ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade)
|
||||
+ {
|
||||
int[] aint = new int[28];
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 3
|
||||
|
||||
private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
|
||||
{
|
||||
- EnumFacing enumfacing1 = modelRotationIn.rotateFace(facing);
|
||||
+ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade);
|
||||
+ }
|
||||
+
|
||||
+ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
|
||||
+ {
|
||||
+ EnumFacing enumfacing1 = modelRotationIn.rotate(facing);
|
||||
int j = shade ? this.getFaceShadeColor(enumfacing1) : -1;
|
||||
EnumFaceDirection.VertexInformation vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex);
|
||||
Vector3d vector3d = new Vector3d((double)p_178402_5_[vertexinformation.field_179184_a], (double)p_178402_5_[vertexinformation.field_179182_b], (double)p_178402_5_[vertexinformation.field_179183_c]);
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 4
|
||||
|
||||
public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked)
|
||||
{
|
||||
+ return rotateVertex(position, facing, vertexIndex, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked);
|
||||
+ }
|
||||
+
|
||||
+ public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked)
|
||||
+ {
|
||||
if (modelRotationIn == ModelRotation.X0_Y0)
|
||||
{
|
||||
return vertexIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
- this.rotateScale(position, new Vector3d(0.5D, 0.5D, 0.5D), modelRotationIn.getMatrix4d(), new Vector3d(1.0D, 1.0D, 1.0D));
|
||||
- return modelRotationIn.rotateVertex(facing, vertexIndex);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix());
|
||||
+ return modelRotationIn.rotate(facing, vertexIndex);
|
||||
}
|
||||
}
|
||||
|
||||
++++ END PATCH
|
|
@ -1,22 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
return;
|
||||
}
|
||||
|
||||
- regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
|
||||
+ regionrendercache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
|
||||
p_178581_4_.setCompiledChunk(compiledchunk);
|
||||
}
|
||||
finally
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 3
|
||||
}
|
||||
}
|
||||
|
||||
- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer();
|
||||
+ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) {
|
||||
+ if(!block.canRenderInLayer(enumworldblocklayer1)) continue;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1);
|
||||
int i = enumworldblocklayer1.ordinal();
|
||||
|
||||
if (block.getRenderType() != -1)
|
||||
++++ END PATCH
|
|
@ -1,62 +1,3 @@
|
|||
++++ REJECTED PATCH 2
|
||||
BakedQuad bakedquad;
|
||||
int j;
|
||||
|
||||
- for (Iterator iterator = quads.iterator(); iterator.hasNext(); this.renderQuad(renderer, bakedquad, j))
|
||||
+ for (Iterator iterator = quads.iterator(); iterator.hasNext(); net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, j))
|
||||
{
|
||||
bakedquad = (BakedQuad)iterator.next();
|
||||
j = color;
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 4
|
||||
|
||||
protected void applyTransform(ItemTransformVec3f transform)
|
||||
{
|
||||
+ applyVanillaTransform(transform);
|
||||
+ }
|
||||
+
|
||||
+ public static void applyVanillaTransform(ItemTransformVec3f transform)
|
||||
+ {
|
||||
if (transform != ItemTransformVec3f.DEFAULT)
|
||||
{
|
||||
GlStateManager.translate(transform.translation.x + debugItemOffsetX, transform.translation.y + debugItemOffsetY, transform.translation.z + debugItemOffsetZ);
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 5
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
- switch (RenderItem.SwitchTransformType.TRANSFORM_LOOKUP[cameraTransformType.ordinal()])
|
||||
- {
|
||||
- case 1:
|
||||
- default:
|
||||
- break;
|
||||
- case 2:
|
||||
- this.applyTransform(model.getItemCameraTransforms().thirdPerson);
|
||||
- break;
|
||||
- case 3:
|
||||
- this.applyTransform(model.getItemCameraTransforms().firstPerson);
|
||||
- break;
|
||||
- case 4:
|
||||
- this.applyTransform(model.getItemCameraTransforms().head);
|
||||
- break;
|
||||
- case 5:
|
||||
- this.applyTransform(model.getItemCameraTransforms().gui);
|
||||
- }
|
||||
+ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType);
|
||||
|
||||
this.renderItem(stack, model);
|
||||
GlStateManager.popMatrix();
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 6
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setupGuiTransform(x, y, ibakedmodel.isGui3d());
|
||||
- this.applyTransform(ibakedmodel.getItemCameraTransforms().gui);
|
||||
+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI);
|
||||
this.renderItem(stack, ibakedmodel);
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 7
|
||||
GlStateManager.enableDepth();
|
||||
}
|
||||
|
@ -84,12 +25,6 @@
|
|||
GlStateManager.enableLighting();
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 9
|
||||
this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block");
|
||||
this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block");
|
||||
this.registerBlock(Blocks.dragon_egg, "dragon_egg");
|
||||
+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher);
|
||||
}
|
||||
|
||||
public void onResourceManagerReload(IResourceManager resourceManager)
|
||||
{
|
||||
this.itemModelMesher.rebuildCache();
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static enum EnumType
|
||||
{
|
||||
- FLOAT(4, "Float", 5126),
|
||||
- UBYTE(1, "Unsigned Byte", 5121),
|
||||
- BYTE(1, "Byte", 5120),
|
||||
- USHORT(2, "Unsigned Short", 5123),
|
||||
- SHORT(2, "Short", 5122),
|
||||
- UINT(4, "Unsigned Int", 5125),
|
||||
- INT(4, "Int", 5124);
|
||||
+ FLOAT(4, "Float", org.lwjgl.opengl.GL11.GL_FLOAT),
|
||||
+ UBYTE(1, "Unsigned Byte", org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE),
|
||||
+ BYTE(1, "Byte", org.lwjgl.opengl.GL11.GL_BYTE),
|
||||
+ USHORT(2, "Unsigned Short", org.lwjgl.opengl.GL11.GL_UNSIGNED_SHORT),
|
||||
+ SHORT(2, "Short", org.lwjgl.opengl.GL11.GL_SHORT),
|
||||
+ UINT(4, "Unsigned Int", org.lwjgl.opengl.GL11.GL_UNSIGNED_INT),
|
||||
+ INT(4, "Int", org.lwjgl.opengl.GL11.GL_INT);
|
||||
+ // Commented for now, might be added in the future if anyone needs them
|
||||
+ //HALF_FLOAT(2, "Half Float", org.lwjgl.opengl.GL30.GL_HALF_FLOAT),
|
||||
+ //DOUBLE(8, "Double", org.lwjgl.opengl.GL11.GL_DOUBLE),
|
||||
+ //INT_2_10_10_10_REV(4, "Int 2-10-10-10 reversed", org.lwjgl.opengl.GL33.GL_INT_2_10_10_10_REV),
|
||||
+ //UINT_2_10_10_10_REV(4, "Unsigned Int 2-10-10-10 reversed", org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_2_10_10_10_REV),
|
||||
+ //UINT_10F_11F_11F_REV(4, "Unsigned Int 10F 11F 11F reversed", GL_UNSIGNED_INT_10F_11F_11F_REV);
|
||||
+
|
||||
private final int size;
|
||||
private final String displayName;
|
||||
private final int glConstant;
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 2
|
||||
NORMAL("Normal"),
|
||||
COLOR("Vertex Color"),
|
||||
UV("UV"),
|
||||
+ // As of 1.8 - unused in vanilla; use GENERIC for now
|
||||
+ @Deprecated
|
||||
MATRIX("Bone Matrix"),
|
||||
+ @Deprecated
|
||||
BLEND_WEIGHT("Blend Weight"),
|
||||
- PADDING("Padding");
|
||||
+ PADDING("Padding"),
|
||||
+ GENERIC("Generic Attribute");
|
||||
+
|
||||
+ public void preDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, element, stride, buffer); }
|
||||
+ public void postDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, element, stride, buffer); }
|
||||
+
|
||||
private final String displayName;
|
||||
|
||||
private static final String __OBFID = "CL_00002397";
|
||||
++++ END PATCH
|
|
@ -1,17 +0,0 @@
|
|||
++++ REJECTED PATCH 6
|
||||
BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing);
|
||||
TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture)));
|
||||
|
||||
- if (blockpartface.cullFace == null)
|
||||
+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix()))
|
||||
{
|
||||
builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
|
||||
}
|
||||
else
|
||||
{
|
||||
- builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
|
||||
+ builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
|
||||
}
|
||||
}
|
||||
}
|
||||
++++ END PATCH
|
|
@ -37,6 +37,7 @@ import net.minecraft.client.renderer.texture.TextureManager;
|
|||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
@ -72,6 +73,7 @@ import net.minecraftforge.client.event.TextureStitchEvent;
|
|||
import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.TRSRTransformation;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
|
@ -87,6 +89,8 @@ import org.lwjgl.opengl.GL11;
|
|||
//import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public class ForgeHooksClient
|
||||
|
@ -518,7 +522,7 @@ public class ForgeHooksClient
|
|||
{
|
||||
javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f();
|
||||
m.setIdentity();
|
||||
m.setTranslation(transform.translation);
|
||||
m.setTranslation(TRSRTransformation.toVecmath(transform.translation));
|
||||
t.setIdentity();
|
||||
t.rotY(transform.rotation.y);
|
||||
m.mul(t);
|
||||
|
@ -547,23 +551,7 @@ public class ForgeHooksClient
|
|||
}
|
||||
else
|
||||
{
|
||||
switch(cameraTransformType)
|
||||
{
|
||||
case FIRST_PERSON:
|
||||
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().firstPerson);
|
||||
break;
|
||||
case GUI:
|
||||
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().gui);
|
||||
break;
|
||||
case HEAD:
|
||||
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().head);
|
||||
break;
|
||||
case THIRD_PERSON:
|
||||
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().thirdPerson);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
model.getItemCameraTransforms().func_181689_a(cameraTransformType);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
@ -585,9 +573,10 @@ public class ForgeHooksClient
|
|||
|
||||
// moved and expanded from WorldVertexBufferUploader.draw
|
||||
|
||||
public static void preDraw(EnumUsage attrType, VertexFormatElement attr, int stride, ByteBuffer buffer)
|
||||
public static void preDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer)
|
||||
{
|
||||
buffer.position(attr.getOffset());
|
||||
VertexFormatElement attr = format.getElement(element);
|
||||
buffer.position(format.func_181720_d(element));
|
||||
switch(attrType)
|
||||
{
|
||||
case POSITION:
|
||||
|
@ -622,8 +611,9 @@ public class ForgeHooksClient
|
|||
}
|
||||
}
|
||||
|
||||
public static void postDraw(EnumUsage attrType, VertexFormatElement attr, int stride, ByteBuffer buffer)
|
||||
public static void postDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer)
|
||||
{
|
||||
VertexFormatElement attr = format.getElement(element);
|
||||
switch(attrType)
|
||||
{
|
||||
case POSITION:
|
||||
|
@ -651,9 +641,9 @@ public class ForgeHooksClient
|
|||
}
|
||||
}
|
||||
|
||||
public static void transform(Vector3d vec, Matrix4f m)
|
||||
public static void transform(org.lwjgl.util.vector.Vector3f vec, Matrix4f m)
|
||||
{
|
||||
Vector4f tmp = new Vector4f((float)vec.x, (float)vec.y, (float)vec.z, 1f);
|
||||
Vector4f tmp = new Vector4f(vec.x, vec.y, vec.z, 1f);
|
||||
m.transform(tmp);
|
||||
if(Math.abs(tmp.w - 1f) > 1e-5) tmp.scale(1f / tmp.w);
|
||||
vec.set(tmp.x, tmp.y, tmp.z);
|
||||
|
@ -661,7 +651,7 @@ public class ForgeHooksClient
|
|||
|
||||
public static Matrix4f getMatrix(ModelRotation modelRotation)
|
||||
{
|
||||
Matrix4f ret = new Matrix4f(modelRotation.getMatrix4d()), tmp = new Matrix4f();
|
||||
Matrix4f ret = new Matrix4f(TRSRTransformation.toVecmath(modelRotation.getMatrix4d())), tmp = new Matrix4f();
|
||||
tmp.setIdentity();
|
||||
tmp.m03 = tmp.m13 = tmp.m23 = .5f;
|
||||
ret.mul(tmp, ret);
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package net.minecraftforge.client.model;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.vecmath.Vector4f;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumType;
|
||||
|
@ -22,10 +17,10 @@ public class Attributes
|
|||
static
|
||||
{
|
||||
DEFAULT_BAKED_FORMAT = new VertexFormat();
|
||||
DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.POSITION, 3));
|
||||
DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.UBYTE, EnumUsage.COLOR, 4));
|
||||
DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.UV, 2));
|
||||
DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.BYTE, EnumUsage.PADDING, 4));
|
||||
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.POSITION, 3));
|
||||
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.UBYTE, EnumUsage.COLOR, 4));
|
||||
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.UV, 2));
|
||||
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.BYTE, EnumUsage.PADDING, 4));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -73,80 +68,4 @@ public class Attributes
|
|||
if(padding != 0 || j != second.getElementCount()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use UnpackedBakedQuad.Builder
|
||||
*/
|
||||
@Deprecated
|
||||
public static void put(ByteBuffer buf, VertexFormatElement e, boolean denormalize, Number fill, Number... ns)
|
||||
{
|
||||
if(e.getElementCount() > ns.length && fill == null) throw new IllegalArgumentException("not enough elements");
|
||||
Number n;
|
||||
for(int i = 0; i < e.getElementCount(); i++)
|
||||
{
|
||||
if(i < ns.length) n = ns[i];
|
||||
else n = fill;
|
||||
switch(e.getType())
|
||||
{
|
||||
case BYTE:
|
||||
buf.put(denormalize ? (byte)(n.floatValue() * (Byte.MAX_VALUE - 1)) : n.byteValue());
|
||||
break;
|
||||
case UBYTE:
|
||||
buf.put(denormalize ? (byte)(n.floatValue() * ((1 << Byte.SIZE) - 1)) : n.byteValue());
|
||||
break;
|
||||
case SHORT:
|
||||
buf.putShort(denormalize ? (short)(n.floatValue() * (Short.MAX_VALUE - 1)) : n.shortValue());
|
||||
break;
|
||||
case USHORT:
|
||||
buf.putShort(denormalize ? (short)(n.floatValue() * ((1 << Short.SIZE) - 1)) : n.shortValue());
|
||||
break;
|
||||
case INT:
|
||||
buf.putInt(denormalize ? (int)(n.doubleValue() * (Integer.MAX_VALUE - 1)) : n.intValue());
|
||||
break;
|
||||
case UINT:
|
||||
buf.putInt(denormalize ? (int)(n.doubleValue() * ((1L << Integer.SIZE) - 1)) : n.intValue());
|
||||
break;
|
||||
case FLOAT:
|
||||
buf.putFloat(n.floatValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use IVertexConsumer
|
||||
*/
|
||||
@Deprecated
|
||||
public static BakedQuad transform(TRSRTransformation transform, BakedQuad quad, VertexFormat format)
|
||||
{
|
||||
for (VertexFormatElement e : (List<VertexFormatElement>)format.getElements())
|
||||
{
|
||||
if (e.getUsage() == VertexFormatElement.EnumUsage.POSITION)
|
||||
{
|
||||
if (e.getType() != VertexFormatElement.EnumType.FLOAT)
|
||||
{
|
||||
throw new IllegalArgumentException("can only transform float position");
|
||||
}
|
||||
int[] data = Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length);
|
||||
int shift = data.length / 4;
|
||||
for(int v = 0; v < 4; v++)
|
||||
{
|
||||
float[] pos = new float[] { 0f, 0f, 0f, 1f };
|
||||
for (int i = 0; i < Math.min(4, e.getElementCount()); i++)
|
||||
{
|
||||
pos[i] = Float.intBitsToFloat(data[shift * v + e.getOffset() / 4 + i]);
|
||||
}
|
||||
Vector4f vec = new Vector4f(pos);
|
||||
transform.getMatrix().transform(vec);
|
||||
vec.get(pos);
|
||||
for (int i = 0; i < Math.min(4, e.getElementCount()); i++)
|
||||
{
|
||||
data[shift * v + e.getOffset() / 4 + i] = Float.floatToRawIntBits(pos[i]);
|
||||
}
|
||||
}
|
||||
return new BakedQuad(data, quad.getTintIndex(), quad.getFace());
|
||||
}
|
||||
}
|
||||
return quad;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ public class ModelLoader extends ModelBakery
|
|||
}
|
||||
ModelBlock model = this.model;
|
||||
if(model == null) return getMissingModel().bake(state, format, bakedTextureGetter);
|
||||
ItemCameraTransforms transforms = new ItemCameraTransforms(model.getThirdPersonTransform(), model.getFirstPersonTransform(), model.getHeadTransform(), model.getInGuiTransform());
|
||||
ItemCameraTransforms transforms = model.func_181682_g();
|
||||
boolean uvlock = false;
|
||||
if(state instanceof UVLock)
|
||||
{
|
||||
|
@ -391,7 +391,7 @@ public class ModelLoader extends ModelBakery
|
|||
|
||||
ModelBlock neweModel = new ModelBlock(this.model.getParentLocation(), elements,
|
||||
Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT
|
||||
new ItemCameraTransforms(this.model.getThirdPersonTransform(), this.model.getFirstPersonTransform(), this.model.getHeadTransform(), this.model.getInGuiTransform()));
|
||||
model.func_181682_g());
|
||||
neweModel.name = this.model.name;
|
||||
neweModel.parent = this.model.parent;
|
||||
|
||||
|
@ -700,7 +700,14 @@ public class ModelLoader extends ModelBakery
|
|||
graphics.clearRect(0, 0, 16, 16);
|
||||
BufferedImage[] images = new BufferedImage[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1];
|
||||
images[0] = image;
|
||||
loadSprite(images, null);
|
||||
try
|
||||
{
|
||||
loadSprite(images, null);
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class TRSRTransformation implements IModelState, ITransformation
|
|||
|
||||
public static Matrix4f getMatrix(ItemTransformVec3f transform)
|
||||
{
|
||||
TRSRTransformation ret = new TRSRTransformation(transform.translation, quatFromYXZDegrees(transform.rotation), transform.scale, null);
|
||||
TRSRTransformation ret = new TRSRTransformation(toVecmath(transform.translation), quatFromYXZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null);
|
||||
return blockCenterToCorner(ret).getMatrix();
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ public class TRSRTransformation implements IModelState, ITransformation
|
|||
*/
|
||||
public ItemTransformVec3f toItemTransform()
|
||||
{
|
||||
return new ItemTransformVec3f(getTranslation(), toYXZ(getLeftRot()), getScale());
|
||||
return new ItemTransformVec3f(toLwjgl(getTranslation()), toLwjgl(toYXZ(getLeftRot())), toLwjgl(getScale()));
|
||||
}
|
||||
|
||||
public Matrix4f getMatrix()
|
||||
|
@ -566,4 +566,55 @@ public class TRSRTransformation implements IModelState, ITransformation
|
|||
else if (!matrix.equals(other.matrix)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Vector3f toVecmath(org.lwjgl.util.vector.Vector3f vec)
|
||||
{
|
||||
return new Vector3f(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
public static Vector4f toVecmath(org.lwjgl.util.vector.Vector4f vec)
|
||||
{
|
||||
return new Vector4f(vec.x, vec.y, vec.z, vec.w);
|
||||
}
|
||||
|
||||
public static Matrix4f toVecmath(org.lwjgl.util.vector.Matrix4f m)
|
||||
{
|
||||
return new Matrix4f(
|
||||
m.m00, m.m10, m.m20, m.m30,
|
||||
m.m01, m.m11, m.m21, m.m31,
|
||||
m.m02, m.m12, m.m22, m.m32,
|
||||
m.m03, m.m13, m.m23, m.m33);
|
||||
}
|
||||
|
||||
public static org.lwjgl.util.vector.Vector3f toLwjgl(Vector3f vec)
|
||||
{
|
||||
return new org.lwjgl.util.vector.Vector3f(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
public static org.lwjgl.util.vector.Vector4f toLwjgl(Vector4f vec)
|
||||
{
|
||||
return new org.lwjgl.util.vector.Vector4f(vec.x, vec.y, vec.z, vec.w);
|
||||
}
|
||||
|
||||
public static org.lwjgl.util.vector.Matrix4f toLwjgl(Matrix4f m)
|
||||
{
|
||||
org.lwjgl.util.vector.Matrix4f r = new org.lwjgl.util.vector.Matrix4f();
|
||||
r.m00 = m.m00;
|
||||
r.m01 = m.m10;
|
||||
r.m02 = m.m20;
|
||||
r.m03 = m.m30;
|
||||
r.m10 = m.m01;
|
||||
r.m11 = m.m11;
|
||||
r.m12 = m.m21;
|
||||
r.m13 = m.m31;
|
||||
r.m20 = m.m02;
|
||||
r.m21 = m.m12;
|
||||
r.m22 = m.m22;
|
||||
r.m23 = m.m32;
|
||||
r.m30 = m.m03;
|
||||
r.m31 = m.m13;
|
||||
r.m32 = m.m23;
|
||||
r.m33 = m.m33;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class LightUtil
|
|||
{
|
||||
if(i < element.getElementCount())
|
||||
{
|
||||
int pos = v * formatFrom.getNextOffset() + element.getOffset() + element.getType().getSize() * i;
|
||||
int pos = v * formatFrom.getNextOffset() + formatFrom.func_181720_d(e) + element.getType().getSize() * i;
|
||||
int index = pos >> 2;
|
||||
int offset = pos & 3;
|
||||
int bits = from[index];
|
||||
|
@ -187,7 +187,7 @@ public class LightUtil
|
|||
{
|
||||
if(i < element.getElementCount())
|
||||
{
|
||||
int pos = v * formatTo.getNextOffset() + element.getOffset() + element.getType().getSize() * i;
|
||||
int pos = v * formatTo.getNextOffset() + formatTo.func_181720_d(e) + element.getType().getSize() * i;
|
||||
int index = pos >> 2;
|
||||
int offset = pos & 3;
|
||||
int bits = 0;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
|||
VertexFormat format = parent.getVertexFormat();
|
||||
if(format.hasNormal()) return format;
|
||||
format = new VertexFormat(format);
|
||||
format.setElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.NORMAL, 4));
|
||||
format.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.NORMAL, 4));
|
||||
return format;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ net/minecraft/block/state/BlockState.<init>(Lnet/minecraft/block/Block;[Lnet/min
|
|||
net/minecraft/client/renderer/entity/RenderItem.applyVanillaTransform(Lnet/minecraft/client/renderer/block/model/ItemTransformVec3f;)V=|p_175034_1_
|
||||
net/minecraft/client/resources/model/ModelBakery.bakeModel(Lnet/minecraft/client/renderer/block/model/ModelBlock;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/resources/model/IBakedModel;=|p_177578_1_,p_177578_2_,p_177578_3_
|
||||
net/minecraft/client/resources/model/ModelBakery.makeBakedQuad(Lnet/minecraft/client/renderer/block/model/BlockPart;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_177589_1_,p_177589_2_,p_177589_3_,p_177589_4_,p_177589_5_,p_177589_6_
|
||||
net/minecraft/client/renderer/block/model/FaceBakery.makeBakedQuad(Ljavax/vecmath/Vector3f;Ljavax/vecmath/Vector3f;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_178414_1_,p_178414_2_,p_178414_3_,p_178414_4_,p_178414_5_,p_178414_6_,p_178414_7_,p_178414_8_,p_178414_9_
|
||||
net/minecraft/client/renderer/block/model/FaceBakery.makeBakedQuad(Lorg/lwjgl/util/vector/Vector3f;Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_178414_1_,p_178414_2_,p_178414_3_,p_178414_4_,p_178414_5_,p_178414_6_,p_178414_7_,p_178414_8_,p_178414_9_
|
||||
net/minecraft/client/renderer/block/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;[FLnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)[I=|p_178405_1_,p_178405_2_,p_178405_3_,p_178405_4_,p_178405_5_,p_178405_6_,p_178405_7_,p_178405_8_
|
||||
net/minecraft/client/renderer/block/model/FaceBakery.fillVertexData([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/block/model/BlockPartFace;[FLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)V=|p_178402_1_,p_178402_2_,p_178402_3_,p_178402_4_,p_178402_5_,p_178402_6_,p_178402_7_,p_178402_8_,p_178402_9_,p_178402_10_
|
||||
net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Ljavax/vecmath/Vector3d;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/client/model/ITransformation;Z)I=|p_178415_1_,p_178415_2_,p_178415_3_,p_178415_4_,p_178415_5_
|
||||
net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/client/model/ITransformation;Z)I=|p_178415_1_,p_178415_2_,p_178415_3_,p_178415_4_,p_178415_5_
|
||||
|
||||
net/minecraft/item/ItemBlock.setTileEntityNBT(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/EntityPlayer;)Z=|p_179224_0_,p_179224_1_,p_179224_2_,player
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.minecraftforge.debug;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
|
@ -12,9 +10,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelFluid;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
|
|
@ -26,11 +26,11 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -785,7 +785,7 @@ public class ModelLoaderRegistryDebug
|
|||
}
|
||||
}
|
||||
|
||||
public static class OBJDynamicEyeTileEntity extends TileEntity implements IUpdatePlayerListBox
|
||||
public static class OBJDynamicEyeTileEntity extends TileEntity implements ITickable
|
||||
{
|
||||
public OBJModel.OBJState state;
|
||||
|
||||
|
@ -803,7 +803,7 @@ public class ModelLoaderRegistryDebug
|
|||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
Vector3d playerLoc = new Vector3d();
|
||||
playerLoc.setX(player.posX);
|
||||
playerLoc.setY(player.posY + player.eyeHeight);
|
||||
playerLoc.setY(player.posY + player.getEyeHeight());
|
||||
playerLoc.setZ(player.posZ);
|
||||
Vector3d lookVec = new Vector3d(playerLoc.getX() - teLoc.getX(), playerLoc.getY() - teLoc.getY(), playerLoc.getZ() - teLoc.getZ());
|
||||
double angleYaw = Math.atan2(lookVec.getZ(), lookVec.getX()) - Math.PI/2d;
|
||||
|
|
Loading…
Reference in a new issue