Jump to content

[1.7.10] Projectile Particle Issues


Recommended Posts

So far, I have three projectiles that have a particle trail in a mod of mine.  The problem is that one of them should be trailing magicCrit particles instead of fireworksSpark particles like the other two.  I tried extending it from EntityThrowable instead of one of my other projectiles, but to no avail.  Changing the other parameters seems to work just fine, and the worst part is that the custom rendering code doesn't even get called, it seems. 

 

DreemurrWeps.java:

 

package com.random.dreemurrweps;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

@Mod(modid = "dw", name = "Dreemurr Weapons", version = "1.0")
public class DreemurrWeps {

@SidedProxy(clientSide = "com.random.dreemurrweps.ClientProxy", serverSide = "com.random.dreemurrweps.ServerProxy")
public static CommonProxy proxy;

public static Item itemStarBlazing;
public static Item itemGalactaBlazing;

@EventHandler
public void preInit(FMLPreInitializationEvent event){
	//Items, blocks, and config
	itemStarBlazing = new ItemStarBlazing().setUnlocalizedName("ItemStarBlazing").setTextureName("dw:itemStarBlazing").setCreativeTab(CreativeTabs.tabCombat);
	GameRegistry.registerItem(itemStarBlazing, itemStarBlazing.getUnlocalizedName().substring(5));
	itemGalactaBlazing = new ItemGalactaBlazing().setUnlocalizedName("ItemGalactaBlazing").setTextureName("dw:itemGalactaBlazing").setCreativeTab(CreativeTabs.tabCombat);
	GameRegistry.registerItem(itemGalactaBlazing, itemGalactaBlazing.getUnlocalizedName().substring(5));
}

@EventHandler
public void init(FMLInitializationEvent event){
	//Proxy, tile entities, entities, GUI, and packets
	proxy.RegisterRenderers();
	proxy.RegisterEntities();
	EntityRegistry.registerModEntity(EntityStarBlazing.class, "Star Blazing", EntityRegistry.findGlobalUniqueEntityId(), this, 80, 1, true);
	EntityRegistry.registerModEntity(EntityGalactaBlazing.class, "Galacta Blazing", EntityRegistry.findGlobalUniqueEntityId(), this, 80, 1, true);
	//EntityRegistry.registerModEntity(EntityStarBlazing.class, "Star Blazing", dw.instance, 64, 20, true); 

	GameRegistry.addRecipe(new ItemStack(itemStarBlazing), new Object[]{"IDI",
																   " I ",
																   " I ", 'I', Items.iron_ingot, 'D', new ItemStack(Items.dye, 1, 1)});
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {


}
}

 

 

ItemStarBlazing.java:

 

package com.random.dreemurrweps;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;

public class ItemStarBlazing extends Item {

static float damage = 0.0F;
boolean charging = false;

public void onUpdate()
{
	if (charging == true) {
		if (damage < 10.0F)
		{
			damage = damage + 1.0F;
		}
	}	
}


public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){
	 player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
	 world.playSoundAtEntity(player, "dw:charge", 0.5F, 1F);
	 //damage = 0.0F;
	 charging = true;
	 return itemStack;
}

public int getMaxItemUseDuration(ItemStack itemStack)
    {
        return 3600;
    }

public EnumAction getItemUseAction(ItemStack itemStack)
    {
        return EnumAction.bow;
    }

 public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer player)
    {
        return itemStack;
    }

public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int itemInUseCount){

	//int j = this.getMaxItemUseDuration(itemStack) - itemInUseCount;

        //ArrowLooseEvent event = new ArrowLooseEvent(player, itemStack, j);
        //MinecraftForge.EVENT_BUS.post(event);
        //if (event.isCanceled())
        //{
        //   return;
        //}
        //j = event.charge;

	if (!player.capabilities.isCreativeMode)
	{
		--itemStack.stackSize;
	}

	if (!world.isRemote)
	{
		world.playSoundAtEntity(player, "dw:starsmall", 0.5F, 1F);
		world.spawnEntityInWorld(new EntityStarBlazing(world, player));
	}

	charging = false;


}

}

 

 

ItemGalactaBlazing.java:

 

package com.random.dreemurrweps;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class ItemGalactaBlazing extends ItemStarBlazing {

static float damage = 0.0F;
boolean charging = false;

public boolean hasEffect(ItemStack itemStack)
    {
        return true;
    }

public void onUpdate()
{
	if (charging == true) {
		if (damage < 10.0F)
		{
			damage = damage + 1.0F;
		}
	}	
}


public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){
	 player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
	 world.playSoundAtEntity(player, "dw:charge", 0.5F, 0.5F);
	 //damage = 0.0F;
	 charging = true;
	 return itemStack;
}

public int getMaxItemUseDuration(ItemStack itemStack)
    {
        return 7200;
    }

public EnumAction getItemUseAction(ItemStack itemStack)
    {
        return EnumAction.bow;
    }

 public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer player)
    {
        return itemStack;
    }

public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int itemInUseCount){

	//int j = this.getMaxItemUseDuration(itemStack) - itemInUseCount;

        //ArrowLooseEvent event = new ArrowLooseEvent(player, itemStack, j);
        //MinecraftForge.EVENT_BUS.post(event);
        //if (event.isCanceled())
        //{
        //   return;
        //}
        //j = event.charge;

	if (!player.capabilities.isCreativeMode)
	{
		--itemStack.stackSize;
	}

	if (!world.isRemote)
	{
		world.playSoundAtEntity(player, "dw:starlarge", 0.5F, 0.5F);
		world.spawnEntityInWorld(new EntityGalactaBlazing(world, player));
	}

	charging = false;


}

}

 

 

EntityStarBlazing.java:

 

package com.random.dreemurrweps;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class EntityStarBlazing extends EntityThrowable{

int timer = 0;

public EntityStarBlazing(World world)
{
	super(world);
}

public EntityStarBlazing(World world, EntityLivingBase entity)
    {
        super(world, entity);
    }

public EntityStarBlazing(World world, double x, double y, double z)
    {
        super(world, x, y, z);
    }

@SideOnly(Side.CLIENT)
public void randomDisplayTick()
{
	this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D);
}

@Override

public void onUpdate()
{
	++timer;
	super.onUpdate();
	if (timer % 2 == 0) {
		this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
	}

	if (this.timer == 600) {
        	this.setDead();
        }
}

protected float getGravityVelocity()
    {
        return 0.00F;
    }

protected void onImpact(MovingObjectPosition movingObjectPosition) {
	if (!(movingObjectPosition.entityHit == null))
	{
		movingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 10.0F);
		this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.5F, false);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX + 1.0F, this.posY, this.posZ, 0.0D, 0.0D, 0.5D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.25D, 0.0D, 0.25D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, -0.25D, 0.0D, 0.25D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.25D, -0.0D, -0.25D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, -0.25D, -0.0D, -0.25D);
	}
	this.playSound("dw:smallexplosion", 1.0F, 1.0F);
	this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.5D);
	this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.25D, 0.0D, 0.25D);
	this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, -0.25D, 0.0D, 0.25D);
	this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.25D, -0.0D, -0.25D);
	this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, -0.25D, -0.0D, -0.25D);
	this.setDead();
}

}

 

 

EntityGalactaBlazing.java:

 

package com.random.dreemurrweps;

import java.util.List;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;

public class EntityGalactaBlazing extends EntityThrowable {

int timer = 0;
private int field_145788_c = -1;
private int field_145786_d = -1;
private int field_145787_e = -1;
private Block field_145785_f;
protected boolean inGround;
public int throwableShake;
/** The entity that threw this throwable item. */
private EntityLivingBase thrower;
private String throwerName;
private int ticksInGround;
private int ticksInAir;
private static final String __OBFID = "CL_00001723";

public EntityGalactaBlazing(World world)
{
	super(world);
}

public EntityGalactaBlazing(World p_i1777_1_, EntityLivingBase p_i1777_2_)
    {
        super(p_i1777_1_);
        this.thrower = p_i1777_2_;
        this.setSize(0.25F, 0.25F);
        this.setLocationAndAngles(p_i1777_2_.posX, p_i1777_2_.posY + (double)p_i1777_2_.getEyeHeight(), p_i1777_2_.posZ, p_i1777_2_.rotationYaw, p_i1777_2_.rotationPitch);
        this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
        this.posY -= 0.10000000149011612D;
        this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
        this.setPosition(this.posX, this.posY, this.posZ);
        this.yOffset = 0.0F;
        float f = 0.4F;
        this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
        this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
        this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.func_70183_g()) / 180.0F * (float)Math.PI) * f);
        this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.func_70182_d(), 1.0F);
    }

public EntityGalactaBlazing(World world, double x, double y, double z)
    {
        super(world, x, y, z);
    }

@Override

public void onUpdate()
{
	++timer;
	super.onUpdate();
	if (timer % 2 == 0) {
		this.worldObj.spawnParticle("magicCrit", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
	}
	        this.lastTickPosX = this.posX;
	        this.lastTickPosY = this.posY;
	        this.lastTickPosZ = this.posZ; 

	        if (this.throwableShake > 0)
	        {
	            --this.throwableShake;
	        }

	        if (this.inGround)
	        {
	            if (this.worldObj.getBlock(this.field_145788_c, this.field_145786_d, this.field_145787_e) == this.field_145785_f)
	            {
	                ++this.ticksInGround;

	                if (this.ticksInGround == 1200)
	                {
	                    this.setDead();
	                }

	                return;
	            }

	            this.inGround = false;
	            this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
	            this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
	            this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
	            this.ticksInGround = 0;
	            this.ticksInAir = 0;
	        }
	        else
	        {
	            ++this.ticksInAir;
	        }
	        
	        if (this.ticksInAir == 600) {
	        	this.setDead();
	        }

	        Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
	        Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
	        MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);
	        vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
	        vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

	        if (movingobjectposition != null)
	        {
	            vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
	        }

	        if (!this.worldObj.isRemote)
	        {
	            Entity entity = null;
	            List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
	            double d0 = 0.0D;
	            EntityLivingBase entitylivingbase = this.getThrower();

	            for (int j = 0; j < list.size(); ++j)
	            {
	                Entity entity1 = (Entity)list.get(j);

	                if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || this.ticksInAir >= 5))
	                {
	                    float f = 0.3F;
	                    AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f);
	                    MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);

	                    if (movingobjectposition1 != null)
	                    {
	                        double d1 = vec3.distanceTo(movingobjectposition1.hitVec);

	                        if (d1 < d0 || d0 == 0.0D)
	                        {
	                            entity = entity1;
	                            d0 = d1;
	                        }
	                    }
	                }
	            }

	            if (entity != null)
	            {
	                movingobjectposition = new MovingObjectPosition(entity);
	            }
	        }

	        if (movingobjectposition != null)
	        {
	            if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal)
	            {
	                this.setInPortal();
	            }
	            else
	            {
	                this.onImpact(movingobjectposition);
	            }
	        }

	        this.posX += this.motionX/25;
	        this.posY += this.motionY/25;
	        this.posZ += this.motionZ/25;
	        float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
	        this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

	        for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
	        {
	            ;
	        }

	        while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
	        {
	            this.prevRotationPitch += 360.0F;
	        }

	        while (this.rotationYaw - this.prevRotationYaw < -180.0F)
	        {
	            this.prevRotationYaw -= 360.0F;
	        }

	        while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
	        {
	            this.prevRotationYaw += 360.0F;
	        }

	        this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
	        this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
	        float f2 = 0.99F;
	        float f3 = this.getGravityVelocity();

	        if (this.isInWater())
	        {
	            for (int i = 0; i < 4; ++i)
	            {
	                float f4 = 0.25F;
	                this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ);
	            }

	            f2 = 0.8F;
	        }

	        this.motionX *= (double)f2;
	        this.motionY *= (double)f2;
	        this.motionZ *= (double)f2;
	        this.motionY -= (double)f3;
	        this.setPosition(this.posX, this.posY, this.posZ);
	    }


protected float getGravityVelocity()
    {
        return 0.01F;
    }

protected void onImpact(MovingObjectPosition movingObjectPosition) {
	EntityMiniStar miniStar1 = new EntityMiniStar(this.worldObj, this.posX, this.posY, this.posZ);
	EntityMiniStar miniStar2 = new EntityMiniStar(this.worldObj, this.posX, this.posY, this.posZ);
	EntityMiniStar miniStar3 = new EntityMiniStar(this.worldObj, this.posX, this.posY, this.posZ);
	EntityMiniStar miniStar4 = new EntityMiniStar(this.worldObj, this.posX, this.posY, this.posZ);
	EntityMiniStar miniStar5 = new EntityMiniStar(this.worldObj, this.posX, this.posY, this.posZ);
	if (!(movingObjectPosition.entityHit == null) && (!(movingObjectPosition.entityHit == this.thrower)))
	{
		movingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 10.0F);
		this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.5F, false);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX + 1.0F, this.posY, this.posZ, 0.0D, 0.0D, 0.5D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.25D, 0.0D, 0.25D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, -0.25D, 0.0D, 0.25D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, 0.25D, -0.0D, -0.25D);
		movingObjectPosition.entityHit.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY, this.posZ, -0.25D, -0.0D, -0.25D);
	}
	if (!(movingObjectPosition.entityHit == this.thrower)) {
		this.playSound("dw:largeexplosion", 1.0F, 1.0F);
		if (!(this.worldObj.isRemote)) {
			this.worldObj.spawnEntityInWorld(miniStar1);
			this.worldObj.spawnEntityInWorld(miniStar2);
			this.worldObj.spawnEntityInWorld(miniStar3);
			this.worldObj.spawnEntityInWorld(miniStar4);
			this.worldObj.spawnEntityInWorld(miniStar5);
			miniStar1.motionX = 0.125D;
			miniStar2.motionX = 0.125D;
			miniStar2.motionZ = 0.125D;
			miniStar3.motionX = 0.125D;
			miniStar3.motionZ = -0.125D;
			miniStar4.motionX = -0.125D;
			miniStar4.motionZ = -0.125D;
			miniStar5.motionX = 0.125D;
			miniStar5.motionZ = -0.125D;
			this.setDead();
		}
	}
}

}

 

 

EntityMiniStar.java:

 

package com.random.dreemurrweps;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class EntityMiniStar extends EntityStarBlazing{

Entity thrower = this.getThrower();

public EntityMiniStar(World world, double x, double y, double z) {
	super(world, x, y, z);
}

@Override
protected void onImpact(MovingObjectPosition movingObjectPosition) {
	if (!(movingObjectPosition.entityHit == null))
	{
		if (!(movingObjectPosition.entityHit == thrower))
		{
			movingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 5.0F);
		}
	}
}

}

 

 

 

ClientProxy.java:

 

package com.random.dreemurrweps;

import com.sun.javafx.font.directwrite.DWFactory;

import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.init.Items;
import net.minecraft.item.Item;

public class ClientProxy extends CommonProxy{

Item star = (Item)DreemurrWeps.itemStarBlazing;

@Override
public void RegisterRenderers()
{
	RenderingRegistry.registerEntityRenderingHandler(EntityStarBlazing.class, new RenderSnowball((Item)DreemurrWeps.itemStarBlazing));
	RenderingRegistry.registerEntityRenderingHandler(EntityGalactaBlazing.class, new RenderGalactaBlazing((Item)DreemurrWeps.itemGalactaBlazing));
}

public void RegisterEntities()
{

}

}

 

 

CommonProxy.java:

 

package com.random.dreemurrweps;

public class CommonProxy {

public void RegisterRenderers()
{

}

public void RegisterEntities()
{

}
}

 

 

RenderGalactaBlazing.java:

 

package com.random.dreemurrweps;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.entity.projectile.EntityPotion;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPotion;
import net.minecraft.potion.PotionHelper;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

@SideOnly(Side.CLIENT)
public class RenderGalactaBlazing extends Render
{
    private Item field_94151_a;
    private int field_94150_f;
    private static final String __OBFID = "CL_00001008";

    public RenderGalactaBlazing(Item p_i1259_1_, int p_i1259_2_)
    {
        this.field_94151_a = p_i1259_1_;
        this.field_94150_f = p_i1259_2_;
    }

    public RenderGalactaBlazing(Item p_i1260_1_)
    {
        this(p_i1260_1_, 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 func_76986_a(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 p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
        IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

        if (iicon != null)
        {
        	GL11.glPushMatrix();
            this.bindEntityTexture(p_76986_1_);
            GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            float f2 = 10.0F;
            GL11.glScalef(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
            Tessellator tessellator = Tessellator.instance;
            float f3 = iicon.getMinU();
            float f4 = iicon.getMaxU();
            float f5 = iicon.getMinV();
            float f6 = iicon.getMaxV();
            float f7 = 1.0F;
            float f8 = 0.5F;
            float f9 = 0.125F;
            GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
            tessellator.startDrawingQuads();
            tessellator.setNormal(0.0F, 0.25F, 0.0F);
            tessellator.addVertexWithUV((double)(0.0F - f8), (double)(0.0F - f9), 0.0D, (double)f3, (double)f6);
            tessellator.addVertexWithUV((double)(f7 - f8), (double)(0.0F - f9), 0.0D, (double)f4, (double)f6);
            tessellator.addVertexWithUV((double)(f7 - f8), (double)(2.0F - f9), 0.0D, (double)f4, (double)f5);
            tessellator.addVertexWithUV((double)(0.0F - f8), (double)(2.0F - f9), 0.0D, (double)f3, (double)f5);
            tessellator.draw();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            GL11.glPopMatrix();
        }
    }

    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(Entity p_110775_1_)
    {
        return TextureMap.locationItemsTexture;
    }

    private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_)
    {
        float f = p_77026_2_.getMinU();
        float f1 = p_77026_2_.getMaxU();
        float f2 = p_77026_2_.getMinV();
        float f3 = p_77026_2_.getMaxV();
        float f4 = 2.0F;
        float f5 = 1.0F;
        float f6 = 0.5F;
        GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        p_77026_1_.startDrawingQuads();
        p_77026_1_.setNormal(0.0F, 2.0F, 0.0F);
        p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
        p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
        p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
        p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
        p_77026_1_.draw();
    }
}

 

 

 

 

[move]Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here[/move]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.