| 1 | package net.minecraft.client.renderer.entity;
|
| 2 |
|
| 3 | import net.minecraft.client.renderer.GlStateManager;
|
| 4 | import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
| 5 | import net.minecraft.client.renderer.texture.TextureMap;
|
| 6 | import net.minecraft.entity.Entity;
|
| 7 | import net.minecraft.item.Item;
|
| 8 | import net.minecraft.item.ItemStack;
|
| 9 | import net.minecraft.util.ResourceLocation;
|
| 10 |
|
| 11 | public class RenderSnowball<T extends Entity> extends Render<T>
|
| 12 | {
|
| 13 | protected final Item field_177084_a;
|
| 14 | private final RenderItem field_177083_e;
|
| 15 |
|
| 16 | public RenderSnowball(RenderManager renderManagerIn, Item p_i46137_2_, RenderItem p_i46137_3_)
|
| 17 | {
|
| 18 | super(renderManagerIn);
|
| 19 | this.field_177084_a = p_i46137_2_;
|
| 20 | this.field_177083_e = p_i46137_3_;
|
| 21 | }
|
| 22 |
|
| 23 | /**
|
| 24 | * Renders the desired {@code T} type Entity.
|
| 25 | */
|
| 26 | public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks)
|
| 27 | {
|
| 28 | GlStateManager.pushMatrix();
|
| 29 | GlStateManager.translate((float)x, (float)y, (float)z);
|
| 30 | GlStateManager.enableRescaleNormal();
|
| 31 | GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
| 32 | GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
| 33 | GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
| 34 | this.bindTexture(TextureMap.locationBlocksTexture);
|
| 35 | this.field_177083_e.renderItem(this.func_177082_d(entity), ItemCameraTransforms.TransformType.GROUND);
|
| 36 | GlStateManager.disableRescaleNormal();
|
| 37 | GlStateManager.popMatrix();
|
| 38 | super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
| 39 | }
|
| 40 |
|
| 41 | public ItemStack func_177082_d(T entityIn)
|
| 42 | {
|
| 43 | return new ItemStack(this.field_177084_a, 1, 0);
|
| 44 | }
|
| 45 |
|
| 46 | /**
|
| 47 | * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
| 48 | */
|
| 49 | protected ResourceLocation getEntityTexture(Entity entity)
|
| 50 | {
|
| 51 | return TextureMap.locationBlocksTexture;
|
| 52 | }
|
| 53 | }
|
| 54 |
|