Jump to content

Bosses that are refusing to render


Thor597

Recommended Posts

So I've made these bosses that worked just fine for 1.2.5 but when I updated to 1.3.2 all my other mobs worked. But the bosses didnt, they are invisible and I cant interact with them. However I can hear their sounds and the boss I have that leaves a trail of snow behind it actually does even though it is like this. So I know they actually are there.

 

Code in @Init


EntityRegistry.registerGlobalEntityID(AC_EntityFrozenZombie.class, "FrozenZombie", EntityRegistry.findGlobalUniqueEntityId(), zombieBackGround, zombieSpots);
LanguageRegistry.instance().addStringLocalization("entity.FrozenZombie.name", "en_US", "Frozen Zombie");

 

Code in ClientProxy


RenderingRegistry.registerEntityRenderingHandler(AC_EntityZombieBoss.class, new AC_RenderZombieBoss(new AC_ModelZombieBoss(), 1.5F));

 

Render file


package arcticraft.renderers; import net.minecraft.src.*;

import org.lwjgl.opengl.GL11;

import arcticraft.entities.AC_EntityZombieBoss;

public class AC_RenderZombieBoss extends RenderBiped {

public static AC_EntityZombieBoss ZombieBoss;

public AC_RenderZombieBoss(ModelBiped par1ModelBiped, float par2)
{
	super(par1ModelBiped, par2);
}

public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
	this.renderZombieBoss((AC_EntityZombieBoss)par1Entity, par2, par4, par6, par8, par9);
	super.doRender(par1Entity, par2, par4, par6, par8, par9);
}

public void renderZombieBoss(AC_EntityZombieBoss par1EntityZombieBoss, double par2, double par4, double par6, float par8, float par9)
{
	ZombieBoss =  par1EntityZombieBoss;
}

/**
 * Applies the scale to the transform matrix
 */
protected void preRenderScale(AC_EntityZombieBoss par1EntityLiving, float par2)
{
	GL11.glScalef(1.5F, 1.5F, 1.5F);
}

/**
 * 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.preRenderScale((AC_EntityZombieBoss)par1EntityLiving, par2);
}
}

 

Model file


package arcticraft.models; 

import arcticraft.entities.AC_EntityZombieBoss;
import arcticraft.renderers.AC_RenderZombieBoss;
import net.minecraft.src.*;

public class AC_ModelZombieBoss extends ModelBiped
{
    /**
     * Sets the models various rotation angles.
     */
    public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
    {
        super.setRotationAngles(par1, par2, par3, par4, par5, par6);
        float var7 = MathHelper.sin(this.onGround * (float)Math.PI);
        float var8 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float)Math.PI);
        this.bipedRightArm.rotateAngleZ = 0.0F;
        this.bipedLeftArm.rotateAngleZ = 0.0F;
        this.bipedRightArm.rotateAngleY = -(0.1F - var7 * 0.6F);
        this.bipedLeftArm.rotateAngleY = 0.1F - var7 * 0.6F;
        this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F);
        this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F);
        this.bipedRightArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F;
        this.bipedLeftArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F;
        this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
        this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
        this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
        this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;
        
        AC_EntityZombieBoss var1 = AC_RenderZombieBoss.ZombieBoss;
        
        if(var1.isSneaking())
        {
            this.bipedRightArm.rotateAngleZ = 0.0F;
            this.bipedLeftArm.rotateAngleZ = 0.0F;
            this.bipedRightArm.rotateAngleY = -(0.1F - var7 * 0.6F);
            this.bipedLeftArm.rotateAngleY = 0.1F - var7 * 0.6F;
            this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F);
            this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F);
            this.bipedRightArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F;
            this.bipedLeftArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F;
            this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
            this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
            this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
            this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;
            this.bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
            this.bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
            this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F);
            this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F);
        }
    }
}

 

Entity file(CAUTION theres a lot of shit in here)


package arcticraft.entities; import arcticraft.Arcticraft;
import net.minecraft.src.*;

import net.minecraft.client.Minecraft;

public class AC_EntityZombieBoss extends AC_EntityLivingArcticStuff implements AC_IArcticBoss
{
Minecraft mc = ModLoader.getMinecraftInstance();
public int deathTicks = 0;
public String bossName;
private int ticks;
public Entity target;
public boolean gotTarget;
public int orgX;
public int orgY;
public int orgZ;
public int specialAtckTicks = 0;
protected int attackStrength = 2;

public AC_EntityZombieBoss(World par1World)
{
	super(par1World);
	this.setSize(this.width * 1.0F, this.height * 1.5F);
	this.texture = "/arcticraft/textures/mobs/frozen-king.png";
	this.moveSpeed = 0.35F;
	this.attackStrength = 30;
	this.tasks.addTask(0, new EntityAISwimming(this));
	this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
	this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	this.tasks.addTask(7, new EntityAILookIdle(this));
	this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
	this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true));
	this.bossName = AC_NameGenFrostZombie.gen();
	orgX = MathHelper.floor_double(posX);
	orgY = MathHelper.floor_double(boundingBox.minY) + 1;
	orgZ = MathHelper.floor_double(posZ);
}

public AC_EntityZombieBoss(World world, int i, int j, int k, int l, int i1)
{
	super(world);
	this.setSize(this.width * 1.0F, this.height * 1.5F);
	this.texture = "/arcticraft/textures/mobs/frozen-king.png";
	this.moveSpeed = 0.35F;
	this.attackStrength = 30;
	this.tasks.addTask(0, new EntityAISwimming(this));
	this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
	this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	this.tasks.addTask(7, new EntityAILookIdle(this));
	this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
	this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true));
	this.bossName = AC_NameGenFrostZombie.gen();
	orgX = i;
	orgY = j;
	orgZ = k;
}

/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
	super.writeEntityToNBT(par1NBTTagCompound);
	par1NBTTagCompound.setString("BossName", bossName);
	par1NBTTagCompound.setShort("OriginX", (short)orgX);
	par1NBTTagCompound.setShort("OriginY", (short)orgY);
	par1NBTTagCompound.setShort("OriginZ", (short)orgZ);
	gotTarget = target != null;
	par1NBTTagCompound.setBoolean("GotTarget", gotTarget);
	par1NBTTagCompound.setBoolean("IsCurrentBoss", isCurrentBoss());
}

/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
	super.readEntityFromNBT(par1NBTTagCompound);
	orgX = par1NBTTagCompound.getShort("OriginX");
	orgY = par1NBTTagCompound.getShort("OriginY");
	orgZ = par1NBTTagCompound.getShort("OriginZ");
	gotTarget = par1NBTTagCompound.getBoolean("GotTarget");
	bossName = par1NBTTagCompound.getString("BossName");

	if (par1NBTTagCompound.getBoolean("IsCurrentBoss"))
	{
		Arcticraft.currentBoss = this;
	}
}

protected Entity findPlayerToAttack()
{
	EntityPlayer entityplayer = worldObj.getClosestPlayerToEntity(this, 32D);

	if (entityplayer != null && canEntityBeSeen(entityplayer))
	{
		return entityplayer;
	}
	else
	{
		return null;
	}
}

public boolean attackEntityAsMob(Entity par1Entity)
{
	int var2 = this.attackStrength;
	return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), var2);
}

public void updateEntityActionState()
{
	/*if(Arcticraft.currentBoss == this)
    	{
    		soundMgr.stopPlaying("Betweenlands.BossBattleLoop");
    		
		soundMgr.playSound("Betweenlands.BossBattleAmbience", 0, 10, 0, 10F, 1F, 0);
    	}
    	*/

	if (gotTarget && target == null)
	{
		target = findPlayerToAttack();
		gotTarget = false;
	}

	if (target == null)
	{
		setPosition((double)orgX + 0.5D, orgY, (double)orgZ + 0.5D);
		return;
	}
	setPosition(posX, orgY, posZ);

	if (target != null && target.isDead)
	{
		setPosition((double)orgX + 0.5D, orgY, (double)orgZ + 0.5D);
		motionX = 0.0D;
		motionY = 0.0D;
		motionZ = 0.0D;
		target = null;
		Arcticraft.currentBoss = null;
		gotTarget = false;
	}
}

public void onUpdate()
{
	super.onUpdate();

	if(this.getBossHP() >= 40 && this.getBossHP() <= 64 && this.rand.nextInt(5) == 0)
	{
		++this.health;
		this.spawnParticlesAroundMob("heart");
	}

	if(Arcticraft.currentBoss == null && this.getBossHP() > 0)
	{
		this.setSneaking(true);
	}

	else if(Arcticraft.currentBoss != null && Arcticraft.currentBoss == this)
	{
		this.setSneaking(false);
	}
}

/**
 * handles entity death timer, experience orb and particle creation
 */
protected void onDeathUpdate()
{
	++this.deathTicks;  
	Arcticraft.currentBoss = null;

	if(this.rand.nextInt(7) == 0)
	{
		this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "mob.zombiehurt", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
	}

	if (this.deathTicks >= 180 && this.deathTicks <= 200)
	{
		float var1 = (this.rand.nextFloat() - 0.5F) * 8.0F;
		float var2 = (this.rand.nextFloat() - 0.5F) * 4.0F;
		float var3 = (this.rand.nextFloat() - 0.5F) * 8.0F;
		AC_EntityHugeSnowFX entityblueshine = new AC_EntityHugeSnowFX(worldObj, this.posX + (double)var1, this.posY + 2.0D + (double)var2, this.posZ + (double)var3, 0.0D, 0.0D, 0.0D);
		ModLoader.getMinecraftInstance().effectRenderer.addEffect(entityblueshine);
	}

	this.renderYawOffset = this.rotationYawHead += 100.0F;		

	int var4;
	int var5;

	if (this.deathTicks >= 10)
	{
		this.moveEntity(0.0D, 0.5555D, 0.0D);
	}

	if (!this.worldObj.isRemote && this.deathTicks > 150 && this.deathTicks % 5 == 0)
	{
		var4 = 1500;

		while (var4 > 0)
		{
			var5 = EntityXPOrb.getXPSplit(var4);
			var4 -= var5;
			this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var5));
		}
	}

	if(this.deathTicks == 20)
	{
		ModLoader.getMinecraftInstance().thePlayer.addChatMessage("\247aB-b-braains?");
	}

	if (this.deathTicks == 200)
	{
		var4 = 15000;

		while (var4 > 0)
		{
			var5 = EntityXPOrb.getXPSplit(var4);
			var4 -= var5;
			this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var5));
		}

		EntityItem var13 = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Arcticraft.crown));
		var13.setPosition(this.posX, this.height * 2F, this.posZ);
		this.worldObj.spawnEntityInWorld(var13);

		this.setDead();
	}
}

public int getMaxHealth()
{
	return 220;
}

public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
	Arcticraft.currentBoss = this;
	return super.attackEntityFrom(par1DamageSource, par2);
}

/**
 * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
 */
public int getTotalArmorValue()
{
	return 2;
}

/**
 * Returns true if the newer Entity AI code should be run
 */
protected boolean isAIEnabled()
{
	return true;
}

/**
 * Returns the sound this mob makes while it's alive.
 */
protected String getLivingSound()
{
	return "mob.zombie";
}

/**
 * Returns the sound this mob makes when it is hurt.
 */
protected String getHurtSound()
{
	return "mob.zombiehurt";
}

/**
 * Returns the sound this mob makes on death.
 */
protected String getDeathSound()
{
	return "mob.zombiedeath";
}

public String getBossTitle()
{
	return (new StringBuilder()).append(bossName).append(", the Frost Zombie King").toString();
}

public int getBossHP()
{
	return health;
}

public int getBossMaxHP()
{
	return 220;
}

public boolean isCurrentBoss()
{
	if (Arcticraft.currentBoss == null)
	{
		return false;
	}
	else
	{
		return equals(Arcticraft.currentBoss);
	}
}

public int getBossEntityID()
{
	return entityId;
}

public Entity GetEntity()
{
	return this;
}
}

 

 

So as I have been having this problem for a while and I am very frustrated as to wtf it is, I would really appreciate some help. :)

Link to comment
Share on other sites

This is the current code in the @Init

 


EntityRegistry.registerGlobalEntityID(AC_EntityFrozenZombie.class, "FrozenZombie", EntityRegistry.findGlobalUniqueEntityId(), zombieBackGround, zombieSpots);
EntityRegistry.registerModEntity(AC_EntityFrozenZombie.class, "FrozenZombie", EntityRegistry.findGlobalUniqueEntityId(), this, 64, 10, true);
LanguageRegistry.instance().addStringLocalization("entity.FrozenZombie.name", "en_US", "Frozen Zombie");

 

but no, still the same problem

Link to comment
Share on other sites

This is the current code in the @Init

 

 

 

but no, still the same problem

 

Try this:

int EntityID = EntityRegistry.findGlobalUniqueEntityId();
EntityRegistry.registerModEntity(AC_EntityFrozenZombie.class, "FrozenZombie", EntityID, this, 64, 10, true);
EntityRegistry.registerGlobalEntityID(AC_EntityFrozenZombie.class, "FrozenZombie",EntityID , zombieBackGround, zombieSpots);
LanguageRegistry.instance().addStringLocalization("entity.FrozenZombie.name", "en_US", "Frozen Zombie");

Link to comment
Share on other sites

I had to switch it around a little, but this works:

 

int ZombieBossID = EntityRegistry.findGlobalUniqueEntityId();	
EntityRegistry.registerGlobalEntityID(AC_EntityZombieBoss.class, "FrozenZombieBoss",  ZombieBossID, zombieBackGround, zombieSpots);
EntityRegistry.registerModEntity(AC_EntityZombieBoss.class, "FrozenZombieBoss", ZombieBossID, this, 128, 10, true);
LanguageRegistry.instance().addStringLocalization("entity.FrozenZombieBoss.name", "en_US", "Frozen Zombie Boss");

Link to comment
Share on other sites

I had to switch it around a little, but this works:

 

int ZombieBossID = EntityRegistry.findGlobalUniqueEntityId();	
EntityRegistry.registerGlobalEntityID(AC_EntityZombieBoss.class, "FrozenZombieBoss",  ZombieBossID, zombieBackGround, zombieSpots);
EntityRegistry.registerModEntity(AC_EntityZombieBoss.class, "FrozenZombieBoss", ZombieBossID, this, 128, 10, true);
LanguageRegistry.instance().addStringLocalization("entity.FrozenZombieBoss.name", "en_US", "Frozen Zombie Boss");

 

Shouldn't the EntityID in the method registerModEntity(...) be static? Because the ID used there is mod-specific, not global. I use 0, for the first entity and count down each entity (1 for the second a.s.o).

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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.