1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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;
}
}
|