mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-24 22:14:31 +00:00
1.6.2 test - Finished liquids, added connected textures on glass
This commit is contained in:
1 parent
40c6f445a2
commit
a80fcbce86
704 files changed
+60909
No files matched your search
@@ -0,0 +1,141 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.entity.CartEntity;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CartRender extends Render
|
||||
{
|
||||
protected ModelBase modelCart;
|
||||
RenderBlocks renderblocks;
|
||||
|
||||
public CartRender()
|
||||
{
|
||||
this.shadowSize = 0.5F;
|
||||
this.modelCart = new ModelPullcart();
|
||||
renderblocks = new RenderBlocks();
|
||||
}
|
||||
|
||||
public void renderPullcart (CartEntity cart, double posX, double posY, double posZ, float par8, float par9)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
long var10 = (long) cart.entityId * 493286711L;
|
||||
var10 = var10 * var10 * 4392167121L + var10 * 98761L;
|
||||
float var12 = (((float) (var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||
float var13 = (((float) (var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||
float var14 = (((float) (var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||
GL11.glTranslatef(var12, var13, var14);
|
||||
double var15 = cart.lastTickPosX + (cart.posX - cart.lastTickPosX) * (double) par9;
|
||||
double var17 = cart.lastTickPosY + (cart.posY - cart.lastTickPosY) * (double) par9;
|
||||
double var19 = cart.lastTickPosZ + (cart.posZ - cart.lastTickPosZ) * (double) par9;
|
||||
double var21 = 0.30000001192092896D;
|
||||
Vec3 var23 = cart.func_70489_a(var15, var17, var19);
|
||||
float var24 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * par9;
|
||||
|
||||
if (var23 != null)
|
||||
{
|
||||
Vec3 var25 = cart.func_70495_a(var15, var17, var19, var21);
|
||||
Vec3 var26 = cart.func_70495_a(var15, var17, var19, -var21);
|
||||
|
||||
if (var25 == null)
|
||||
{
|
||||
var25 = var23;
|
||||
}
|
||||
|
||||
if (var26 == null)
|
||||
{
|
||||
var26 = var23;
|
||||
}
|
||||
|
||||
posX += var23.xCoord - var15;
|
||||
posY += (var25.yCoord + var26.yCoord) / 2.0D - var17;
|
||||
posZ += var23.zCoord - var19;
|
||||
Vec3 var27 = var26.addVector(-var25.xCoord, -var25.yCoord, -var25.zCoord);
|
||||
|
||||
if (var27.lengthVector() != 0.0D)
|
||||
{
|
||||
var27 = var27.normalize();
|
||||
par8 = (float) (Math.atan2(var27.zCoord, var27.xCoord) * 180.0D / Math.PI);
|
||||
var24 = (float) (Math.atan(var27.yCoord) * 73.0D);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTranslatef((float) posX, (float) posY + 0.3125f, (float) posZ);
|
||||
GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F);
|
||||
float var28 = (float) cart.func_70496_j() - par9;
|
||||
float var30 = (float) cart.getDamage() - par9;
|
||||
|
||||
if (var30 < 0.0F)
|
||||
{
|
||||
var30 = 0.0F;
|
||||
}
|
||||
|
||||
if (var28 > 0.0F)
|
||||
{
|
||||
GL11.glRotatef(MathHelper.sin(var28) * var28 * var30 / 10.0F * (float) cart.func_70493_k(), 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (cart.getCartType() != 0)
|
||||
{
|
||||
//this.loadTexture("/terrain.png");
|
||||
float var29 = 0.75F;
|
||||
GL11.glScalef(var29, var29, var29);
|
||||
|
||||
if (cart.getCartType() == 1)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
|
||||
renderblocks.renderBlockAsItem(Block.chest, 0, cart.getBrightness(par9));
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.5F, 0.0F, -0.5F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else if (cart.getCartType() == 2)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.3125F, 0.0F);
|
||||
renderblocks.renderBlockAsItem(Block.furnaceIdle, 0, cart.getBrightness(par9));
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.3125F, 0.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
//GL11.glScalef(1.0F / var29, 1.0F / var29, 1.0F / var29);
|
||||
}
|
||||
|
||||
//this.loadTexture("/tinkertextures/entity/pullcart.png");
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
this.modelCart.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
|
||||
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
|
||||
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
|
||||
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.renderPullcart((CartEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110775_a(Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/pullcart.png");
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CloneHeadModel extends ModelBase
|
||||
{
|
||||
/** The slime's bodies, both the inside box and the outside box */
|
||||
ModelRenderer slimeBodies;
|
||||
ModelRenderer slimeHeadwear;
|
||||
|
||||
public CloneHeadModel(float scale)
|
||||
{
|
||||
this.slimeBodies = new ModelRenderer(this, 0, 0);
|
||||
this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8);
|
||||
this.slimeHeadwear = new ModelRenderer(this, 32, 0);
|
||||
this.slimeHeadwear.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8, scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the models various rotation angles then renders the model.
|
||||
*/
|
||||
public void render (Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
this.slimeBodies.render(par7);
|
||||
this.slimeHeadwear.render(par7);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import tconstruct.entity.Automaton;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class CrystalGuardianModel extends ModelBase
|
||||
{
|
||||
public ModelRenderer chest;
|
||||
public ModelRenderer leftarm;
|
||||
public ModelRenderer rightarm;
|
||||
public ModelRenderer leftleg;
|
||||
public ModelRenderer rightleg;
|
||||
public ModelRenderer neckplate;
|
||||
public ModelRenderer head;
|
||||
public ModelRenderer crystal;
|
||||
public ModelRenderer eyeleft;
|
||||
public ModelRenderer eyeright;
|
||||
|
||||
public CrystalGuardianModel()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
chest = new ModelRenderer(this, 0, 0);
|
||||
chest.addBox(-8F, -8F, -5F, 16, 16, 10);
|
||||
chest.setRotationPoint(0F, 0F, 0F);
|
||||
setRotation(chest, 0F, 0F, 0F);
|
||||
leftarm = new ModelRenderer(this, 0, 26);
|
||||
leftarm.mirror = true;
|
||||
leftarm.addBox(0F, -2F, -2F, 4, 22, 4);
|
||||
leftarm.setRotationPoint(8F, -5F, 0F);
|
||||
setRotation(leftarm, 0F, 0F, 0F);
|
||||
rightarm = new ModelRenderer(this, 0, 26);
|
||||
rightarm.mirror = false;
|
||||
rightarm.addBox(-4F, -2F, -2F, 4, 22, 4);
|
||||
rightarm.setRotationPoint(-8F, -5F, 0F);
|
||||
setRotation(rightarm, 0F, 0F, 0F);
|
||||
leftleg = new ModelRenderer(this, 16, 26);
|
||||
leftleg.mirror = true;
|
||||
leftleg.addBox(-2F, 0F, -3F, 4, 16, 6);
|
||||
leftleg.setRotationPoint(4F, 8F, 0F);
|
||||
setRotation(leftleg, 0F, 0F, 0F);
|
||||
rightleg = new ModelRenderer(this, 16, 26);
|
||||
rightleg.mirror = false;
|
||||
rightleg.addBox(-2F, 0F, -3F, 4, 16, 6);
|
||||
rightleg.setRotationPoint(-4F, 8F, 0F);
|
||||
setRotation(rightleg, 0F, 0F, 0F);
|
||||
neckplate = new ModelRenderer(this, 8, 48);
|
||||
neckplate.addBox(-4F, -1F, -4F, 8, 1, 8);
|
||||
neckplate.setRotationPoint(0F, -8F, 0F);
|
||||
setRotation(neckplate, 0F, 0F, 0F);
|
||||
head = new ModelRenderer(this, 36, 26);
|
||||
head.addBox(-3F, -6F, -3F, 6, 6, 6);
|
||||
head.setRotationPoint(0F, -9F, 0F);
|
||||
setRotation(head, 0F, 0F, 0F);
|
||||
crystal = new ModelRenderer(this, 36, 38);
|
||||
crystal.addBox(-1F, -8F, -1F, 2, 2, 2);
|
||||
crystal.setRotationPoint(0F, -9F, 0F);
|
||||
setRotation(crystal, 0F, 0F, 0F);
|
||||
eyeleft = new ModelRenderer(this, 36, 42);
|
||||
eyeleft.addBox(1F, -4F, -4F, 2, 2, 1);
|
||||
eyeleft.setRotationPoint(0F, -9F, 0F);
|
||||
setRotation(eyeleft, 0F, 0F, 0F);
|
||||
eyeright = new ModelRenderer(this, 36, 42);
|
||||
eyeright.addBox(-3F, -4F, -4F, 2, 2, 1);
|
||||
eyeright.setRotationPoint(0F, -9F, 0F);
|
||||
setRotation(eyeright, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
chest.render(f5);
|
||||
leftarm.render(f5);
|
||||
rightarm.render(f5);
|
||||
leftleg.render(f5);
|
||||
rightleg.render(f5);
|
||||
neckplate.render(f5);
|
||||
head.render(f5);
|
||||
crystal.render(f5);
|
||||
eyeleft.render(f5);
|
||||
eyeright.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
|
||||
{
|
||||
//super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
|
||||
this.rightleg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2;
|
||||
this.leftleg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations (EntityLivingBase par1EntityLiving, float par2, float par3, float par4)
|
||||
{
|
||||
Automaton entityirongolem = (Automaton) par1EntityLiving;
|
||||
int i = 0;//entityirongolem.getAttackTimer();
|
||||
|
||||
this.rightarm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
|
||||
this.leftarm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
|
||||
/*this.rightarm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);
|
||||
this.leftarm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);*/
|
||||
}
|
||||
|
||||
private float func_78172_a (float par1, float par2)
|
||||
{
|
||||
return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CrystalGuardianRender extends RenderLiving
|
||||
{
|
||||
CrystalGuardianModel model;
|
||||
|
||||
public CrystalGuardianRender()
|
||||
{
|
||||
super(new CrystalGuardianModel(), 0.5F);
|
||||
this.model = (CrystalGuardianModel) this.mainModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderEquippedItems (EntityLivingBase par1EntityLiving, float par2)
|
||||
{
|
||||
float f1 = 1.0F;
|
||||
GL11.glColor3f(f1, f1, f1);
|
||||
super.renderEquippedItems(par1EntityLiving, par2);
|
||||
ItemStack itemstack = par1EntityLiving.getHeldItem();
|
||||
ItemStack itemstack1 = par1EntityLiving.getCurrentItemOrArmor(4);
|
||||
float f2;
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
this.model.head.postRender(0.0625F);
|
||||
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));
|
||||
|
||||
if (itemstack1.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))
|
||||
{
|
||||
f2 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f2, -f2, -f2);
|
||||
}
|
||||
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack1, 0);
|
||||
}
|
||||
else if (itemstack1.getItem().itemID == Item.skull.itemID)
|
||||
{
|
||||
f2 = 1.0625F;
|
||||
GL11.glScalef(f2, -f2, -f2);
|
||||
String s = "";
|
||||
|
||||
if (itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("SkullOwner"))
|
||||
{
|
||||
s = itemstack1.getTagCompound().getString("SkullOwner");
|
||||
}
|
||||
|
||||
TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack1.getItemDamage(), s);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (this.mainModel.isChild)
|
||||
{
|
||||
f2 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.625F, 0.0F);
|
||||
GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
}
|
||||
|
||||
this.model.rightarm.postRender(0.0625F);
|
||||
GL11.glTranslatef(-0.125F, 1F, 0F);
|
||||
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
|
||||
|
||||
if (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())))
|
||||
{
|
||||
f2 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
f2 *= 0.75F;
|
||||
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(-f2, -f2, f2);
|
||||
}
|
||||
else if (itemstack.itemID == Item.bow.itemID)
|
||||
{
|
||||
f2 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
||||
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f2, -f2, f2);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else if (Item.itemsList[itemstack.itemID].isFull3D())
|
||||
{
|
||||
f2 = 0.625F;
|
||||
|
||||
if (Item.itemsList[itemstack.itemID].shouldRotateAroundWhenRendering())
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
|
||||
}
|
||||
|
||||
this.func_82422_c();
|
||||
GL11.glScalef(f2, -f2, f2);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
f2 = 0.375F;
|
||||
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
float f6;
|
||||
float f11;
|
||||
int j;
|
||||
float f12;
|
||||
|
||||
if (itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
for (j = 0; j < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); j++)
|
||||
{
|
||||
int k = itemstack.getItem().getColorFromItemStack(itemstack, j);
|
||||
f12 = (float) (k >> 16 & 255) / 255.0F;
|
||||
f11 = (float) (k >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (k & 255) / 255.0F;
|
||||
GL11.glColor4f(f12, f11, f6, 1.0F);
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
j = itemstack.getItem().getColorFromItemStack(itemstack, 0);
|
||||
f6 = (float) (j >> 16 & 255) / 255.0F;
|
||||
f12 = (float) (j >> 8 & 255) / 255.0F;
|
||||
f11 = (float) (j & 255) / 255.0F;
|
||||
GL11.glColor4f(f6, f12, f11, 1.0F);
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
|
||||
}
|
||||
|
||||
/*this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
|
||||
|
||||
if (itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
|
||||
{
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x);
|
||||
}
|
||||
}*/
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
protected void func_82422_c ()
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation func_110775_a(Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/crystalguardamber.png");
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class CrystalModelSmall extends ModelBase
|
||||
{
|
||||
/*ModelRenderer body;
|
||||
ModelRendererTurbo top;
|
||||
ModelRendererTurbo bottom;
|
||||
|
||||
public CrystalModelSmall()
|
||||
{
|
||||
textureWidth = 32;
|
||||
textureHeight = 32;
|
||||
|
||||
body = new ModelRenderer(this, 0, 8);
|
||||
body.addBox(-2F, 0F, -2F, 4, 6, 4);
|
||||
body.setRotationPoint(0F, 0F, 0F);
|
||||
setRotation(body, 0, 0.7853982F, 0);
|
||||
top = new ModelRendererTurbo(this, 0, 0, 32, 32);
|
||||
top.addCone(0, 0, 0, 2.8F, 4, 4, 0, ModelRendererTurbo.MR_BOTTOM, 4, 8);
|
||||
top.setRotationPoint(0F, -4F, 0F);
|
||||
setRotation(top, 0F, 0F, 0F);
|
||||
bottom = new ModelRendererTurbo(this, 0, 18, 32, 32);
|
||||
top.addCone(0, 10, 0, 2.8F, 4, 4, 0, ModelRendererTurbo.MR_TOP, 4, 8);
|
||||
bottom.setRotationPoint(0F, 6F, 0F);
|
||||
//setRotation(bottom, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
body.render(f5);
|
||||
top.render(f5);
|
||||
bottom.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import tconstruct.entity.Crystal;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CrystalRender extends RenderLiving
|
||||
{
|
||||
/** The creeper model. */
|
||||
private ModelBase creeperModel = new CrystalModelSmall();
|
||||
|
||||
public CrystalRender()
|
||||
{
|
||||
super(new CrystalModelSmall(), 0.5F);
|
||||
}
|
||||
|
||||
/**
|
||||
* A method used to render a creeper's powered form as a pass model.
|
||||
*/
|
||||
protected int renderCreeperPassModel (Crystal par1EntityCreeper, int par2, float par3)
|
||||
{
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int func_77061_b (Crystal par1EntityCreeper, int par2, float par3)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
||||
* entityLiving, partialTickTime
|
||||
*/
|
||||
/*protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
|
||||
{
|
||||
this.updateCreeperScale((Skyla)par1EntityLiving, par2);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
|
||||
*/
|
||||
protected int getColorMultiplier (EntityLiving par1EntityLiving, float par2, float par3)
|
||||
{
|
||||
return super.getColorMultiplier(par1EntityLiving, par2, par3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
|
||||
{
|
||||
return this.renderCreeperPassModel((Crystal) par1EntityLiving, par2, par3);
|
||||
}
|
||||
|
||||
protected int inheritRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
|
||||
{
|
||||
return this.func_77061_b((Crystal) par1EntityLiving, par2, par3);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110775_a(Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/crystalwater.png");
|
||||
}
|
||||
@@ -0,0 +1,636 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FancyItemRender extends Render
|
||||
{
|
||||
private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
private RenderBlocks itemRenderBlocks = new RenderBlocks();
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel;
|
||||
public static boolean renderInFrame;
|
||||
|
||||
public FancyItemRender()
|
||||
{
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (EntityItem par1EntityItem, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.func_110777_b(par1EntityItem);
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = par1EntityItem.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI);
|
||||
byte b0 = getMiniBlockCount(itemstack);
|
||||
|
||||
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
int i;
|
||||
|
||||
Block block = null;
|
||||
if (itemstack.itemID < Block.blocksList.length)
|
||||
{
|
||||
block = Block.blocksList[itemstack.itemID];
|
||||
}
|
||||
|
||||
if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks))
|
||||
{
|
||||
;
|
||||
}
|
||||
else if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
|
||||
{
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
float f7 = 0.25F;
|
||||
int j = block.getRenderType();
|
||||
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2)
|
||||
{
|
||||
f7 = 0.5F;
|
||||
}
|
||||
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
|
||||
for (i = 0; i < b0; ++i)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
GL11.glTranslatef(f5, f4, f6);
|
||||
}
|
||||
|
||||
f5 = 1.0F;
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
this.random.setSeed(187L);
|
||||
Icon icon = itemstack.getItem().getIcon(itemstack, k);
|
||||
f8 = 1.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
|
||||
f5 = (float) (i >> 16 & 255) / 255.0F;
|
||||
f4 = (float) (i >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (i & 255) / 255.0F;
|
||||
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
|
||||
this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
Icon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
|
||||
f8 = (float) (l >> 16 & 255) / 255.0F;
|
||||
float f9 = (float) (l >> 8 & 255) / 255.0F;
|
||||
f5 = (float) (l & 255) / 255.0F;
|
||||
f4 = 1.0F;
|
||||
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (EntityItem par1EntityItem)
|
||||
{
|
||||
return this.renderManager.renderEngine.func_130087_a(par1EntityItem.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0);
|
||||
}
|
||||
|
||||
private void renderDroppedItem (EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
|
||||
ResourceLocation resourcelocation = texturemanager.func_130087_a(par1EntityItem.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
|
||||
}
|
||||
|
||||
float f4 = ((Icon) par2Icon).getMinU();
|
||||
float f5 = ((Icon) par2Icon).getMaxU();
|
||||
float f6 = ((Icon) par2Icon).getMinV();
|
||||
float f7 = ((Icon) par2Icon).getMaxV();
|
||||
float f8 = 1.0F;
|
||||
float f9 = 0.5F;
|
||||
float f10 = 0.25F;
|
||||
float f11;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
float f12 = 0.0625F;
|
||||
f11 = 0.021875F;
|
||||
ItemStack itemstack = par1EntityItem.getEntityItem();
|
||||
int j = itemstack.stackSize;
|
||||
byte b0 = getMiniItemCount(itemstack);
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
|
||||
if (k > 0 && shouldSpreadItems())
|
||||
{
|
||||
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
GL11.glTranslatef(x, y, f12 + f11);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
}
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
this.func_110776_a(TextureMap.field_110575_b);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.func_110776_a(TextureMap.field_110576_c);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getOriginX(), ((Icon) par2Icon).getOriginY(), f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.func_110577_a(field_110798_h);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
float f13 = 0.76F;
|
||||
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
float f14 = 0.125F;
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
|
||||
GL11.glTranslatef(f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
|
||||
GL11.glTranslatef(-f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's icon or block into the UI at the specified position.
|
||||
*/
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
|
||||
}
|
||||
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
|
||||
{
|
||||
int k = par3ItemStack.itemID;
|
||||
int l = par3ItemStack.getItemDamage();
|
||||
Object object = par3ItemStack.getIconIndex();
|
||||
float f;
|
||||
int i1;
|
||||
float f1;
|
||||
float f2;
|
||||
|
||||
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
|
||||
{
|
||||
par2TextureManager.func_110577_a(TextureMap.field_110575_b);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
|
||||
GL11.glScalef(10.0F, 10.0F, 10.0F);
|
||||
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
|
||||
GL11.glScalef(1.0F, 1.0F, -1.0F);
|
||||
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
|
||||
f = (float) (i1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = this.renderWithColor;
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (Item.itemsList[k].requiresMultipleRenderPasses())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
|
||||
{
|
||||
par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
|
||||
Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
|
||||
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
|
||||
f1 = (float) (k1 >> 16 & 255) / 255.0F;
|
||||
f2 = (float) (k1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (k1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f1, f2, f3, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, icon, 16, 16);
|
||||
|
||||
if (par3ItemStack.hasEffect(j1))
|
||||
{
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
ResourceLocation resourcelocation = par2TextureManager.func_130087_a(par3ItemStack.getItemSpriteNumber());
|
||||
par2TextureManager.func_110577_a(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(resourcelocation)).func_110572_b("missingno");
|
||||
}
|
||||
|
||||
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
|
||||
f = (float) (i1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, (Icon) object, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
if (par3ItemStack.hasEffect(0))
|
||||
{
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
private void renderEffect (TextureManager manager, int x, int y)
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
manager.func_110577_a(field_110798_h);
|
||||
this.zLevel -= 50.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
|
||||
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
|
||||
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
this.zLevel += 50.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the item's icon or block into the GUI, including the glint effect.
|
||||
*/
|
||||
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
|
||||
{
|
||||
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
|
||||
}
|
||||
|
||||
/* Modders must handle this themselves if they use custom renderers!
|
||||
if (par3ItemStack.hasEffect())
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
par2TextureManager.func_110577_a(field_110798_h);
|
||||
this.zLevel -= 50.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
|
||||
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
|
||||
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
this.zLevel += 50.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
{
|
||||
if (j1 == 0)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
|
||||
float f3 = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f4 = 4.0F;
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
f4 = -1.0F;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
|
||||
* specified position.
|
||||
*/
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
|
||||
}
|
||||
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (par3ItemStack.stackSize > 1 || par6Str != null)
|
||||
{
|
||||
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if (par3ItemStack.isItemDamaged())
|
||||
{
|
||||
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
|
||||
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int i1 = 255 - l << 16 | l << 8;
|
||||
int j1 = (255 - l) / 4 << 16 | 16128;
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
|
||||
* tessellator, x, y, width, height, color
|
||||
*/
|
||||
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I(par6);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110775_a (Entity par1Entity)
|
||||
{
|
||||
return this.func_110796_a((EntityItem) par1Entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
|
||||
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
|
||||
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
|
||||
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.doRenderItem((EntityItem) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte getMiniBlockCount (ItemStack stack)
|
||||
{
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 5)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 20)
|
||||
ret = 4;
|
||||
if (stack.stackSize > 40)
|
||||
ret = 5;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for a subclass to override how many rendered items appear in a
|
||||
* "mini item 3d stack"
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public byte getMiniItemCount (ItemStack stack)
|
||||
{
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 15)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 31)
|
||||
ret = 4;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelPig;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class GolemBaseModel extends ModelPig
|
||||
{
|
||||
ModelRenderer rightArm;
|
||||
ModelRenderer leftArm;
|
||||
|
||||
public GolemBaseModel()
|
||||
{
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
head = new ModelRenderer(this, 0, 0);
|
||||
head.addBox(-4F, -8F, -4F, 8, 8, 8, f);
|
||||
head.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
|
||||
head.showModel = false;
|
||||
body = new ModelRenderer(this, 16, 16);
|
||||
body.addBox(-4F, 0.0F, -2F, 8, 12, 4, f);
|
||||
body.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
|
||||
body.showModel = false;
|
||||
rightArm = new ModelRenderer(this, 40, 16);
|
||||
rightArm.addBox(-3F, -2F, -2F, 4, 12, 4, f);
|
||||
rightArm.setRotationPoint(-5F, 2.0F + f1, 0.0F);
|
||||
leftArm = new ModelRenderer(this, 40, 16);
|
||||
leftArm.mirror = true;
|
||||
leftArm.addBox(-1F, -2F, -2F, 4, 12, 4, f);
|
||||
leftArm.setRotationPoint(5F, 2.0F + f1, 0.0F);
|
||||
leg3 = new ModelRenderer(this, 0, 16);
|
||||
leg3.addBox(-2F, 0.0F, -2F, 4, 12, 4, f);
|
||||
leg3.setRotationPoint(-2F, 12F + f1, 0.0F);
|
||||
leg4 = new ModelRenderer(this, 0, 16);
|
||||
leg4.mirror = true;
|
||||
leg4.addBox(-2F, 0.0F, -2F, 4, 12, 4, f);
|
||||
leg4.setRotationPoint(2.0F, 12F + f1, 0.0F);
|
||||
rightArm = new ModelRenderer(this, 40, 16);
|
||||
rightArm.addBox(-1F, -2F, -1F, 2, 12, 2, f);
|
||||
rightArm.setRotationPoint(-5F, 2.0F, 0.0F);
|
||||
rightArm.showModel = false;
|
||||
leftArm = new ModelRenderer(this, 40, 16);
|
||||
leftArm.mirror = true;
|
||||
leftArm.addBox(-1F, -2F, -1F, 2, 12, 2, f);
|
||||
leftArm.setRotationPoint(5F, 2.0F, 0.0F);
|
||||
leftArm.showModel = false;
|
||||
leg3 = new ModelRenderer(this, 0, 16);
|
||||
leg3.addBox(-1F, 0.0F, -1F, 2, 12, 2, f);
|
||||
leg3.setRotationPoint(-2F, 12F, 0.0F);
|
||||
leg3.showModel = false;
|
||||
leg4 = new ModelRenderer(this, 0, 16);
|
||||
leg4.mirror = true;
|
||||
leg4.addBox(-1F, 0.0F, -1F, 2, 12, 2, f);
|
||||
leg4.setRotationPoint(2.0F, 12F, 0.0F);
|
||||
leg4.showModel = false;
|
||||
leg1.showModel = leg2.showModel = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
float f6 = 0.0F;
|
||||
float f7 = 0.0F;
|
||||
rightArm.rotateAngleZ = 0.0F;
|
||||
leftArm.rotateAngleZ = 0.0F;
|
||||
rightArm.rotateAngleY = -(0.1F - f6 * 0.6F) + head.rotateAngleY;
|
||||
leftArm.rotateAngleY = (0.1F - f6 * 0.6F) + head.rotateAngleY + 0.4F;
|
||||
rightArm.rotateAngleX = -1.570796F + head.rotateAngleX;
|
||||
leftArm.rotateAngleX = -1.570796F + head.rotateAngleX;
|
||||
rightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
|
||||
leftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
|
||||
rightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
|
||||
leftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
|
||||
rightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F;
|
||||
leftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.05F;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MiniGardyRender extends RenderLiving
|
||||
{
|
||||
public MiniGardyRender()
|
||||
{
|
||||
super(new ModelMiniGardy(), 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderEquippedItems (EntityLivingBase par1EntityLiving, float par2)
|
||||
{
|
||||
float f1 = 1.0F;
|
||||
GL11.glColor3f(f1, f1, f1);
|
||||
super.renderEquippedItems(par1EntityLiving, par2);
|
||||
ItemStack heldItem = par1EntityLiving.getHeldItem();
|
||||
ItemStack helmetItem = par1EntityLiving.getCurrentItemOrArmor(4);
|
||||
float f2;
|
||||
|
||||
ModelMiniGardy model = (ModelMiniGardy) this.mainModel;
|
||||
if (helmetItem != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
model.head.postRender(0.0625F);
|
||||
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(helmetItem, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, helmetItem, BLOCK_3D));
|
||||
|
||||
if (helmetItem.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[helmetItem.itemID].getRenderType()))
|
||||
{
|
||||
f2 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f2, -f2, -f2);
|
||||
}
|
||||
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, helmetItem, 0);
|
||||
}
|
||||
else if (helmetItem.getItem().itemID == Item.skull.itemID)
|
||||
{
|
||||
f2 = 1.0625F;
|
||||
GL11.glScalef(f2, -f2, -f2);
|
||||
String s = "";
|
||||
|
||||
if (helmetItem.hasTagCompound() && helmetItem.getTagCompound().hasKey("SkullOwner"))
|
||||
{
|
||||
s = helmetItem.getTagCompound().getString("SkullOwner");
|
||||
}
|
||||
|
||||
TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, helmetItem.getItemDamage(), s);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (heldItem != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
//if (this.mainModel.isChild)
|
||||
{
|
||||
f2 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.75F, 0.0F);
|
||||
GL11.glRotatef(-10.0F, 0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
}
|
||||
|
||||
model.torso.postRender(0.0625F);
|
||||
model.rightArm.postRender(0.0625F);
|
||||
model.rightHand.postRender(0.0625F);
|
||||
GL11.glTranslatef(-0.125F, 1F, 0F);
|
||||
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(heldItem, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, heldItem, BLOCK_3D));
|
||||
|
||||
if (heldItem.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[heldItem.itemID].getRenderType())))
|
||||
{
|
||||
f2 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
f2 *= 0.75F;
|
||||
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(-f2, -f2, f2);
|
||||
}
|
||||
else if (heldItem.itemID == Item.bow.itemID)
|
||||
{
|
||||
f2 = 0.625F;
|
||||
GL11.glTranslatef(-0.175F, 0.125F, 0.3125F);
|
||||
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f2, -f2, f2);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
//if (Item.itemsList[heldItem.itemID].isFull3D())
|
||||
{
|
||||
f2 = 0.625F;
|
||||
|
||||
if (Item.itemsList[heldItem.itemID].shouldRotateAroundWhenRendering())
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
|
||||
}
|
||||
|
||||
this.translateItem();
|
||||
GL11.glScalef(f2, -f2, f2);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
/*else
|
||||
{
|
||||
f2 = 0.375F;
|
||||
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
|
||||
}*/
|
||||
|
||||
float f6;
|
||||
float f11;
|
||||
int j;
|
||||
float f12;
|
||||
|
||||
if (heldItem.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
for (j = 0; j < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); j++)
|
||||
{
|
||||
int k = heldItem.getItem().getColorFromItemStack(heldItem, j);
|
||||
f12 = (float) (k >> 16 & 255) / 255.0F;
|
||||
f11 = (float) (k >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (k & 255) / 255.0F;
|
||||
GL11.glColor4f(f12, f11, f6, 1.0F);
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
j = heldItem.getItem().getColorFromItemStack(heldItem, 0);
|
||||
f6 = (float) (j >> 16 & 255) / 255.0F;
|
||||
f12 = (float) (j >> 8 & 255) / 255.0F;
|
||||
f11 = (float) (j & 255) / 255.0F;
|
||||
GL11.glColor4f(f6, f12, f11, 1.0F);
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
protected void translateItem ()
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation func_110775_a(Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/googirl.png");
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.PositionTextureVertex;
|
||||
import net.minecraft.client.model.TexturedQuad;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ModelBoxDegrees
|
||||
{
|
||||
/**
|
||||
* The (x,y,z) vertex positions and (u,v) texture coordinates for each of the 8 points on a cube
|
||||
*/
|
||||
private PositionTextureVertex[] vertexPositions;
|
||||
|
||||
/** An array of 6 TexturedQuads, one for each face of a cube */
|
||||
private TexturedQuad[] quadList;
|
||||
|
||||
/** X vertex coordinate of lower box corner */
|
||||
public final float posX1;
|
||||
|
||||
/** Y vertex coordinate of lower box corner */
|
||||
public final float posY1;
|
||||
|
||||
/** Z vertex coordinate of lower box corner */
|
||||
public final float posZ1;
|
||||
|
||||
/** X vertex coordinate of upper box corner */
|
||||
public final float posX2;
|
||||
|
||||
/** Y vertex coordinate of upper box corner */
|
||||
public final float posY2;
|
||||
|
||||
/** Z vertex coordinate of upper box corner */
|
||||
public final float posZ2;
|
||||
public String field_78247_g;
|
||||
|
||||
public ModelBoxDegrees(ModelRendererDegrees par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10)
|
||||
{
|
||||
this.posX1 = par4;
|
||||
this.posY1 = par5;
|
||||
this.posZ1 = par6;
|
||||
this.posX2 = par4 + (float) par7;
|
||||
this.posY2 = par5 + (float) par8;
|
||||
this.posZ2 = par6 + (float) par9;
|
||||
this.vertexPositions = new PositionTextureVertex[8];
|
||||
this.quadList = new TexturedQuad[6];
|
||||
float f4 = par4 + (float) par7;
|
||||
float f5 = par5 + (float) par8;
|
||||
float f6 = par6 + (float) par9;
|
||||
par4 -= par10;
|
||||
par5 -= par10;
|
||||
par6 -= par10;
|
||||
f4 += par10;
|
||||
f5 += par10;
|
||||
f6 += par10;
|
||||
|
||||
if (par1ModelRenderer.mirror)
|
||||
{
|
||||
float f7 = f4;
|
||||
f4 = par4;
|
||||
par4 = f7;
|
||||
}
|
||||
|
||||
PositionTextureVertex positiontexturevertex = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F);
|
||||
PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, par5, par6, 0.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, par6, 8.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(par4, f5, par6, 8.0F, 0.0F);
|
||||
PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(par4, par5, f6, 0.0F, 0.0F);
|
||||
PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, par5, f6, 0.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F);
|
||||
PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(par4, f5, f6, 8.0F, 0.0F);
|
||||
this.vertexPositions[0] = positiontexturevertex;
|
||||
this.vertexPositions[1] = positiontexturevertex1;
|
||||
this.vertexPositions[2] = positiontexturevertex2;
|
||||
this.vertexPositions[3] = positiontexturevertex3;
|
||||
this.vertexPositions[4] = positiontexturevertex4;
|
||||
this.vertexPositions[5] = positiontexturevertex5;
|
||||
this.vertexPositions[6] = positiontexturevertex6;
|
||||
this.vertexPositions[7] = positiontexturevertex7;
|
||||
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex1, positiontexturevertex2, positiontexturevertex6 }, par2 + par9 + par7, par3
|
||||
+ par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex, positiontexturevertex4, positiontexturevertex7, positiontexturevertex3 }, par2, par3 + par9, par2
|
||||
+ par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1 }, par2 + par9, par3, par2
|
||||
+ par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex2, positiontexturevertex3, positiontexturevertex7, positiontexturevertex6 }, par2 + par9 + par7, par3
|
||||
+ par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex1, positiontexturevertex, positiontexturevertex3, positiontexturevertex2 }, par2 + par9, par3 + par9,
|
||||
par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex4, positiontexturevertex5, positiontexturevertex6, positiontexturevertex7 }, par2 + par9 + par7 + par9,
|
||||
par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||
|
||||
if (par1ModelRenderer.mirror)
|
||||
{
|
||||
for (int j1 = 0; j1 < this.quadList.length; ++j1)
|
||||
{
|
||||
this.quadList[j1].flipFace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the six sided box defined by this ModelBox
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render (Tessellator par1Tessellator, float par2)
|
||||
{
|
||||
for (int i = 0; i < this.quadList.length; ++i)
|
||||
{
|
||||
this.quadList[i].draw(par1Tessellator, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public ModelBoxDegrees func_78244_a (String par1Str)
|
||||
{
|
||||
this.field_78247_g = par1Str;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ModelMiniGardy extends ModelBase
|
||||
{
|
||||
ModelRendererDegrees body;
|
||||
ModelRendererDegrees torso;
|
||||
ModelRendererDegrees head;
|
||||
ModelRendererDegrees rightArm;
|
||||
ModelRendererDegrees rightHand;
|
||||
ModelRendererDegrees leftArm;
|
||||
ModelRendererDegrees leftHand;
|
||||
ModelRendererDegrees hairTop;
|
||||
ModelRendererDegrees hairRight;
|
||||
ModelRendererDegrees lockLeft;
|
||||
ModelRendererDegrees lockRight;
|
||||
ModelRendererDegrees hairLeft;
|
||||
ModelRendererDegrees hairBack;
|
||||
ModelRendererDegrees hairFront;
|
||||
ModelRendererDegrees hairTopFront;
|
||||
ModelRendererDegrees hairTopBack;
|
||||
ModelRendererDegrees lockInsideRight;
|
||||
ModelRendererDegrees lockInsideLeft;
|
||||
|
||||
public ModelMiniGardy()
|
||||
{
|
||||
body = new ModelRendererDegrees(this, 0, 0);
|
||||
body.addBox(-3F, 0F, -3F, 6, 6, 6);
|
||||
body.setRotationPoint(0F, 18F, 0F);
|
||||
body.mirror = true;
|
||||
setRotation(body, 0F, 0F, 0F);
|
||||
|
||||
torso = new ModelRendererDegrees(this, 16, 12);
|
||||
torso.addBox(-1F, -5F, -1F, 2, 5, 2);
|
||||
torso.setRotationPoint(0F, 0F, 0F);
|
||||
torso.mirror = true;
|
||||
setRotation(torso, 0F, 0F, 0F);
|
||||
body.addChild(torso);
|
||||
|
||||
rightArm = new ModelRendererDegrees(this, 24, 0);
|
||||
rightArm.addBox(-1F, -1F, -1F, 2, 4, 2);
|
||||
rightArm.setRotationPoint(-2F, -3F, 0F);
|
||||
rightArm.mirror = true;
|
||||
setRotation(rightArm, 0F, 0F, 15F);//convertDegrees(30.0f));//0.2617994F);
|
||||
torso.addChild(rightArm);
|
||||
|
||||
rightHand = new ModelRendererDegrees(this, 24, 6);
|
||||
rightHand.addBox(-1F, 0F, -2F, 2, 4, 2);
|
||||
rightHand.setRotationPoint(0F, 3F, 1F);
|
||||
rightHand.setTextureSize(64, 32);
|
||||
rightHand.mirror = true;
|
||||
setRotation(rightHand, 0F, 0F, 0F);
|
||||
rightArm.addChild(rightHand);
|
||||
|
||||
leftArm = new ModelRendererDegrees(this, 32, 0);
|
||||
leftArm.addBox(-1F, -1F, -1F, 2, 4, 2);
|
||||
leftArm.setRotationPoint(2F, -3F, 0F);
|
||||
leftArm.mirror = true;
|
||||
setRotation(leftArm, 0F, 0F, -15F);
|
||||
torso.addChild(leftArm);
|
||||
|
||||
leftHand = new ModelRendererDegrees(this, 32, 6);
|
||||
leftHand.addBox(-1F, 0F, -2F, 2, 4, 2);
|
||||
leftHand.setRotationPoint(0F, 3F, 1F);
|
||||
leftHand.mirror = true;
|
||||
setRotation(leftHand, 0F, 0F, 0F);
|
||||
leftArm.addChild(leftHand);
|
||||
|
||||
//Head
|
||||
head = new ModelRendererDegrees(this, 0, 12);
|
||||
head.addBox(-2F, -4F, -2F, 4, 4, 4);
|
||||
head.setRotationPoint(0F, -5F, 0F);
|
||||
head.mirror = true;
|
||||
setRotation(head, 0F, 0F, 0F);
|
||||
torso.addChild(head);
|
||||
|
||||
hairTop = new ModelRendererDegrees(this, 40, 2);
|
||||
hairTop.addBox(-3F, 0F, -2F, 6, 1, 4);
|
||||
hairTop.setRotationPoint(0F, -5F, 0F);
|
||||
hairTop.mirror = true;
|
||||
setRotation(hairTop, 0F, 0F, 0F);
|
||||
head.addChild(hairTop);
|
||||
|
||||
hairRight = new ModelRendererDegrees(this, 40, 7);
|
||||
hairRight.addBox(0F, 0F, 0F, 2, 5, 4);
|
||||
hairRight.setRotationPoint(-3F, -4F, -1F);
|
||||
hairRight.mirror = true;
|
||||
setRotation(hairRight, 0F, 0F, 0F);
|
||||
head.addChild(hairRight);
|
||||
|
||||
lockLeft = new ModelRendererDegrees(this, 46, 19);
|
||||
lockLeft.addBox(0F, 0F, 0F, 1, 2, 2);
|
||||
lockLeft.setRotationPoint(2F, -1F, -3F);
|
||||
lockLeft.mirror = true;
|
||||
setRotation(lockLeft, 0F, 0F, 0F);
|
||||
head.addChild(lockLeft);
|
||||
|
||||
lockRight = new ModelRendererDegrees(this, 40, 19);
|
||||
lockRight.addBox(-1F, 0F, 0F, 1, 2, 2);
|
||||
lockRight.setRotationPoint(-2F, -1F, -3F);
|
||||
lockRight.mirror = true;
|
||||
setRotation(lockRight, 0F, 0F, 0F);
|
||||
head.addChild(lockRight);
|
||||
|
||||
hairLeft = new ModelRendererDegrees(this, 52, 7);
|
||||
hairLeft.addBox(0F, 0F, 0F, 2, 5, 4);
|
||||
hairLeft.setRotationPoint(1F, -4F, -1F);
|
||||
hairLeft.mirror = true;
|
||||
setRotation(hairLeft, 0F, 0F, 0F);
|
||||
head.addChild(hairLeft);
|
||||
|
||||
hairBack = new ModelRendererDegrees(this, 56, 16);
|
||||
hairBack.addBox(-1F, 0F, 0F, 2, 4, 1);
|
||||
hairBack.setRotationPoint(0F, -4F, 2F);
|
||||
hairBack.mirror = true;
|
||||
setRotation(hairBack, 0F, 0F, 0F);
|
||||
head.addChild(hairBack);
|
||||
|
||||
hairFront = new ModelRendererDegrees(this, 40, 16);
|
||||
hairFront.addBox(0F, 0F, 0F, 6, 1, 2);
|
||||
hairFront.setRotationPoint(-3F, -4F, -3F);
|
||||
hairFront.mirror = true;
|
||||
setRotation(hairFront, 0F, 0F, 0F);
|
||||
head.addChild(hairFront);
|
||||
|
||||
hairTopFront = new ModelRendererDegrees(this, 50, 0);
|
||||
hairTopFront.addBox(0F, 0F, 0F, 4, 1, 1);
|
||||
hairTopFront.setRotationPoint(-2F, -5F, -3F);
|
||||
hairTopFront.mirror = true;
|
||||
setRotation(hairTopFront, 0F, 0F, 0F);
|
||||
head.addChild(hairTopFront);
|
||||
|
||||
hairTopBack = new ModelRendererDegrees(this, 40, 0);
|
||||
hairTopBack.addBox(0F, 0F, 0F, 4, 1, 1);
|
||||
hairTopBack.setRotationPoint(-2F, -5F, 2F);
|
||||
hairTopBack.mirror = true;
|
||||
setRotation(hairTopBack, 0F, 0F, 0F);
|
||||
head.addChild(hairTopBack);
|
||||
|
||||
lockInsideRight = new ModelRendererDegrees(this, 40, 23);
|
||||
lockInsideRight.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
lockInsideRight.setRotationPoint(-2F, 0F, -3F);
|
||||
lockInsideRight.mirror = true;
|
||||
setRotation(lockInsideRight, 0F, 0F, 0F);
|
||||
head.addChild(lockInsideRight);
|
||||
|
||||
lockInsideLeft = new ModelRendererDegrees(this, 46, 23);
|
||||
lockInsideLeft.addBox(-1F, 0F, 0F, 1, 1, 2);
|
||||
lockInsideLeft.setRotationPoint(2F, 0F, -3F);
|
||||
lockInsideLeft.mirror = true;
|
||||
setRotation(lockInsideLeft, 0F, 0F, 0F);
|
||||
head.addChild(lockInsideLeft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
body.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRendererDegrees model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
private float convertDegrees (float f)
|
||||
{
|
||||
return f * ((float) Math.PI / 180F);
|
||||
}
|
||||
|
||||
private float convertRadians (float f)
|
||||
{
|
||||
return f * (180F / (float) Math.PI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float limbSwing, float limbDelta, float ticksExisted, float rotation, float rotationDelta, float par6, Entity entity)
|
||||
{
|
||||
float bodyRotation = convertRadians(MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbDelta * 0.5F);
|
||||
this.rightArm.rotateAngleX = bodyRotation;
|
||||
this.leftArm.rotateAngleX = -bodyRotation;
|
||||
this.torso.rotateAngleY = bodyRotation / 2;
|
||||
this.head.rotateAngleY = rotation - bodyRotation / 2;
|
||||
this.head.rotateAngleX = rotationDelta;
|
||||
if (bodyRotation <= 0)
|
||||
{
|
||||
this.rightHand.rotateAngleX = bodyRotation;
|
||||
}
|
||||
if (-bodyRotation <= 0)
|
||||
{
|
||||
this.leftHand.rotateAngleX = -bodyRotation;
|
||||
}
|
||||
this.rightArm.rotateAngleZ = 15F;
|
||||
this.leftArm.rotateAngleZ = -15F;
|
||||
this.torso.rotationPointY = 0F;
|
||||
this.rightArm.rotateAngleZ += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F);
|
||||
this.leftArm.rotateAngleZ -= convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F);
|
||||
this.torso.rotationPointY += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.01F + 0.01F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelPullcart extends ModelBase
|
||||
{
|
||||
ModelRenderer BackPanel;
|
||||
ModelRenderer FrontPanel;
|
||||
ModelRenderer RightPanel;
|
||||
ModelRenderer LeftPanel;
|
||||
ModelRenderer BottomPanel;
|
||||
ModelRenderer RightHandle;
|
||||
ModelRenderer LeftHandle;
|
||||
ModelRenderer RightSpokeUp;
|
||||
ModelRenderer RightSpokeRight;
|
||||
ModelRenderer RightSpokeDown;
|
||||
ModelRenderer RightSpokeLeft;
|
||||
ModelRenderer RightAxle;
|
||||
ModelRenderer WheelRight1;
|
||||
ModelRenderer WheelRight2;
|
||||
ModelRenderer WheelRight3;
|
||||
ModelRenderer WheelRight4;
|
||||
ModelRenderer WheelRight5;
|
||||
ModelRenderer WheelRight6;
|
||||
ModelRenderer WheelRight7;
|
||||
ModelRenderer WheelRight8;
|
||||
ModelRenderer WheelRight9;
|
||||
ModelRenderer WheelRight10;
|
||||
ModelRenderer WheelRight11;
|
||||
ModelRenderer WheelRight12;
|
||||
ModelRenderer LeftSpokeRight;
|
||||
ModelRenderer LeftSpokeLeft;
|
||||
ModelRenderer LeftSpokeDown;
|
||||
ModelRenderer LeftSpokeUp;
|
||||
ModelRenderer LeftAxle;
|
||||
ModelRenderer WheelLeft1;
|
||||
ModelRenderer WheelLeft2;
|
||||
ModelRenderer WheelLeft3;
|
||||
ModelRenderer WheelLeft4;
|
||||
ModelRenderer WheelLeft5;
|
||||
ModelRenderer WheelLeft6;
|
||||
ModelRenderer WheelLeft7;
|
||||
ModelRenderer WheelLeft8;
|
||||
ModelRenderer WheelLeft9;
|
||||
ModelRenderer WheelLeft10;
|
||||
ModelRenderer WheelLeft11;
|
||||
ModelRenderer WheelLeft12;
|
||||
|
||||
public ModelPullcart()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 64;
|
||||
|
||||
BackPanel = new ModelRenderer(this, 0, 12);
|
||||
BackPanel.addBox(-10F, 0F, 0F, 20, 10, 2);
|
||||
BackPanel.setRotationPoint(0F, -8F, 8F);
|
||||
setRotation(BackPanel, 0F, 0F, 0F);
|
||||
FrontPanel = new ModelRenderer(this, 0, 0);
|
||||
FrontPanel.addBox(-10F, 0F, 0F, 20, 10, 2);
|
||||
FrontPanel.setRotationPoint(0F, -8F, -10F);
|
||||
setRotation(FrontPanel, 0F, 0F, 0F);
|
||||
RightPanel = new ModelRenderer(this, 0, 35);
|
||||
RightPanel.addBox(0F, 0F, -10F, 2, 8, 20);
|
||||
RightPanel.setRotationPoint(-12F, -6F, 0F);
|
||||
setRotation(RightPanel, 0F, 0F, 0F);
|
||||
LeftPanel = new ModelRenderer(this, 24, 15);
|
||||
LeftPanel.addBox(0F, 0F, -10F, 2, 8, 20);
|
||||
LeftPanel.setRotationPoint(10F, -6F, 0F);
|
||||
setRotation(LeftPanel, 0F, 0F, 0F);
|
||||
BottomPanel = new ModelRenderer(this, 40, 43);
|
||||
BottomPanel.addBox(-12F, 0F, -10F, 24, 1, 20);
|
||||
BottomPanel.setRotationPoint(0F, 2F, 0F);
|
||||
setRotation(BottomPanel, 0F, 0F, 0F);
|
||||
RightHandle = new ModelRenderer(this, 92, 33);
|
||||
RightHandle.addBox(0F, 0F, 0F, 16, 2, 2);
|
||||
RightHandle.setRotationPoint(-28F, 0F, -7F);
|
||||
setRotation(RightHandle, 0F, 0F, 0F);
|
||||
LeftHandle = new ModelRenderer(this, 92, 38);
|
||||
LeftHandle.addBox(0F, 0F, 0F, 16, 2, 2);
|
||||
LeftHandle.setRotationPoint(-28F, 0F, 5F);
|
||||
setRotation(LeftHandle, 0F, 0F, 0F);
|
||||
RightSpokeUp = new ModelRenderer(this, 99, 3);
|
||||
RightSpokeUp.addBox(-2F, -8F, 0F, 4, 6, 1);
|
||||
RightSpokeUp.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeUp, 0F, 0F, 0F);
|
||||
RightSpokeRight = new ModelRenderer(this, 112, 15);
|
||||
RightSpokeRight.addBox(2F, -2F, 0F, 6, 4, 1);
|
||||
RightSpokeRight.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeRight, 0F, 0F, 0F);
|
||||
RightSpokeDown = new ModelRenderer(this, 99, 25);
|
||||
RightSpokeDown.addBox(-2F, 2F, 0F, 4, 6, 1);
|
||||
RightSpokeDown.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeDown, 0F, 0F, 0F);
|
||||
RightSpokeLeft = new ModelRenderer(this, 82, 15);
|
||||
RightSpokeLeft.addBox(-8F, -2F, 0F, 6, 4, 1);
|
||||
RightSpokeLeft.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeLeft, 0F, 0F, 0F);
|
||||
RightAxle = new ModelRenderer(this, 98, 14);
|
||||
RightAxle.addBox(-2F, -2F, 0F, 4, 4, 2);
|
||||
RightAxle.setRotationPoint(0F, 3F, -12F);
|
||||
setRotation(RightAxle, 0F, 0F, 0F);
|
||||
WheelRight1 = new ModelRenderer(this, 110, 3);
|
||||
WheelRight1.addBox(2F, -7F, 0F, 2, 2, 1);
|
||||
WheelRight1.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight1, 0F, 0F, 0F);
|
||||
WheelRight2 = new ModelRenderer(this, 117, 5);
|
||||
WheelRight2.addBox(4F, -6F, 0F, 2, 2, 1);
|
||||
WheelRight2.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight2, 0F, 0F, 0F);
|
||||
WheelRight3 = new ModelRenderer(this, 122, 9);
|
||||
WheelRight3.addBox(5F, -4F, 0F, 2, 2, 1);
|
||||
WheelRight3.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight3, 0F, 0F, 0F);
|
||||
WheelRight4 = new ModelRenderer(this, 122, 23);
|
||||
WheelRight4.addBox(5F, 2F, 0F, 2, 2, 1);
|
||||
WheelRight4.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight4, 0F, 0F, 0F);
|
||||
WheelRight5 = new ModelRenderer(this, 117, 27);
|
||||
WheelRight5.addBox(4F, 4F, 0F, 2, 2, 1);
|
||||
WheelRight5.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight5, 0F, 0F, 0F);
|
||||
WheelRight6 = new ModelRenderer(this, 110, 29);
|
||||
WheelRight6.addBox(2F, 5F, 0F, 2, 2, 1);
|
||||
WheelRight6.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight6, 0F, 0F, 0F);
|
||||
WheelRight7 = new ModelRenderer(this, 92, 29);
|
||||
WheelRight7.addBox(-4F, 5F, 0F, 2, 2, 1);
|
||||
WheelRight7.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight7, 0F, 0F, 0F);
|
||||
WheelRight8 = new ModelRenderer(this, 85, 27);
|
||||
WheelRight8.addBox(-6F, 4F, 0F, 2, 2, 1);
|
||||
WheelRight8.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight8, 0F, 0F, 0F);
|
||||
WheelRight9 = new ModelRenderer(this, 80, 23);
|
||||
WheelRight9.addBox(-7F, 2F, 0F, 2, 2, 1);
|
||||
WheelRight9.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight9, 0F, 0F, 0F);
|
||||
WheelRight10 = new ModelRenderer(this, 80, 9);
|
||||
WheelRight10.addBox(-7F, -4F, 0F, 2, 2, 1);
|
||||
WheelRight10.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight10, 0F, 0F, 0F);
|
||||
WheelRight11 = new ModelRenderer(this, 85, 5);
|
||||
WheelRight11.addBox(-6F, -6F, 0F, 2, 2, 1);
|
||||
WheelRight11.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight11, 0F, 0F, 0F);
|
||||
WheelRight12 = new ModelRenderer(this, 92, 3);
|
||||
WheelRight12.addBox(-4F, -7F, 0F, 2, 2, 1);
|
||||
WheelRight12.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight12, 0F, 0F, 0F);
|
||||
LeftSpokeRight = new ModelRenderer(this, 82, 15);
|
||||
LeftSpokeRight.addBox(-8F, -2F, 0F, 6, 4, 1);
|
||||
LeftSpokeRight.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeRight, 0F, 0F, 0F);
|
||||
LeftSpokeLeft = new ModelRenderer(this, 112, 15);
|
||||
LeftSpokeLeft.addBox(2F, -2F, 0F, 6, 4, 1);
|
||||
LeftSpokeLeft.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeLeft, 0F, 0F, 0F);
|
||||
LeftSpokeDown = new ModelRenderer(this, 99, 25);
|
||||
LeftSpokeDown.addBox(-2F, 2F, 0F, 4, 6, 1);
|
||||
LeftSpokeDown.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeDown, 0F, 0F, 0F);
|
||||
LeftSpokeUp = new ModelRenderer(this, 99, 3);
|
||||
LeftSpokeUp.addBox(-2F, -8F, 0F, 4, 6, 1);
|
||||
LeftSpokeUp.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeUp, 0F, 0F, 0F);
|
||||
LeftAxle = new ModelRenderer(this, 98, 14);
|
||||
LeftAxle.addBox(-2F, -2F, 0F, 4, 4, 2);
|
||||
LeftAxle.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftAxle, 0F, 0F, 0F);
|
||||
WheelLeft1 = new ModelRenderer(this, 92, 3);
|
||||
WheelLeft1.addBox(-4F, -7F, 0F, 2, 2, 1);
|
||||
WheelLeft1.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft1, 0F, 0F, 0F);
|
||||
WheelLeft2 = new ModelRenderer(this, 117, 5);
|
||||
WheelLeft2.addBox(-6F, -6F, 0F, 2, 2, 1);
|
||||
WheelLeft2.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft2, 0F, 0F, 0F);
|
||||
WheelLeft3 = new ModelRenderer(this, 80, 9);
|
||||
WheelLeft3.addBox(-7F, -4F, 0F, 2, 2, 1);
|
||||
WheelLeft3.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft3, 0F, 0F, 0F);
|
||||
WheelLeft4 = new ModelRenderer(this, 80, 23);
|
||||
WheelLeft4.addBox(-7F, 2F, 0F, 2, 2, 1);
|
||||
WheelLeft4.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft4, 0F, 0F, 0F);
|
||||
WheelLeft5 = new ModelRenderer(this, 117, 27);
|
||||
WheelLeft5.addBox(-6F, 4F, 0F, 2, 2, 1);
|
||||
WheelLeft5.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft5, 0F, 0F, 0F);
|
||||
WheelLeft6 = new ModelRenderer(this, 110, 29);
|
||||
WheelLeft6.addBox(-4F, 5F, 0F, 2, 2, 1);
|
||||
WheelLeft6.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft6, 0F, 0F, 0F);
|
||||
WheelLeft7 = new ModelRenderer(this, 92, 29);
|
||||
WheelLeft7.addBox(2F, 5F, 0F, 2, 2, 1);
|
||||
WheelLeft7.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft7, 0F, 0F, 0F);
|
||||
WheelLeft8 = new ModelRenderer(this, 85, 27);
|
||||
WheelLeft8.addBox(4F, 4F, 0F, 2, 2, 1);
|
||||
WheelLeft8.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft8, 0F, 0F, 0F);
|
||||
WheelLeft9 = new ModelRenderer(this, 122, 23);
|
||||
WheelLeft9.addBox(5F, 2F, 0F, 2, 2, 1);
|
||||
WheelLeft9.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft9, 0F, 0F, 0F);
|
||||
WheelLeft10 = new ModelRenderer(this, 122, 9);
|
||||
WheelLeft10.addBox(5F, -4F, 0F, 2, 2, 1);
|
||||
WheelLeft10.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft10, 0F, 0F, 0F);
|
||||
WheelLeft11 = new ModelRenderer(this, 85, 5);
|
||||
WheelLeft11.addBox(4F, -6F, 0F, 2, 2, 1);
|
||||
WheelLeft11.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft11, 0F, 0F, 0F);
|
||||
WheelLeft12 = new ModelRenderer(this, 110, 3);
|
||||
WheelLeft12.addBox(2F, -7F, 0F, 2, 2, 1);
|
||||
WheelLeft12.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft12, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
BackPanel.render(f5);
|
||||
FrontPanel.render(f5);
|
||||
RightPanel.render(f5);
|
||||
LeftPanel.render(f5);
|
||||
BottomPanel.render(f5);
|
||||
RightHandle.render(f5);
|
||||
LeftHandle.render(f5);
|
||||
RightSpokeUp.render(f5);
|
||||
RightSpokeRight.render(f5);
|
||||
RightSpokeDown.render(f5);
|
||||
RightSpokeLeft.render(f5);
|
||||
RightAxle.render(f5);
|
||||
WheelRight1.render(f5);
|
||||
WheelRight2.render(f5);
|
||||
WheelRight3.render(f5);
|
||||
WheelRight4.render(f5);
|
||||
WheelRight5.render(f5);
|
||||
WheelRight6.render(f5);
|
||||
WheelRight7.render(f5);
|
||||
WheelRight8.render(f5);
|
||||
WheelRight9.render(f5);
|
||||
WheelRight10.render(f5);
|
||||
WheelRight11.render(f5);
|
||||
WheelRight12.render(f5);
|
||||
LeftSpokeRight.render(f5);
|
||||
LeftSpokeLeft.render(f5);
|
||||
LeftSpokeDown.render(f5);
|
||||
LeftSpokeUp.render(f5);
|
||||
LeftAxle.render(f5);
|
||||
WheelLeft1.render(f5);
|
||||
WheelLeft2.render(f5);
|
||||
WheelLeft3.render(f5);
|
||||
WheelLeft4.render(f5);
|
||||
WheelLeft5.render(f5);
|
||||
WheelLeft6.render(f5);
|
||||
WheelLeft7.render(f5);
|
||||
WheelLeft8.render(f5);
|
||||
WheelLeft9.render(f5);
|
||||
WheelLeft10.render(f5);
|
||||
WheelLeft11.render(f5);
|
||||
WheelLeft12.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.TextureOffset;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ModelRendererDegrees
|
||||
{
|
||||
/** The size of the texture file's width in pixels. */
|
||||
public float textureWidth;
|
||||
|
||||
/** The size of the texture file's height in pixels. */
|
||||
public float textureHeight;
|
||||
|
||||
/** The X offset into the texture used for displaying this model */
|
||||
private int textureOffsetX;
|
||||
|
||||
/** The Y offset into the texture used for displaying this model */
|
||||
private int textureOffsetY;
|
||||
public float rotationPointX;
|
||||
public float rotationPointY;
|
||||
public float rotationPointZ;
|
||||
public float rotateAngleX;
|
||||
public float rotateAngleY;
|
||||
public float rotateAngleZ;
|
||||
private boolean compiled;
|
||||
|
||||
/** The GL display list rendered by the Tessellator for this model */
|
||||
private int displayList;
|
||||
public boolean mirror;
|
||||
public boolean showModel;
|
||||
|
||||
/** Hides the model. */
|
||||
public boolean isHidden;
|
||||
public List cubeList;
|
||||
public List childModels;
|
||||
public final String boxName;
|
||||
private ModelBase baseModel;
|
||||
public float field_82906_o;
|
||||
public float field_82908_p;
|
||||
public float field_82907_q;
|
||||
|
||||
public ModelRendererDegrees(ModelBase par1ModelBase, String par2Str)
|
||||
{
|
||||
this.textureWidth = 64.0F;
|
||||
this.textureHeight = 32.0F;
|
||||
this.compiled = false;
|
||||
this.displayList = 0;
|
||||
this.mirror = false;
|
||||
this.showModel = true;
|
||||
this.isHidden = false;
|
||||
this.cubeList = new ArrayList();
|
||||
this.baseModel = par1ModelBase;
|
||||
par1ModelBase.boxList.add(this);
|
||||
this.boxName = par2Str;
|
||||
this.setTextureSize(par1ModelBase.textureWidth, par1ModelBase.textureHeight);
|
||||
}
|
||||
|
||||
public ModelRendererDegrees(ModelBase par1ModelBase)
|
||||
{
|
||||
this(par1ModelBase, (String) null);
|
||||
}
|
||||
|
||||
public ModelRendererDegrees(ModelBase par1ModelBase, int par2, int par3)
|
||||
{
|
||||
this(par1ModelBase);
|
||||
this.setTextureOffset(par2, par3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current box's rotation points and rotation angles to another box.
|
||||
*/
|
||||
public void addChild (ModelRendererDegrees par1ModelRenderer)
|
||||
{
|
||||
if (this.childModels == null)
|
||||
{
|
||||
this.childModels = new ArrayList();
|
||||
}
|
||||
|
||||
this.childModels.add(par1ModelRenderer);
|
||||
}
|
||||
|
||||
public ModelRendererDegrees setTextureOffset (int par1, int par2)
|
||||
{
|
||||
this.textureOffsetX = par1;
|
||||
this.textureOffsetY = par2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelRendererDegrees addBox (String par1Str, float par2, float par3, float par4, int par5, int par6, int par7)
|
||||
{
|
||||
par1Str = this.boxName + "." + par1Str;
|
||||
TextureOffset textureoffset = this.baseModel.getTextureOffset(par1Str);
|
||||
this.setTextureOffset(textureoffset.textureOffsetX, textureoffset.textureOffsetY);
|
||||
this.cubeList.add((new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7, 0.0F)).func_78244_a(par1Str));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelRendererDegrees addBox (float par1, float par2, float par3, int par4, int par5, int par6)
|
||||
{
|
||||
this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, 0.0F));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a textured box. Args: originX, originY, originZ, width, height, depth, scaleFactor.
|
||||
*/
|
||||
public void addBox (float par1, float par2, float par3, int par4, int par5, int par6, float par7)
|
||||
{
|
||||
this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, par7));
|
||||
}
|
||||
|
||||
public void setRotationPoint (float par1, float par2, float par3)
|
||||
{
|
||||
this.rotationPointX = par1;
|
||||
this.rotationPointY = par2;
|
||||
this.rotationPointZ = par3;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render (float par1)
|
||||
{
|
||||
if (!this.isHidden)
|
||||
{
|
||||
if (this.showModel)
|
||||
{
|
||||
if (!this.compiled)
|
||||
{
|
||||
this.compileDisplayList(par1);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(this.field_82906_o, this.field_82908_p, this.field_82907_q);
|
||||
int i;
|
||||
|
||||
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F)
|
||||
{
|
||||
if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F)
|
||||
{
|
||||
GL11.glCallList(this.displayList);
|
||||
|
||||
if (this.childModels != null)
|
||||
{
|
||||
for (i = 0; i < this.childModels.size(); ++i)
|
||||
{
|
||||
((ModelRendererDegrees) this.childModels.get(i)).render(par1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
GL11.glCallList(this.displayList);
|
||||
|
||||
if (this.childModels != null)
|
||||
{
|
||||
for (i = 0; i < this.childModels.size(); ++i)
|
||||
{
|
||||
((ModelRendererDegrees) this.childModels.get(i)).render(par1);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, -this.rotationPointZ * par1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
|
||||
if (this.rotateAngleZ != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleY != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
GL11.glCallList(this.displayList);
|
||||
|
||||
if (this.childModels != null)
|
||||
{
|
||||
for (i = 0; i < this.childModels.size(); ++i)
|
||||
{
|
||||
((ModelRendererDegrees) this.childModels.get(i)).render(par1);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-this.field_82906_o, -this.field_82908_p, -this.field_82907_q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderWithRotation (float par1)
|
||||
{
|
||||
if (!this.isHidden)
|
||||
{
|
||||
if (this.showModel)
|
||||
{
|
||||
if (!this.compiled)
|
||||
{
|
||||
this.compileDisplayList(par1);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
|
||||
if (this.rotateAngleY != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleZ != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glCallList(this.displayList);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the changing of Angles after a box has been rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRender (float par1)
|
||||
{
|
||||
if (!this.isHidden)
|
||||
{
|
||||
if (this.showModel)
|
||||
{
|
||||
if (!this.compiled)
|
||||
{
|
||||
this.compileDisplayList(par1);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F)
|
||||
{
|
||||
if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F)
|
||||
{
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1);
|
||||
|
||||
if (this.rotateAngleZ != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleY != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (this.rotateAngleX != 0.0F)
|
||||
{
|
||||
GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a GL display list for this model
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void compileDisplayList (float par1)
|
||||
{
|
||||
this.displayList = GLAllocation.generateDisplayLists(1);
|
||||
GL11.glNewList(this.displayList, GL11.GL_COMPILE);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
for (int i = 0; i < this.cubeList.size(); ++i)
|
||||
{
|
||||
((ModelBoxDegrees) this.cubeList.get(i)).render(tessellator, par1);
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
this.compiled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the model renderer with the new texture parameters.
|
||||
*/
|
||||
public ModelRendererDegrees setTextureSize (int par1, int par2)
|
||||
{
|
||||
this.textureWidth = (float) par1;
|
||||
this.textureHeight = (float) par2;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,458 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelWagon extends ModelBase
|
||||
{
|
||||
ModelRenderer Bottom;
|
||||
ModelRenderer Left;
|
||||
ModelRenderer Right;
|
||||
ModelRenderer Back;
|
||||
ModelRenderer Front;
|
||||
ModelRenderer Leftpull;
|
||||
ModelRenderer Rightpull;
|
||||
ModelRenderer LeftWheelAxle;
|
||||
ModelRenderer LeftWCenterHbeam;
|
||||
ModelRenderer LeftWCenterVtop;
|
||||
ModelRenderer LeftWCenterVbottom;
|
||||
ModelRenderer LeftWnwH;
|
||||
ModelRenderer LeftWnwM;
|
||||
ModelRenderer LeftWnwV;
|
||||
ModelRenderer LeftWnwEye;
|
||||
ModelRenderer LeftWneH;
|
||||
ModelRenderer LeftWneM;
|
||||
ModelRenderer LeftWneV;
|
||||
ModelRenderer LeftWneEye;
|
||||
ModelRenderer LeftWswH;
|
||||
ModelRenderer LeftWswM;
|
||||
ModelRenderer LeftWswV;
|
||||
ModelRenderer LeftWswEye;
|
||||
ModelRenderer LeftWseH;
|
||||
ModelRenderer LeftWseM;
|
||||
ModelRenderer LeftWseV;
|
||||
ModelRenderer LeftWseEye;
|
||||
ModelRenderer RightWheelAxle;
|
||||
ModelRenderer RightWCenterHbeam;
|
||||
ModelRenderer RightWCenterVtop;
|
||||
ModelRenderer RightWCenterVbottom;
|
||||
ModelRenderer RightWnwH;
|
||||
ModelRenderer RightWnwM;
|
||||
ModelRenderer RightWnwV;
|
||||
ModelRenderer RightWnwEye;
|
||||
ModelRenderer RoghtWneH;
|
||||
ModelRenderer RightWneM;
|
||||
ModelRenderer RightWneV;
|
||||
ModelRenderer RightWneEye;
|
||||
ModelRenderer RightWswH;
|
||||
ModelRenderer RightWswM;
|
||||
ModelRenderer RightWswV;
|
||||
ModelRenderer RightWswEye;
|
||||
ModelRenderer RightWseH;
|
||||
ModelRenderer RightWseM;
|
||||
ModelRenderer RightWseV;
|
||||
public ModelRenderer RightWseEye;
|
||||
ModelRenderer HandBrakeMain;
|
||||
ModelRenderer HandbrakeJamb;
|
||||
ModelRenderer StandCenterBar;
|
||||
ModelRenderer StandLeft;
|
||||
ModelRenderer StandRight;
|
||||
|
||||
public ModelWagon()
|
||||
{
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 64;
|
||||
this.Bottom = new ModelRenderer(this, 26, 46);
|
||||
this.Bottom.addBox(0.0F, 0.0F, 0.0F, 20, 2, 16);
|
||||
this.Bottom.setRotationPoint(-10.0F, 4.0F, -8.0F);
|
||||
this.Bottom.setTextureSize(64, 32);
|
||||
this.Bottom.mirror = true;
|
||||
this.setRotation(this.Bottom, 0.0F, 0.0F, 0.0F);
|
||||
this.Left = new ModelRenderer(this, 0, 35);
|
||||
this.Left.addBox(0.0F, 0.0F, 0.0F, 20, 8, 2);
|
||||
this.Left.setRotationPoint(-10.0F, -4.0F, -8.0F);
|
||||
this.Left.setTextureSize(64, 32);
|
||||
this.Left.mirror = true;
|
||||
this.setRotation(this.Left, 0.0F, 0.0F, 0.0F);
|
||||
this.Right = new ModelRenderer(this, 83, 35);
|
||||
this.Right.addBox(0.0F, 0.0F, 0.0F, 20, 8, 2);
|
||||
this.Right.setRotationPoint(-10.0F, -4.0F, 6.0F);
|
||||
this.Right.setTextureSize(64, 32);
|
||||
this.Right.mirror = true;
|
||||
this.setRotation(this.Right, 0.0F, 0.0F, 0.0F);
|
||||
this.Back = new ModelRenderer(this, 99, 46);
|
||||
this.Back.addBox(-2.0F, -5.0F, 0.0F, 2, 5, 12);
|
||||
this.Back.setRotationPoint(10.0F, 4.0F, -6.0F);
|
||||
this.Back.setTextureSize(64, 32);
|
||||
this.Back.mirror = true;
|
||||
this.setRotation(this.Back, 0.0F, 0.0F, 0.0F);
|
||||
this.Front = new ModelRenderer(this, 50, 1);
|
||||
this.Front.addBox(0.0F, 0.0F, 0.0F, 2, 8, 12);
|
||||
this.Front.setRotationPoint(-10.0F, -4.0F, -6.0F);
|
||||
this.Front.setTextureSize(64, 32);
|
||||
this.Front.mirror = true;
|
||||
this.setRotation(this.Front, 0.0F, 0.0F, 0.0F);
|
||||
this.Leftpull = new ModelRenderer(this, 0, 30);
|
||||
this.Leftpull.addBox(0.0F, 0.0F, 0.0F, 16, 2, 2);
|
||||
this.Leftpull.setRotationPoint(-26.0F, 2.0F, -6.0F);
|
||||
this.Leftpull.setTextureSize(64, 32);
|
||||
this.Leftpull.mirror = true;
|
||||
this.setRotation(this.Leftpull, 0.0F, 0.0F, 0.0F);
|
||||
this.Rightpull = new ModelRenderer(this, 91, 30);
|
||||
this.Rightpull.addBox(0.0F, 0.0F, 0.0F, 16, 2, 2);
|
||||
this.Rightpull.setRotationPoint(-26.0F, 2.0F, 4.0F);
|
||||
this.Rightpull.setTextureSize(64, 32);
|
||||
this.Rightpull.mirror = true;
|
||||
this.setRotation(this.Rightpull, 0.0F, 0.0F, 0.0F);
|
||||
this.HandBrakeMain = new ModelRenderer(this, 1, 59);
|
||||
this.HandBrakeMain.addBox(-6.0F, 0.0F, 0.0F, 11, 1, 1);
|
||||
this.HandBrakeMain.setRotationPoint(-9.0F, -3.0F, -9.0F);
|
||||
this.HandBrakeMain.setTextureSize(64, 32);
|
||||
this.HandBrakeMain.mirror = true;
|
||||
this.setRotation(this.HandBrakeMain, 0.0F, 0.0F, 0.0F);
|
||||
this.HandbrakeJamb = new ModelRenderer(this, 10, 62);
|
||||
this.HandbrakeJamb.addBox(3.0F, 1.0F, 0.0F, 2, 1, 1);
|
||||
this.HandbrakeJamb.setRotationPoint(-9.0F, -3.0F, -9.0F);
|
||||
this.HandbrakeJamb.setTextureSize(64, 32);
|
||||
this.HandbrakeJamb.mirror = true;
|
||||
this.setRotation(this.HandbrakeJamb, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWheelAxle = new ModelRenderer(this, 0, 12);
|
||||
this.LeftWheelAxle.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 3);
|
||||
this.LeftWheelAxle.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWheelAxle.setTextureSize(64, 32);
|
||||
this.LeftWheelAxle.mirror = true;
|
||||
this.setRotation(this.LeftWheelAxle, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWCenterHbeam = new ModelRenderer(this, 12, 12);
|
||||
this.LeftWCenterHbeam.addBox(-8.0F, -2.0F, 0.0F, 16, 4, 1);
|
||||
this.LeftWCenterHbeam.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWCenterHbeam.setTextureSize(64, 32);
|
||||
this.LeftWCenterHbeam.mirror = true;
|
||||
this.setRotation(this.LeftWCenterHbeam, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWCenterVtop = new ModelRenderer(this, 18, 0);
|
||||
this.LeftWCenterVtop.addBox(-2.0F, -8.0F, 0.0F, 4, 6, 1);
|
||||
this.LeftWCenterVtop.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWCenterVtop.setTextureSize(64, 32);
|
||||
this.LeftWCenterVtop.mirror = true;
|
||||
this.setRotation(this.LeftWCenterVtop, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWCenterVbottom = new ModelRenderer(this, 18, 22);
|
||||
this.LeftWCenterVbottom.addBox(-2.0F, 2.0F, 0.0F, 4, 6, 1);
|
||||
this.LeftWCenterVbottom.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWCenterVbottom.setTextureSize(64, 32);
|
||||
this.LeftWCenterVbottom.mirror = true;
|
||||
this.setRotation(this.LeftWCenterVbottom, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwH = new ModelRenderer(this, 0, 7);
|
||||
this.LeftWnwH.addBox(-7.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWnwH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwH.setTextureSize(64, 32);
|
||||
this.LeftWnwH.mirror = true;
|
||||
this.setRotation(this.LeftWnwH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwM = new ModelRenderer(this, 4, 3);
|
||||
this.LeftWnwM.addBox(-6.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWnwM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwM.setTextureSize(64, 32);
|
||||
this.LeftWnwM.mirror = true;
|
||||
this.setRotation(this.LeftWnwM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwV = new ModelRenderer(this, 11, 1);
|
||||
this.LeftWnwV.addBox(-4.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWnwV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwV.setTextureSize(64, 32);
|
||||
this.LeftWnwV.mirror = true;
|
||||
this.setRotation(this.LeftWnwV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwEye = new ModelRenderer(this, 10, 7);
|
||||
this.LeftWnwEye.addBox(-4.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWnwEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwEye.setTextureSize(64, 32);
|
||||
this.LeftWnwEye.mirror = true;
|
||||
this.setRotation(this.LeftWnwEye, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneH = new ModelRenderer(this, 40, 7);
|
||||
this.LeftWneH.addBox(4.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWneH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneH.setTextureSize(64, 32);
|
||||
this.LeftWneH.mirror = true;
|
||||
this.setRotation(this.LeftWneH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneM = new ModelRenderer(this, 37, 3);
|
||||
this.LeftWneM.addBox(4.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWneM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneM.setTextureSize(64, 32);
|
||||
this.LeftWneM.mirror = true;
|
||||
this.setRotation(this.LeftWneM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneV = new ModelRenderer(this, 29, 1);
|
||||
this.LeftWneV.addBox(2.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWneV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneV.setTextureSize(64, 32);
|
||||
this.LeftWneV.mirror = true;
|
||||
this.setRotation(this.LeftWneV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneEye = new ModelRenderer(this, 33, 7);
|
||||
this.LeftWneEye.addBox(3.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWneEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneEye.setTextureSize(64, 32);
|
||||
this.LeftWneEye.mirror = true;
|
||||
this.setRotation(this.LeftWneEye, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswH = new ModelRenderer(this, 0, 19);
|
||||
this.LeftWswH.addBox(-7.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWswH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswH.setTextureSize(64, 32);
|
||||
this.LeftWswH.mirror = true;
|
||||
this.setRotation(this.LeftWswH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswM = new ModelRenderer(this, 4, 23);
|
||||
this.LeftWswM.addBox(-6.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWswM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswM.setTextureSize(64, 32);
|
||||
this.LeftWswM.mirror = true;
|
||||
this.setRotation(this.LeftWswM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswV = new ModelRenderer(this, 11, 24);
|
||||
this.LeftWswV.addBox(-4.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWswV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswV.setTextureSize(64, 32);
|
||||
this.LeftWswV.mirror = true;
|
||||
this.setRotation(this.LeftWswV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswEye = new ModelRenderer(this, 10, 20);
|
||||
this.LeftWswEye.addBox(-4.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWswEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswEye.setTextureSize(64, 32);
|
||||
this.LeftWswEye.mirror = true;
|
||||
this.setRotation(this.LeftWswEye, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseH = new ModelRenderer(this, 40, 19);
|
||||
this.LeftWseH.addBox(4.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWseH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseH.setTextureSize(64, 32);
|
||||
this.LeftWseH.mirror = true;
|
||||
this.setRotation(this.LeftWseH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseM = new ModelRenderer(this, 37, 23);
|
||||
this.LeftWseM.addBox(4.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWseM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseM.setTextureSize(64, 32);
|
||||
this.LeftWseM.mirror = true;
|
||||
this.setRotation(this.LeftWseM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseV = new ModelRenderer(this, 29, 24);
|
||||
this.LeftWseV.addBox(2.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWseV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseV.setTextureSize(64, 32);
|
||||
this.LeftWseV.mirror = true;
|
||||
this.setRotation(this.LeftWseV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseEye = new ModelRenderer(this, 33, 20);
|
||||
this.LeftWseEye.addBox(3.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWseEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseEye.setTextureSize(64, 32);
|
||||
this.LeftWseEye.mirror = true;
|
||||
this.setRotation(this.LeftWseEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWheelAxle = new ModelRenderer(this, 117, 12);
|
||||
this.RightWheelAxle.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 3);
|
||||
this.RightWheelAxle.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWheelAxle.setTextureSize(64, 32);
|
||||
this.RightWheelAxle.mirror = true;
|
||||
this.setRotation(this.RightWheelAxle, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWCenterHbeam = new ModelRenderer(this, 80, 12);
|
||||
this.RightWCenterHbeam.addBox(-8.0F, -2.0F, 0.0F, 16, 4, 1);
|
||||
this.RightWCenterHbeam.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWCenterHbeam.setTextureSize(64, 32);
|
||||
this.RightWCenterHbeam.mirror = true;
|
||||
this.setRotation(this.RightWCenterHbeam, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWCenterVtop = new ModelRenderer(this, 98, 0);
|
||||
this.RightWCenterVtop.addBox(-2.0F, -8.0F, 0.0F, 4, 6, 1);
|
||||
this.RightWCenterVtop.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWCenterVtop.setTextureSize(64, 32);
|
||||
this.RightWCenterVtop.mirror = true;
|
||||
this.setRotation(this.RightWCenterVtop, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWCenterVbottom = new ModelRenderer(this, 98, 22);
|
||||
this.RightWCenterVbottom.addBox(-2.0F, 2.0F, 0.0F, 4, 6, 1);
|
||||
this.RightWCenterVbottom.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWCenterVbottom.setTextureSize(64, 32);
|
||||
this.RightWCenterVbottom.mirror = true;
|
||||
this.setRotation(this.RightWCenterVbottom, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwH = new ModelRenderer(this, 79, 7);
|
||||
this.RightWnwH.addBox(4.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.RightWnwH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwH.setTextureSize(64, 32);
|
||||
this.RightWnwH.mirror = true;
|
||||
this.setRotation(this.RightWnwH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwM = new ModelRenderer(this, 84, 3);
|
||||
this.RightWnwM.addBox(4.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWnwM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwM.setTextureSize(64, 32);
|
||||
this.RightWnwM.mirror = true;
|
||||
this.setRotation(this.RightWnwM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwV = new ModelRenderer(this, 91, 1);
|
||||
this.RightWnwV.addBox(2.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWnwV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwV.setTextureSize(64, 32);
|
||||
this.RightWnwV.mirror = true;
|
||||
this.setRotation(this.RightWnwV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwEye = new ModelRenderer(this, 90, 7);
|
||||
this.RightWnwEye.addBox(3.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWnwEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwEye.setTextureSize(64, 32);
|
||||
this.RightWnwEye.mirror = true;
|
||||
this.setRotation(this.RightWnwEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RoghtWneH = new ModelRenderer(this, 119, 7);
|
||||
this.RoghtWneH.addBox(-7.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.RoghtWneH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RoghtWneH.setTextureSize(64, 32);
|
||||
this.RoghtWneH.mirror = true;
|
||||
this.setRotation(this.RoghtWneH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWneM = new ModelRenderer(this, 116, 3);
|
||||
this.RightWneM.addBox(-6.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWneM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWneM.setTextureSize(64, 32);
|
||||
this.RightWneM.mirror = true;
|
||||
this.setRotation(this.RightWneM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWneV = new ModelRenderer(this, 109, 1);
|
||||
this.RightWneV.addBox(-4.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWneV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWneV.setTextureSize(64, 32);
|
||||
this.RightWneV.mirror = true;
|
||||
this.setRotation(this.RightWneV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWneEye = new ModelRenderer(this, 113, 7);
|
||||
this.RightWneEye.addBox(-4.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWneEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWneEye.setTextureSize(64, 32);
|
||||
this.RightWneEye.mirror = true;
|
||||
this.setRotation(this.RightWneEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswH = new ModelRenderer(this, 79, 19);
|
||||
this.RightWswH.addBox(4.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.RightWswH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswH.setTextureSize(64, 32);
|
||||
this.RightWswH.mirror = true;
|
||||
this.setRotation(this.RightWswH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswM = new ModelRenderer(this, 84, 23);
|
||||
this.RightWswM.addBox(4.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWswM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswM.setTextureSize(64, 32);
|
||||
this.RightWswM.mirror = true;
|
||||
this.setRotation(this.RightWswM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswV = new ModelRenderer(this, 91, 24);
|
||||
this.RightWswV.addBox(2.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWswV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswV.setTextureSize(64, 32);
|
||||
this.RightWswV.mirror = true;
|
||||
this.setRotation(this.RightWswV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswEye = new ModelRenderer(this, 90, 20);
|
||||
this.RightWswEye.addBox(3.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWswEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswEye.setTextureSize(64, 32);
|
||||
this.RightWswEye.mirror = true;
|
||||
this.setRotation(this.RightWswEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseH = new ModelRenderer(this, 119, 19);
|
||||
this.RightWseH.addBox(-7.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.RightWseH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseH.setTextureSize(64, 32);
|
||||
this.RightWseH.mirror = true;
|
||||
this.setRotation(this.RightWseH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseM = new ModelRenderer(this, 116, 23);
|
||||
this.RightWseM.addBox(-6.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWseM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseM.setTextureSize(64, 32);
|
||||
this.RightWseM.mirror = true;
|
||||
this.setRotation(this.RightWseM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseV = new ModelRenderer(this, 109, 24);
|
||||
this.RightWseV.addBox(-4.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWseV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseV.setTextureSize(64, 32);
|
||||
this.RightWseV.mirror = true;
|
||||
this.setRotation(this.RightWseV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseEye = new ModelRenderer(this, 113, 20);
|
||||
this.RightWseEye.addBox(-4.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWseEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseEye.setTextureSize(64, 32);
|
||||
this.RightWseEye.mirror = true;
|
||||
this.setRotation(this.RightWseEye, 0.0F, 0.0F, 0.0F);
|
||||
this.StandCenterBar = new ModelRenderer(this, 47, 27);
|
||||
this.StandCenterBar.addBox(-1.0F, 0.0F, -8.0F, 1, 2, 16);
|
||||
this.StandCenterBar.setRotationPoint(-9.0F, 6.0F, 0.0F);
|
||||
this.StandCenterBar.setTextureSize(64, 32);
|
||||
this.StandCenterBar.mirror = true;
|
||||
this.setRotation(this.StandCenterBar, 0.0F, 0.0F, 0.0F);
|
||||
this.StandLeft = new ModelRenderer(this, 37, 27);
|
||||
this.StandLeft.addBox(-1.0F, 2.0F, -8.0F, 1, 5, 2);
|
||||
this.StandLeft.setRotationPoint(-9.0F, 6.0F, 0.0F);
|
||||
this.StandLeft.setTextureSize(64, 32);
|
||||
this.StandLeft.mirror = true;
|
||||
this.setRotation(this.StandLeft, 0.0F, 0.0F, 0.0F);
|
||||
this.StandRight = new ModelRenderer(this, 84, 27);
|
||||
this.StandRight.addBox(-1.0F, 2.0F, 6.0F, 1, 5, 2);
|
||||
this.StandRight.setRotationPoint(-9.0F, 6.0F, 0.0F);
|
||||
this.StandRight.setTextureSize(64, 32);
|
||||
this.StandRight.mirror = true;
|
||||
this.setRotation(this.StandRight, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the models various rotation angles then renders the model.
|
||||
*/
|
||||
@Override
|
||||
public void render (Entity var1, float var2, float var3, float var4, float var5, float var6, float var7)
|
||||
{
|
||||
super.render(var1, var2, var3, var4, var5, var6, var7);
|
||||
this.setRotationAngles(var2, var3, var4, var5, var6, var7, var1);
|
||||
this.LeftWheelAxle.rotateAngleZ = this.LeftWCenterHbeam.rotateAngleZ = this.LeftWCenterVtop.rotateAngleZ = this.LeftWCenterVbottom.rotateAngleZ = this.LeftWnwH.rotateAngleZ = this.LeftWnwM.rotateAngleZ = this.LeftWnwV.rotateAngleZ = this.LeftWnwEye.rotateAngleZ = this.LeftWneH.rotateAngleZ = this.LeftWneM.rotateAngleZ = this.LeftWneV.rotateAngleZ = this.LeftWneEye.rotateAngleZ = this.LeftWswH.rotateAngleZ = this.LeftWswM.rotateAngleZ = this.LeftWswV.rotateAngleZ = this.LeftWswEye.rotateAngleZ = this.LeftWseH.rotateAngleZ = this.LeftWseM.rotateAngleZ = this.LeftWseV.rotateAngleZ = this.LeftWseEye.rotateAngleZ = this.RightWheelAxle.rotateAngleZ = this.RightWCenterHbeam.rotateAngleZ = this.RightWCenterVtop.rotateAngleZ = this.RightWCenterVbottom.rotateAngleZ = this.RightWnwH.rotateAngleZ = this.RightWnwM.rotateAngleZ = this.RightWnwV.rotateAngleZ = this.RightWnwEye.rotateAngleZ = this.RoghtWneH.rotateAngleZ = this.RightWneM.rotateAngleZ = this.RightWneV.rotateAngleZ = this.RightWneEye.rotateAngleZ = this.RightWswH.rotateAngleZ = this.RightWswM.rotateAngleZ = this.RightWswV.rotateAngleZ = this.RightWswEye.rotateAngleZ = this.RightWseH.rotateAngleZ = this.RightWseM.rotateAngleZ = this.RightWseV.rotateAngleZ = this.RightWseEye.rotateAngleZ;
|
||||
this.Bottom.render(var7);
|
||||
this.Left.render(var7);
|
||||
this.Right.render(var7);
|
||||
this.Back.render(var7);
|
||||
this.Front.render(var7);
|
||||
this.Leftpull.render(var7);
|
||||
this.Rightpull.render(var7);
|
||||
this.HandBrakeMain.render(var7);
|
||||
this.HandbrakeJamb.render(var7);
|
||||
this.LeftWheelAxle.render(var7);
|
||||
this.LeftWCenterHbeam.render(var7);
|
||||
this.LeftWCenterVtop.render(var7);
|
||||
this.LeftWCenterVbottom.render(var7);
|
||||
this.LeftWnwH.render(var7);
|
||||
this.LeftWnwM.render(var7);
|
||||
this.LeftWnwV.render(var7);
|
||||
this.LeftWnwEye.render(var7);
|
||||
this.LeftWneH.render(var7);
|
||||
this.LeftWneM.render(var7);
|
||||
this.LeftWneV.render(var7);
|
||||
this.LeftWneEye.render(var7);
|
||||
this.LeftWswH.render(var7);
|
||||
this.LeftWswM.render(var7);
|
||||
this.LeftWswV.render(var7);
|
||||
this.LeftWswEye.render(var7);
|
||||
this.LeftWseH.render(var7);
|
||||
this.LeftWseM.render(var7);
|
||||
this.LeftWseV.render(var7);
|
||||
this.LeftWseEye.render(var7);
|
||||
this.RightWheelAxle.render(var7);
|
||||
this.RightWCenterHbeam.render(var7);
|
||||
this.RightWCenterVtop.render(var7);
|
||||
this.RightWCenterVbottom.render(var7);
|
||||
this.RightWnwH.render(var7);
|
||||
this.RightWnwM.render(var7);
|
||||
this.RightWnwV.render(var7);
|
||||
this.RightWnwEye.render(var7);
|
||||
this.RoghtWneH.render(var7);
|
||||
this.RightWneM.render(var7);
|
||||
this.RightWneV.render(var7);
|
||||
this.RightWneEye.render(var7);
|
||||
this.RightWswH.render(var7);
|
||||
this.RightWswM.render(var7);
|
||||
this.RightWswV.render(var7);
|
||||
this.RightWswEye.render(var7);
|
||||
this.RightWseH.render(var7);
|
||||
this.RightWseM.render(var7);
|
||||
this.RightWseV.render(var7);
|
||||
this.RightWseEye.render(var7);
|
||||
this.StandCenterBar.render(var7);
|
||||
this.StandLeft.render(var7);
|
||||
this.StandRight.render(var7);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer var1, float var2, float var3, float var4)
|
||||
{
|
||||
var1.rotateAngleX = var2;
|
||||
var1.rotateAngleY = var3;
|
||||
var1.rotateAngleZ = var4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the models various rotation angles.
|
||||
*/
|
||||
@Override
|
||||
public void setRotationAngles (float var1, float var2, float var3, float var4, float var5, float var6, Entity par7Entity)
|
||||
{
|
||||
super.setRotationAngles(var1, var2, var3, var4, var5, var6, par7Entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.entity.SlimeClone;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SlimeCloneRender extends RenderLiving
|
||||
{
|
||||
private ModelBase scaleAmount;
|
||||
|
||||
public SlimeCloneRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
|
||||
{
|
||||
super(par1ModelBase, par3);
|
||||
this.scaleAmount = par2ModelBase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether Slime Render should pass or not.
|
||||
*/
|
||||
protected int shouldSlimeRenderPass (SlimeClone blueSlime, int par2, float par3)
|
||||
{
|
||||
if (blueSlime.isInvisible())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (par2 == 0)
|
||||
{
|
||||
this.setRenderPassModel(this.scaleAmount);
|
||||
GL11.glEnable(GL11.GL_NORMALIZE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par2 == 1)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the scale for the slime based on getSlimeSize in EdibleSlime
|
||||
*/
|
||||
protected void scaleSlime (SlimeClone slimeClone, float par2)
|
||||
{
|
||||
float f1 = slimeClone.getSlimeSize();
|
||||
float f2 = (slimeClone.sizeHeight + (slimeClone.sizeFactor - slimeClone.sizeHeight) * par2) / (f1 * 0.5F + 1.0F);
|
||||
float f3 = 1.0F / (f2 + 1.0F);
|
||||
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
||||
* entityLiving, partialTickTime
|
||||
*/
|
||||
protected void preRenderCallback (EntityLiving par1EntityLiving, float par2)
|
||||
{
|
||||
this.scaleSlime((SlimeClone) par1EntityLiving, par2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
|
||||
{
|
||||
return this.shouldSlimeRenderPass((SlimeClone) par1EntityLiving, par2, par3);
|
||||
}
|
||||
|
||||
/*protected ResourceLocation func_98191_a (SlimeClone slime)
|
||||
{
|
||||
this.loadDownloadableImageTexture(slime.skinUrl, slime.getTexture());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void func_98190_a (EntityLiving par1EntityLiving)
|
||||
{
|
||||
this.func_98191_a((SlimeClone) par1EntityLiving);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
protected ResourceLocation func_110775_a (Entity entity)
|
||||
{
|
||||
//return func_98191_a((SlimeClone)entity);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SlimeModel extends ModelBase
|
||||
{
|
||||
/** The slime's bodies, both the inside box and the outside box */
|
||||
ModelRenderer slimeBodies;
|
||||
|
||||
/** The slime's right eye */
|
||||
ModelRenderer slimeRightEye;
|
||||
|
||||
/** The slime's left eye */
|
||||
ModelRenderer slimeLeftEye;
|
||||
|
||||
/** The slime's mouth */
|
||||
ModelRenderer slimeMouth;
|
||||
|
||||
public SlimeModel(int par1)
|
||||
{
|
||||
this.slimeBodies = new ModelRenderer(this, 0, par1);
|
||||
this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8);
|
||||
|
||||
if (par1 > 0)
|
||||
{
|
||||
this.slimeBodies = new ModelRenderer(this, 0, par1);
|
||||
this.slimeBodies.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6);
|
||||
this.slimeRightEye = new ModelRenderer(this, 32, 0);
|
||||
this.slimeRightEye.addBox(-3.25F, 18.0F, -3.5F, 2, 2, 2);
|
||||
this.slimeLeftEye = new ModelRenderer(this, 32, 4);
|
||||
this.slimeLeftEye.addBox(1.25F, 18.0F, -3.5F, 2, 2, 2);
|
||||
this.slimeMouth = new ModelRenderer(this, 32, 8);
|
||||
this.slimeMouth.addBox(0.0F, 21.0F, -3.5F, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the models various rotation angles then renders the model.
|
||||
*/
|
||||
public void render (Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
this.slimeBodies.render(par7);
|
||||
|
||||
if (this.slimeRightEye != null)
|
||||
{
|
||||
this.slimeRightEye.render(par7);
|
||||
this.slimeLeftEye.render(par7);
|
||||
this.slimeMouth.render(par7);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package tconstruct.client.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.boss.BossStatus;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.entity.BlueSlime;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SlimeRender extends RenderLiving
|
||||
{
|
||||
private ModelBase scaleAmount;
|
||||
|
||||
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
|
||||
{
|
||||
super(par1ModelBase, par3);
|
||||
this.scaleAmount = par2ModelBase;
|
||||
}
|
||||
|
||||
public void doRenderLiving (EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
super.doRenderLiving(par1EntityLiving, par2, par4, par6, par8, par9);
|
||||
renderBossHealth((BlueSlime) par1EntityLiving);
|
||||
}
|
||||
|
||||
public void renderBossHealth (BlueSlime slime)
|
||||
{
|
||||
if (slime.getSlimeSize() >= 8)
|
||||
BossStatus.func_82824_a(slime, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether Slime Render should pass or not.
|
||||
*/
|
||||
protected int shouldSlimeRenderPass (BlueSlime blueSlime, int par2, float par3)
|
||||
{
|
||||
if (blueSlime.isInvisible())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (par2 == 0)
|
||||
{
|
||||
this.setRenderPassModel(this.scaleAmount);
|
||||
GL11.glEnable(GL11.GL_NORMALIZE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par2 == 1)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the scale for the slime based on getSlimeSize in EdibleSlime
|
||||
*/
|
||||
protected void scaleSlime (BlueSlime par1EdibleSlime, float par2)
|
||||
{
|
||||
float f1 = (float) par1EdibleSlime.getSlimeSize();
|
||||
float f2 = (par1EdibleSlime.sizeHeight + (par1EdibleSlime.sizeFactor - par1EdibleSlime.sizeHeight) * par2) / (f1 * 0.5F + 1.0F);
|
||||
float f3 = 1.0F / (f2 + 1.0F);
|
||||
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
||||
* entityLiving, partialTickTime
|
||||
*/
|
||||
protected void preRenderCallback (EntityLiving par1EntityLiving, float par2)
|
||||
{
|
||||
this.scaleSlime((BlueSlime) par1EntityLiving, par2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
|
||||
{
|
||||
return this.shouldSlimeRenderPass((BlueSlime) par1EntityLiving, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation func_110775_a(Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
|
||||
}
|
||||
@@ -0,0 +1,634 @@
|
||||
package tconstruct.client.entity.projectile;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.entity.projectile.ArrowEntity;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ArrowRender extends Render
|
||||
{
|
||||
private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
private RenderBlocks itemRenderBlocks = new RenderBlocks();
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel;
|
||||
public static boolean renderInFrame;
|
||||
|
||||
public ArrowRender()
|
||||
{
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.func_110777_b(par1ArrowEntity);
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = par1ArrowEntity.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
|
||||
byte b0 = getMiniBlockCount(itemstack);
|
||||
|
||||
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
int i;
|
||||
|
||||
Block block = null;
|
||||
if (itemstack.itemID < Block.blocksList.length)
|
||||
{
|
||||
block = Block.blocksList[itemstack.itemID];
|
||||
}
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
|
||||
{
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
float f7 = 0.25F;
|
||||
int j = block.getRenderType();
|
||||
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2)
|
||||
{
|
||||
f7 = 0.5F;
|
||||
}
|
||||
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
|
||||
for (i = 0; i < b0; ++i)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
GL11.glTranslatef(f5, f4, f6);
|
||||
}
|
||||
|
||||
f5 = 1.0F;
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
this.random.setSeed(187L);
|
||||
Icon icon = itemstack.getItem().getIcon(itemstack, k);
|
||||
f8 = 1.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
|
||||
f5 = (float) (i >> 16 & 255) / 255.0F;
|
||||
f4 = (float) (i >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (i & 255) / 255.0F;
|
||||
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
Icon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
|
||||
f8 = (float) (l >> 16 & 255) / 255.0F;
|
||||
float f9 = (float) (l >> 8 & 255) / 255.0F;
|
||||
f5 = (float) (l & 255) / 255.0F;
|
||||
f4 = 1.0F;
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.func_130087_a(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (ArrowEntity par1ArrowEntity, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
|
||||
}
|
||||
|
||||
private void renderDroppedItem (ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
|
||||
ResourceLocation resourcelocation = texturemanager.func_130087_a(arrow.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
|
||||
}
|
||||
|
||||
float f4 = ((Icon) par2Icon).getMinU();
|
||||
float f5 = ((Icon) par2Icon).getMaxU();
|
||||
float f6 = ((Icon) par2Icon).getMinV();
|
||||
float f7 = ((Icon) par2Icon).getMaxV();
|
||||
float f8 = 1.0F;
|
||||
float f9 = 0.5F;
|
||||
float f10 = 0.25F;
|
||||
float f11;
|
||||
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glRotatef((((float) 0 + par4) / 20.0F + 0) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
float f12 = 0.0625F;
|
||||
f11 = 0.021875F;
|
||||
ItemStack itemstack = arrow.getEntityItem();
|
||||
int j = itemstack.stackSize;
|
||||
byte b0 = getMiniItemCount(itemstack);
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
|
||||
if (k > 0 && shouldSpreadItems())
|
||||
{
|
||||
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
GL11.glTranslatef(x, y, f12 + f11);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
}
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
this.func_110776_a(TextureMap.field_110575_b);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.func_110776_a(TextureMap.field_110576_c);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getOriginX(), ((Icon) par2Icon).getOriginY(), f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.func_110577_a(field_110798_h);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
float f13 = 0.76F;
|
||||
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
float f14 = 0.125F;
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
|
||||
GL11.glTranslatef(f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
|
||||
GL11.glTranslatef(-f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's icon or block into the UI at the specified position.
|
||||
*/
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
|
||||
}
|
||||
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
|
||||
{
|
||||
int k = par3ItemStack.itemID;
|
||||
int l = par3ItemStack.getItemDamage();
|
||||
Object object = par3ItemStack.getIconIndex();
|
||||
float f;
|
||||
int i1;
|
||||
float f1;
|
||||
float f2;
|
||||
|
||||
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
|
||||
{
|
||||
par2TextureManager.func_110577_a(TextureMap.field_110575_b);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
|
||||
GL11.glScalef(10.0F, 10.0F, 10.0F);
|
||||
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
|
||||
GL11.glScalef(1.0F, 1.0F, -1.0F);
|
||||
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
|
||||
f = (float) (i1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = this.renderWithColor;
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (Item.itemsList[k].requiresMultipleRenderPasses())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
|
||||
{
|
||||
par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
|
||||
Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
|
||||
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
|
||||
f1 = (float) (k1 >> 16 & 255) / 255.0F;
|
||||
f2 = (float) (k1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (k1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f1, f2, f3, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, icon, 16, 16);
|
||||
|
||||
if (par3ItemStack.hasEffect(j1))
|
||||
{
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
ResourceLocation resourcelocation = par2TextureManager.func_130087_a(par3ItemStack.getItemSpriteNumber());
|
||||
par2TextureManager.func_110577_a(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(resourcelocation)).func_110572_b("missingno");
|
||||
}
|
||||
|
||||
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
|
||||
f = (float) (i1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, (Icon) object, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
if (par3ItemStack.hasEffect(0))
|
||||
{
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
private void renderEffect (TextureManager manager, int x, int y)
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
manager.func_110577_a(field_110798_h);
|
||||
this.zLevel -= 50.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
|
||||
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
|
||||
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
this.zLevel += 50.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the item's icon or block into the GUI, including the glint effect.
|
||||
*/
|
||||
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
|
||||
{
|
||||
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
|
||||
}
|
||||
|
||||
/* Modders must handle this themselves if they use custom renderers!
|
||||
if (par3ItemStack.hasEffect())
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
par2TextureManager.func_110577_a(field_110798_h);
|
||||
this.zLevel -= 50.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
|
||||
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
|
||||
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
this.zLevel += 50.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
{
|
||||
if (j1 == 0)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
|
||||
float f3 = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f4 = 4.0F;
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
f4 = -1.0F;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
|
||||
* specified position.
|
||||
*/
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
|
||||
}
|
||||
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (par3ItemStack.stackSize > 1 || par6Str != null)
|
||||
{
|
||||
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if (par3ItemStack.isItemDamaged())
|
||||
{
|
||||
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
|
||||
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int i1 = 255 - l << 16 | l << 8;
|
||||
int j1 = (255 - l) / 4 << 16 | 16128;
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
|
||||
* tessellator, x, y, width, height, color
|
||||
*/
|
||||
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I(par6);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110775_a (Entity par1Entity)
|
||||
{
|
||||
return this.func_110796_a((ArrowEntity) par1Entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
|
||||
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
|
||||
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
|
||||
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte getMiniBlockCount (ItemStack stack)
|
||||
{
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 5)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 20)
|
||||
ret = 4;
|
||||
if (stack.stackSize > 40)
|
||||
ret = 5;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for a subclass to override how many rendered items appear in a
|
||||
* "mini item 3d stack"
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public byte getMiniItemCount (ItemStack stack)
|
||||
{
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 15)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 31)
|
||||
ret = 4;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,633 @@
|
||||
package tconstruct.client.entity.projectile;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.entity.projectile.DaggerEntity;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class DaggerRender extends Render
|
||||
{
|
||||
private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
private RenderBlocks itemRenderBlocks = new RenderBlocks();
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel;
|
||||
public static boolean renderInFrame;
|
||||
|
||||
public DaggerRender()
|
||||
{
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (DaggerEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.func_110777_b(par1ArrowEntity);
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = par1ArrowEntity.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
|
||||
byte b0 = getMiniBlockCount(itemstack);
|
||||
|
||||
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
int i;
|
||||
|
||||
Block block = null;
|
||||
if (itemstack.itemID < Block.blocksList.length)
|
||||
{
|
||||
block = Block.blocksList[itemstack.itemID];
|
||||
}
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
|
||||
{
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
float f7 = 0.25F;
|
||||
int j = block.getRenderType();
|
||||
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2)
|
||||
{
|
||||
f7 = 0.5F;
|
||||
}
|
||||
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
|
||||
for (i = 0; i < b0; ++i)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
GL11.glTranslatef(f5, f4, f6);
|
||||
}
|
||||
|
||||
f5 = 1.0F;
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
this.random.setSeed(187L);
|
||||
Icon icon = itemstack.getItem().getIcon(itemstack, k);
|
||||
f8 = 1.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
|
||||
f5 = (float) (i >> 16 & 255) / 255.0F;
|
||||
f4 = (float) (i >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (i & 255) / 255.0F;
|
||||
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
Icon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
|
||||
f8 = (float) (l >> 16 & 255) / 255.0F;
|
||||
float f9 = (float) (l >> 8 & 255) / 255.0F;
|
||||
f5 = (float) (l & 255) / 255.0F;
|
||||
f4 = 1.0F;
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (DaggerEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.func_130087_a(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (DaggerEntity par1ArrowEntity, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
|
||||
}
|
||||
|
||||
private void renderDroppedItem (DaggerEntity dagger, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
|
||||
ResourceLocation resourcelocation = texturemanager.func_130087_a(dagger.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
|
||||
}
|
||||
|
||||
float f4 = ((Icon) par2Icon).getMinU();
|
||||
float f5 = ((Icon) par2Icon).getMaxU();
|
||||
float f6 = ((Icon) par2Icon).getMinV();
|
||||
float f7 = ((Icon) par2Icon).getMaxV();
|
||||
float f8 = 1.0F;
|
||||
float f9 = 0.5F;
|
||||
float f10 = 0.25F;
|
||||
float f11;
|
||||
float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par7;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glRotatef((((float) 0 + par4) / 20.0F + 0) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
float f12 = 0.0625F;
|
||||
f11 = 0.021875F;
|
||||
ItemStack itemstack = dagger.getEntityItem();
|
||||
int j = itemstack.stackSize;
|
||||
byte b0 = getMiniItemCount(itemstack);
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
|
||||
if (k > 0 && shouldSpreadItems())
|
||||
{
|
||||
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
GL11.glTranslatef(x, y, f12 + f11);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
}
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
this.func_110776_a(TextureMap.field_110575_b);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.func_110776_a(TextureMap.field_110576_c);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getOriginX(), ((Icon) par2Icon).getOriginY(), f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.func_110577_a(field_110798_h);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
float f13 = 0.76F;
|
||||
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
float f14 = 0.125F;
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
|
||||
GL11.glTranslatef(f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(f14, f14, f14);
|
||||
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
|
||||
GL11.glTranslatef(-f15, 0.0F, 0.0F);
|
||||
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's icon or block into the UI at the specified position.
|
||||
*/
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
|
||||
}
|
||||
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
|
||||
{
|
||||
int k = par3ItemStack.itemID;
|
||||
int l = par3ItemStack.getItemDamage();
|
||||
Object object = par3ItemStack.getIconIndex();
|
||||
float f;
|
||||
int i1;
|
||||
float f1;
|
||||
float f2;
|
||||
|
||||
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
|
||||
{
|
||||
par2TextureManager.func_110577_a(TextureMap.field_110575_b);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
|
||||
GL11.glScalef(10.0F, 10.0F, 10.0F);
|
||||
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
|
||||
GL11.glScalef(1.0F, 1.0F, -1.0F);
|
||||
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
|
||||
f = (float) (i1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = this.renderWithColor;
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (Item.itemsList[k].requiresMultipleRenderPasses())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
|
||||
{
|
||||
par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
|
||||
Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
|
||||
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
|
||||
f1 = (float) (k1 >> 16 & 255) / 255.0F;
|
||||
f2 = (float) (k1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (k1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f1, f2, f3, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, icon, 16, 16);
|
||||
|
||||
if (par3ItemStack.hasEffect(j1))
|
||||
{
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
ResourceLocation resourcelocation = par2TextureManager.func_130087_a(par3ItemStack.getItemSpriteNumber());
|
||||
par2TextureManager.func_110577_a(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(resourcelocation)).func_110572_b("missingno");
|
||||
}
|
||||
|
||||
i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
|
||||
f = (float) (i1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, (Icon) object, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
if (par3ItemStack.hasEffect(0))
|
||||
{
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
private void renderEffect (TextureManager manager, int x, int y)
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
manager.func_110577_a(field_110798_h);
|
||||
this.zLevel -= 50.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
|
||||
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
|
||||
this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
this.zLevel += 50.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the item's icon or block into the GUI, including the glint effect.
|
||||
*/
|
||||
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
|
||||
{
|
||||
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
|
||||
}
|
||||
|
||||
/* Modders must handle this themselves if they use custom renderers!
|
||||
if (par3ItemStack.hasEffect())
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
par2TextureManager.func_110577_a(field_110798_h);
|
||||
this.zLevel -= 50.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
|
||||
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
|
||||
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
this.zLevel += 50.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
{
|
||||
if (j1 == 0)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
|
||||
float f3 = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f4 = 4.0F;
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
f4 = -1.0F;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
|
||||
* specified position.
|
||||
*/
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
|
||||
}
|
||||
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (par3ItemStack.stackSize > 1 || par6Str != null)
|
||||
{
|
||||
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if (par3ItemStack.isItemDamaged())
|
||||
{
|
||||
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
|
||||
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int i1 = 255 - l << 16 | l << 8;
|
||||
int j1 = (255 - l) / 4 << 16 | 16128;
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
|
||||
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
|
||||
* tessellator, x, y, width, height, color
|
||||
*/
|
||||
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I(par6);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
|
||||
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderIcon (int par1, int par2, Icon par3Icon, int par4, int par5)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110775_a (Entity par1Entity)
|
||||
{
|
||||
return this.func_110796_a((DaggerEntity) par1Entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
|
||||
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
|
||||
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
|
||||
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.doRenderItem((DaggerEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte getMiniBlockCount (ItemStack stack)
|
||||
{
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 5)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 20)
|
||||
ret = 4;
|
||||
if (stack.stackSize > 40)
|
||||
ret = 5;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for a subclass to override how many rendered items appear in a
|
||||
* "mini item 3d stack"
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public byte getMiniItemCount (ItemStack stack)
|
||||
{
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 15)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 31)
|
||||
ret = 4;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package tconstruct.client.entity.projectile;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.entity.projectile.DaggerEntity;
|
||||
|
||||
public class DaggerRenderOld extends RangedRenderBase
|
||||
{
|
||||
public DaggerRenderOld(double d)
|
||||
{
|
||||
System.out.println("new renderer");
|
||||
shadowSize = 0.15F;
|
||||
shadowOpaque = 0.75F;
|
||||
daggerRotation = (float) d;
|
||||
}
|
||||
|
||||
public void doRender (DaggerEntity dagger, double d, double d1, double d2, float f, float f1)
|
||||
{
|
||||
if ((new Random()).nextFloat() > 0.8)
|
||||
System.out.println("rendering dagger " + dagger.texID + " " + dagger.tex2ID);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d, (float) d1, (float) d2);
|
||||
GL11.glRotatef(f, 0.0F, 1.0F, 0.0F);
|
||||
float f2 = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * f1;
|
||||
GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F);
|
||||
if (!dagger.onGround)
|
||||
{
|
||||
float f3 = dagger.prevBoomerangRotation + (dagger.boomerangRotation - dagger.prevBoomerangRotation) * f1 * 1.1F;
|
||||
GL11.glRotatef(f3, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
|
||||
//loadTexture("/infi2x2/daggers.png");
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int i = 0;//dagger.getTexID();
|
||||
float f4 = ((float) ((i % 16) * 16) + 0.0F) / 256F;
|
||||
float f5 = ((float) ((i % 16) * 16) + 15.99F) / 256F;
|
||||
float f6 = ((float) ((i / 16) * 16) + 0.0F) / 256F;
|
||||
float f7 = ((float) ((i / 16) * 16) + 15.99F) / 256F;
|
||||
float f8 = 1.0F;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
float f9 = 0.0625F;
|
||||
GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
|
||||
renderItem(tessellator, f4, f5, f6, f7, f8, f9);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender (Entity entity, double d, double d1, double d2, float f, float f1)
|
||||
{
|
||||
doRender((DaggerEntity) entity, d, d1, d2, f, f1);
|
||||
}
|
||||
|
||||
public float daggerRotation;
|
||||
|
||||
@Override
|
||||
protected ResourceLocation func_110775_a (Entity entity)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package tconstruct.client.entity.projectile;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
import net.minecraft.potion.PotionHelper;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.entity.projectile.LaunchedPotion;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class LaunchedItemRender extends Render
|
||||
{
|
||||
private Item field_94151_a;
|
||||
private int field_94150_f;
|
||||
|
||||
public LaunchedItemRender(Item par1Item, int par2)
|
||||
{
|
||||
this.field_94151_a = par1Item;
|
||||
this.field_94150_f = par2;
|
||||
}
|
||||
|
||||
public LaunchedItemRender(Item par1Item)
|
||||
{
|
||||
this(par1Item, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
|
||||
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
|
||||
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
|
||||
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
|
||||
|
||||
if (icon != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
this.func_110777_b(par1Entity);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (icon == ItemPotion.func_94589_d("bottle_splash"))
|
||||
{
|
||||
int i = PotionHelper.func_77915_a(((LaunchedPotion)par1Entity).getPotionDamage(), false);
|
||||
float f2 = (float)(i >> 16 & 255) / 255.0F;
|
||||
float f3 = (float)(i >> 8 & 255) / 255.0F;
|
||||
float f4 = (float)(i & 255) / 255.0F;
|
||||
GL11.glColor3f(f2, f3, f4);
|
||||
GL11.glPushMatrix();
|
||||
this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
this.func_77026_a(tessellator, icon);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110775_a(Entity par1Entity)
|
||||
{
|
||||
return TextureMap.field_110576_c;
|
||||
}
|
||||
|
||||
private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon)
|
||||
{
|
||||
float f = par2Icon.getMinU();
|
||||
float f1 = par2Icon.getMaxU();
|
||||
float f2 = par2Icon.getMinV();
|
||||
float f3 = par2Icon.getMaxV();
|
||||
float f4 = 1.0F;
|
||||
float f5 = 0.5F;
|
||||
float f6 = 0.25F;
|
||||
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
|
||||
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
|
||||
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
|
||||
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package tconstruct.client.entity.projectile;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public abstract class RangedRenderBase extends Render
|
||||
{
|
||||
public RangedRenderBase()
|
||||
{
|
||||
}
|
||||
|
||||
public void doRender (Entity entity, double d, double d1, double d2, float f, float f1)
|
||||
{
|
||||
}
|
||||
|
||||
public void renderItem (Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D - (double) f5, 0.0D, f1, f3);
|
||||
tessellator.addVertexWithUV(f4, 0.0D - (double) f5, 0.0D, f, f3);
|
||||
tessellator.addVertexWithUV(f4, 0.0D - (double) f5, 1.0D, f, f2);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D - (double) f5, 1.0D, f1, f2);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, 1.0D, f1, f2);
|
||||
tessellator.addVertexWithUV(f4, 0.0D, 1.0D, f, f2);
|
||||
tessellator.addVertexWithUV(f4, 0.0D, 0.0D, f, f3);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, f1, f3);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
float f6 = (float) i / 16F;
|
||||
float f10 = (f1 + (f - f1) * f6) - 0.001953125F;
|
||||
float f14 = f4 * f6 + 0.0625F;
|
||||
tessellator.addVertexWithUV(f14, 0.0F - f5, 0.0D, f10, f3);
|
||||
tessellator.addVertexWithUV(f14, 0.0D, 0.0D, f10, f3);
|
||||
tessellator.addVertexWithUV(f14, 0.0D, 1.0D, f10, f2);
|
||||
tessellator.addVertexWithUV(f14, 0.0F - f5, 1.0D, f10, f2);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
float f7 = (float) j / 16F;
|
||||
float f11 = (f1 + (f - f1) * f7) - 0.001953125F;
|
||||
float f15 = f4 * f7;
|
||||
tessellator.addVertexWithUV(f15, 0.0F - f5, 1.0D, f11, f2);
|
||||
tessellator.addVertexWithUV(f15, 0.0D, 1.0D, f11, f2);
|
||||
tessellator.addVertexWithUV(f15, 0.0D, 0.0D, f11, f3);
|
||||
tessellator.addVertexWithUV(f15, 0.0F - f5, 0.0D, f11, f3);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
float f8 = (float) k / 16F;
|
||||
float f12 = (f3 + (f2 - f3) * f8) - 0.001953125F;
|
||||
float f16 = f4 * f8;
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, f16, f1, f12);
|
||||
tessellator.addVertexWithUV(f4, 0.0D, f16, f, f12);
|
||||
tessellator.addVertexWithUV(f4, 0.0F - f5, f16, f, f12);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0F - f5, f16, f1, f12);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
for (int l = 0; l < 16; l++)
|
||||
{
|
||||
float f9 = (float) l / 16F;
|
||||
float f13 = (f3 + (f2 - f3) * f9) - 0.001953125F;
|
||||
float f17 = f4 * f9 + 0.0625F;
|
||||
tessellator.addVertexWithUV(f4, 0.0D, f17, f, f13);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, f17, f1, f13);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0F - f5, f17, f1, f13);
|
||||
tessellator.addVertexWithUV(f4, 0.0F - f5, f17, f, f13);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user