Commit ff0a8b0e authored by Bailey's avatar Bailey 🚟

gears now render properly!

parent 6a9a6e46
package com.legacy.rediscovered.client;
import com.legacy.rediscovered.client.render.tile_entity.GearRenderer;
import com.legacy.rediscovered.tile_entity.RediscoveredTileEntities;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.registry.ClientRegistry;
@OnlyIn(Dist.CLIENT)
public class RediscoveredTileEntityRendering
{
public static void init()
{
/*ClientRegistry.bindTileEntitySpecialRenderer(GearTileEntity.class, new GearRenderer());*/
ClientRegistry.bindTileEntityRenderer(RediscoveredTileEntities.gear, GearRenderer::new);
}
}
......@@ -10,27 +10,22 @@ import net.minecraft.client.renderer.model.ModelRenderer;
public class GearModel extends Model
{
ModelRenderer down;
public GearModel()
{
super(RenderType::getEntityCutoutNoCull);
this.textureHeight = 16;
this.textureWidth = 16;
down = new ModelRenderer(this, 0, 0);
down.addBox(-8, -6.5f, -8, 16, 0, 16);
down.setRotationPoint(0, 0, 0);
down.setTextureSize(16, 16);
}
/*public void render()
{
this.down.render(1.0F);
}*/
@Override
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha)
{
this.down.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.down.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
}
}
package com.legacy.rediscovered.client.render.tile_entity;
import com.legacy.rediscovered.RediscoveredMod;
import com.legacy.rediscovered.block.GearBlock.EnumFaces;
import com.legacy.rediscovered.client.render.model.GearModel;
import com.legacy.rediscovered.tile_entity.GearTileEntity;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.ResourceLocation;
......@@ -23,48 +29,51 @@ public class GearRenderer extends TileEntityRenderer<GearTileEntity>
@Override
public void render(GearTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn)
{
/*GlStateManager.pushMatrix();
this.bindTexture(TEXTURE);
GlStateManager.translated(x + 0.5, y + 0.5, z + 0.5);
GlStateManager.disableLighting();
double scale = 1d / 14d;
GlStateManager.scaled(scale, scale, scale);
matrixStackIn.push();
// this.bindTexture(TEXTURE);
IVertexBuilder ivertexbuilder = ItemRenderer.getBuffer(bufferIn, RenderType.getEntityCutout(TEXTURE), false, false);
matrixStackIn.translate(0.5, 0.5, 0.5);
RenderSystem.disableLighting();
double scale = 1.1D;
matrixStackIn.scale((float) scale, (float) scale, (float) scale);
for (EnumFaces enumFace : EnumFaces.values())
{
GlStateManager.pushMatrix();
GlStateManager.rotated(0.25, 1, 0, 1);
matrixStackIn.push();
matrixStackIn.rotate(new Vector3f(1.0F, 0.0F, 1.0F).rotationDegrees(0.25F));
switch (enumFace)
{
case NORTH:
GlStateManager.rotated(90, 1, 0, 0);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(90));
break;
case SOUTH:
GlStateManager.rotated(-90, 1, 0, 0);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(-90));
break;
case EAST:
GlStateManager.rotated(90, 0, 0, 1);
matrixStackIn.rotate(Vector3f.ZP.rotationDegrees(90));
break;
case WEST:
GlStateManager.rotated(-90, 0, 0, 1);
matrixStackIn.rotate(Vector3f.ZP.rotationDegrees(-90));
break;
case UP:
GlStateManager.rotated(180, 1, 0, 0);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(180));
break;
default:
break;
}
GlStateManager.rotated(tile.getAngle(enumFace.direction), 0, 1, 0);
if (tile.getBlockState().get(enumFace.face).exists())
MODEL.render();
GlStateManager.popMatrix();
matrixStackIn.rotate(Vector3f.YP.rotationDegrees(tileEntityIn.getAngle(enumFace.direction)));
if (tileEntityIn.getBlockState().get(enumFace.face).exists())
MODEL.render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn, 1.0F, 1.0F, 1.0F, 1.0F);
matrixStackIn.pop();
}
GlStateManager.enableLighting();
GlStateManager.popMatrix();*/
RenderSystem.enableLighting();
matrixStackIn.pop();
}
// public void render(GearTileEntity tile, double x, double y, double z, float
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment