From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../fbs/entity/render/RenderTableware.java | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java (limited to 'src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java') diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java new file mode 100644 index 0000000..65d0fb2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java @@ -0,0 +1,62 @@ +package jp.plusplus.fbs.entity.render; + +import jp.plusplus.fbs.FBS; +import jp.plusplus.fbs.block.model.ModelFork; +import jp.plusplus.fbs.block.model.ModelKnife; +import jp.plusplus.fbs.block.model.ModelSpoon; +import jp.plusplus.fbs.entity.EntityButterfly; +import jp.plusplus.fbs.entity.EntityTableware; +import jp.plusplus.fbs.model.ModelButterfly; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +/** + * Created by plusplus_F on 2015/11/16. + */ +public class RenderTableware extends Render { + private static final ResourceLocation textures = new ResourceLocation(FBS.MODID+":textures/entity/Tableware.png"); + protected ModelSpoon spoon=new ModelSpoon(); + protected ModelFork fork=new ModelFork(); + protected ModelKnife knife=new ModelKnife(); + + @Override + public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTick) { + if(!(entity instanceof EntityTableware)) return; + + this.bindEntityTexture(entity); + int meta=((EntityTableware) entity).getItemMetadata(); + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTick, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick, 0.0F, 0.0F, 1.0F); + GL11.glScalef(1.0F*.3f, -1.0F*.3f, -1.0F*.3f); + + switch (meta){ + case 0: + spoon.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + break; + case 1: + knife.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + break; + case 2: + fork.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + break; + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return textures; + } +} -- cgit v1.2.3