Age: 12(Less than 2 months from being 13)
IGN: CenturyDuster
How long have you been playing Minecraft? I have been playing since Beta 1.6.6, so that would be roughly 2 years.
Have you ever been banned before? I have never been banned before.
I understand that I'm kinda young, and even though so many people say this, I am mature for my age.
Also, assuming we ever Skype, my Skype name is Century Duster. (I don't have a squeaky voice, it's deepish)
Hello I am making a mod that adds Heroic Pigs. What I want to do is make it so when a new world is created one spawns right next to you already tamed and ready to protect you. How would I acheive this?
From what I can tell the code for setting its state is worldObj.setEntityState(this, (byte)7); but where do I put this? Hoepfully we can sort this out so we can all have a piggy to protect us one day. Please Help!
EntityCaptPig.java
package net.minecraft.src;
import java.util.Random;
public class EntityCaptPig extends EntityTameable
{
/**
* This flag is set when the wolf is looking at a player with interest, i.e. with tilted head. This happens when
* tamed wolf is wound and player holds porkchop (raw or cooked), or when wild wolf sees bone in player's hands.
*/
private boolean looksWithInterest;
private float field_25048_b;
private float field_25054_c;
private boolean isShaking;
private boolean field_25052_g;
/**
* This time increases while wolf is shaking and emitting water particles.
*/
private float timeWolfIsShaking;
private float prevTimeWolfIsShaking;
public EntityCaptPig(World par1World)
{
super(par1World);
looksWithInterest = false;
texture = "CaptPig.png";
setSize(0.6F, 0.8F);
moveSpeed = 0.3F;
func_48084_aL().func_48664_a(true);
tasks.addTask(1, new EntityAISwimming(this));
tasks.addTask(2, field_48146_a);
tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
tasks.addTask(4, new EntityAIAttackOnCollide(this, moveSpeed, true));
tasks.addTask(5, new EntityAIFollowOwner(this, moveSpeed, 10F, 2.0F));
tasks.addTask(6, new EntityAIMate(this, moveSpeed));
tasks.addTask(7, new EntityAIWander(this, moveSpeed));
tasks.addTask(8, new CaptPigAIBeg(this, 8F));
tasks.addTask(9, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 8F));
tasks.addTask(9, new EntityAILookIdle(this));
field_48105_bU.addTask(1, new EntityAIOwnerHurtByTarget(this));
field_48105_bU.addTask(2, new EntityAIOwnerHurtTarget(this));
field_48105_bU.addTask(3, new EntityAIHurtByTarget(this, true));
field_48105_bU.addTask(4, new EntityAITargetNonTamed(this, net.minecraft.src.EntitySheep.class, 16F, 200, false));
}
/**
* Returns true if the newer Entity AI code should be run
*/
public boolean isAIEnabled()
{
return true;
}
public void func_48092_c(EntityLiving par1EntityLiving)
{
super.func_48092_c(par1EntityLiving);
if (par1EntityLiving instanceof EntityPlayer)
{
setAngry(true);
}
}
protected void func_48097_s_()
{
dataWatcher.updateObject(18, Integer.valueOf(getEntityHealth()));
}
public int getMaxHealth()
{
return !func_48139_F_() ? 8 : 20;
}
protected void entityInit()
{
super.entityInit();
dataWatcher.addObject(18, new Integer(getEntityHealth()));
}
/**
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
* prevent them from trampling crops
*/
protected boolean canTriggerWalking()
{
return false;
}
/**
* returns the directory and filename as a String
*/
public String getEntityTexture()
{
if (func_48139_F_())
{
return "CaptPig.png";
}
if (isAngry())
{
return "CaptPig.png";
}
else
{
return super.getEntityTexture();
}
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", isAngry());
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
setAngry(par1NBTTagCompound.getBoolean("Angry"));
}
/**
* Determines if an entity can be despawned, used on idle far away entities
*/
protected boolean canDespawn()
{
return isAngry();
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
if (isAngry())
{
return "mob.pig";
}
if (rand.nextInt(3) == 0)
{
if (func_48139_F_() && dataWatcher.getWatchableObjectInt(18) < 10)
{
return "mob.pig";
}
else
{
return "mob.pig";
}
}
else
{
return "mob.pig";
}
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.pig.hurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.pig.death";
}
/**
* Returns the volume for the sounds this mob makes.
*/
protected float getSoundVolume()
{
return 0.4F;
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return -1;
}
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
public void onLivingUpdate()
{
super.onLivingUpdate();
if (!worldObj.isRemote && isShaking && !field_25052_g && !hasPath() && onGround)
{
field_25052_g = true;
timeWolfIsShaking = 0.0F;
prevTimeWolfIsShaking = 0.0F;
worldObj.setEntityState(this, (byte)8);
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();
field_25054_c = field_25048_b;
if (looksWithInterest)
{
field_25048_b = field_25048_b + (1.0F - field_25048_B) * 0.4F;
}
else
{
field_25048_b = field_25048_b + (0.0F - field_25048_B) * 0.4F;
}
if (looksWithInterest)
{
numTicksToChaseTarget = 10;
}
if (isWet())
{
isShaking = true;
field_25052_g = false;
timeWolfIsShaking = 0.0F;
prevTimeWolfIsShaking = 0.0F;
}
else if ((isShaking || field_25052_g) && field_25052_g)
{
if (timeWolfIsShaking == 0.0F)
{
worldObj.playSoundAtEntity(this, "mob.wolf.shake", getSoundVolume(), (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
}
prevTimeWolfIsShaking = timeWolfIsShaking;
timeWolfIsShaking += 0.05F;
if (prevTimeWolfIsShaking >= 2.0F)
{
isShaking = false;
field_25052_g = false;
prevTimeWolfIsShaking = 0.0F;
timeWolfIsShaking = 0.0F;
}
if (timeWolfIsShaking > 0.4F)
{
float f = (float)boundingBox.minY;
int i = (int)(MathHelper.sin((timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7F);
for (int j = 0; j < i; j++)
{
float f1 = (rand.nextFloat() * 2.0F - 1.0F) * width * 0.5F;
float f2 = (rand.nextFloat() * 2.0F - 1.0F) * width * 0.5F;
worldObj.spawnParticle("splash", posX + (double)f1, f + 0.8F, posZ + (double)f2, motionX, motionY, motionZ);
}
}
}
}
public boolean getWolfShaking()
{
return isShaking;
}
/**
* Used when calculating the amount of shading to apply while the wolf is shaking.
*/
public float getShadingWhileShaking(float par1)
{
return 0.75F + ((prevTimeWolfIsShaking + (timeWolfIsShaking - prevTimeWolfIsShaking) * par1) / 2.0F) * 0.25F;
}
public float getShakeAngle(float par1, float par2)
{
float f = (prevTimeWolfIsShaking + (timeWolfIsShaking - prevTimeWolfIsShaking) * par1 + par2) / 1.8F;
if (f < 0.0F)
{
f = 0.0F;
}
else if (f > 1.0F)
{
f = 1.0F;
}
return MathHelper.sin(f * (float)Math.PI) * MathHelper.sin(f * (float)Math.PI * 11F) * 0.15F * (float)Math.PI;
}
public float getInterestedAngle(float par1)
{
return (field_25054_c + (field_25048_b - field_25054_c) * par1) * 0.15F * (float)Math.PI;
}
public float getEyeHeight()
{
return height * 0.8F;
}
/**
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
* use in wolves.
*/
public int getVerticalFaceSpeed()
{
if (func_48141_af())
{
return 20;
}
else
{
return super.getVerticalFaceSpeed();
}
}
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
Entity entity = par1DamageSource.getEntity();
field_48146_a.func_48407_a(false);
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
{
par2 = (par2 + 1) / 2;
}
return super.attackEntityFrom(par1DamageSource, par2);
}
public boolean attackEntityAsMob(Entity par1Entity)
{
byte byte0 = ((byte)(func_48139_F_() ? 4 : 2));
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), byte0);
}
/**
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
*/
public boolean interact(EntityPlayer par1EntityPlayer)
{
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
if (!func_48139_F_())
{
if (itemstack != null && itemstack.itemID == Item.bone.shiftedIndex && !isAngry())
{
itemstack.stackSize--;
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
}
if (!worldObj.isRemote)
{
if (rand.nextInt(3) == 0)
{
func_48138_b(true);
setPathToEntity(null);
func_48092_c(null);
field_48146_a.func_48407_a(true);
setEntityHealth(300);
func_48143_a(par1EntityPlayer.username);
func_48142_a(true);
worldObj.setEntityState(this, (byte)7);
}
else
{
func_48142_a(false);
worldObj.setEntityState(this, (byte)6);
}
}
return true;
}
}
else
{
if (itemstack != null && (Item.itemsList[itemstack.itemID] instanceof ItemFood))
{
ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID];
if (itemfood.isWolfsFavoriteMeat() && dataWatcher.getWatchableObjectInt(18) < 20)
{
itemstack.stackSize--;
heal(itemfood.getHealAmount());
if (itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
}
return true;
}
}
if (par1EntityPlayer.username.equalsIgnoreCase(func_48145_ag()) && !worldObj.isRemote && !isWheat(itemstack))
{
field_48146_a.func_48407_a(!func_48141_af());
isJumping = false;
setPathToEntity(null);
}
}
return super.interact(par1EntityPlayer);
}
public void handleHealthUpdate(byte par1)
{
if (par1 == 8)
{
field_25052_g = true;
timeWolfIsShaking = 0.0F;
prevTimeWolfIsShaking = 0.0F;
}
else
{
super.handleHealthUpdate(par1);
}
}
public float setTailRotation()
{
if (isAngry())
{
return 1.53938F;
}
if (func_48139_F_())
{
return (0.55F - (float)(20 - dataWatcher.getWatchableObjectInt(18)) * 0.02F) * (float)Math.PI;
}
else
{
return ((float)Math.PI / 5F);
}
}
/**
* Checks if the parameter is an wheat item.
*/
public boolean isWheat(ItemStack par1ItemStack)
{
if (par1ItemStack == null)
{
return false;
}
if (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood))
{
return false;
}
else
{
return ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat();
}
}
/**
* Will return how many at most can spawn in a chunk at once.
*/
public int getMaxSpawnedInChunk()
{
return 8;
}
/**
* gets this wolf's angry state
*/
public boolean isAngry()
{
return (dataWatcher.getWatchableObjectByte(16) & 2) != 0;
}
/**
* sets this wolf's angry state to true if the boolean argument is true
*/
public void setAngry(boolean par1)
{
byte byte0 = dataWatcher.getWatchableObjectByte(16);
if (par1)
{
dataWatcher.updateObject(16, Byte.valueOf((byte)(byte0 | 2)));
}
else
{
dataWatcher.updateObject(16, Byte.valueOf((byte)(byte0 & -3)));
}
}
/**
* [This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.]
*/
public EntityAnimal spawnBabyAnimal(EntityAnimal par1EntityAnimal)
{
EntityWolf entitywolf = new EntityWolf(worldObj);
entitywolf.func_48143_a(func_48145_ag());
entitywolf.func_48138_b(true);
return entitywolf;
}
public void func_48150_h(boolean par1)
{
looksWithInterest = par1;
}
public boolean func_48135_b(EntityAnimal par1EntityAnimal)
{
if (par1EntityAnimal == this)
{
return false;
}
if (!func_48139_F_())
{
return false;
}
if (!(par1EntityAnimal instanceof EntityWolf))
{
return false;
}
EntityWolf entitywolf = (EntityWolf)par1EntityAnimal;
if (!entitywolf.func_48139_F_())
{
return false;
}
if (entitywolf.func_48141_af())
{
return false;
}
else
{
return func_48136_o_() && entitywolf.func_48136_o_();
}
}
}
mod_HeroPigs.java
package net.minecraft.src;
import java.util.Random;
import java.util.Map;
public class mod_HeroPigs extends BaseMod
{
public mod_HeroPigs()
{
AddMobs();
}
public void AddMobs()
{
ModLoader.registerEntityID(EntityCaptPig.class, "CaptPig", ModLoader.getUniqueEntityId(),0xFFFFFF, 0x003366);
ModLoader.addSpawn(EntityCaptPig.class, 500, 10, 10, EnumCreatureType.creature);
ModLoader.registerEntityID(EntitySpiderPig.class, "SpiderPig", ModLoader.getUniqueEntityId(),0xCC0000, 0x003366);
ModLoader.addSpawn(EntitySpiderPig.class, 10, 10, 10, EnumCreatureType.creature);
ModLoader.registerEntityID(EntityIronPig.class, "IronPig", ModLoader.getUniqueEntityId(),0xFFCC33 ,0xFF3300);
ModLoader.addSpawn(EntityIronPig.class, 10, 10, 10, EnumCreatureType.creature);
ModLoader.registerEntityID(EntityBatPig.class, "BatPig", ModLoader.getUniqueEntityId(),0x333333, 0xFFFC33);
ModLoader.addSpawn(EntityBatPig.class, 10, 20, 20, EnumCreatureType.creature);
ModLoader.addLocalization("entity.BatPig.name", "BatPig");
ModLoader.addLocalization("entity.IronPig.name", "IronPig");
ModLoader.addLocalization("entity.SpiderPig.name", "SpiderPig");
ModLoader.addLocalization("entity.CaptPig.name", "CaptainAmeriPig");
}
public void addRenderer(Map map) {
map.put(EntityCaptPig.class, new RenderCaptPig(new ModelCaptPig(), 0.5F));
map.put(EntitySpiderPig.class, new RenderSpiderPig(new ModelSpiderPig(), 0.5F));
map.put(EntityIronPig.class, new RenderIronPig(new ModelIronPig(), 0.5F));
map.put(EntityBatPig.class, new RenderBatPig(new ModelBatPig(), 5F));
}
public void load()
{
}
public String getVersion()
{
return "HeroicPigsMod 1.2.3";
}
}
Just in case it IS a problem with my RenderCaptPig file, here it is:
package net.minecraft.src;
public class RenderCaptPig extends RenderLiving
{
public RenderCaptPig(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
super(par1ModelBase, par3);
setRenderPassModel(par2ModelBase);
}
public void func_40286_a(EntityPig par1EntityPig, double par2, double par4, double par6, float par8, float par9)
{
super.doRenderLiving(par1EntityPig, par2, par4, par6, par8, par9);
}
/**
* Queries whether should render the specified pass or not.
*/
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
func_40286_a((EntityPig)par1EntityLiving, par2, par4, par6, par8, par9);
}
/**
* 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)
{
func_40286_a((EntityPig)par1Entity, par2, par4, par6, par8, par9);
}
}
Taken from RenderPig.java and removed all the parts with saddles because we cant have people riding around on Captain America now can we?
On a serious note thanks again for helping and being fast to respond too
public void addRenderer(Map map) {
map.put(EntityCaptPig.class, new RenderCaptPig(new ModelCaptPig(), 0.5F));
}
But now it gives error message Exception in thread "Minecraft main thread" java.lang.Error: Unresolved compilation problem:
The constructor RenderCaptPig(ModelCaptPig, float) is undefined
Thanks again for helping!
Also its not an error with any other classes because they do not produce a single error message.
package net.minecraft.src;
import java.util.Random;
import java.util.Map;
public class mod_HeroPigs extends BaseMod
{
public mod_HeroPigs()
{
AddMobs();
}
public void AddMobs()
{
ModLoader.registerEntityID(EntityCaptPig.class, "CaptPig", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityCaptPig.class, 1000, 500, 500, EnumCreatureType.creature);
}
public void addRenderer(Map map) {
map.put(net.minecraft.src.EntityCaptPig.class, RenderCaptPig.java(new ModelCaptPig(), 0.5F));
}
public void load()
{
}
public String getVersion()
{
return "HeroicPigsMod 1.2.3";
}
}
It gives out Error Message:
Exception in thread "Minecraft main thread" java.lang.Error: Unresolved compilation problem:
The method java(ModelCaptPig, float) is undefined for the type RenderCaptPig
I think i'm doing everything right. Thanks for the help, You've brought a few error messages down to one!
Sorry for asking questions on a thread that isnt mine...
This happened to me too. For some reason for it to work you have o open the zip file in 7zip too and THEN drag and drop or it will say action not supported. This should fix it
0
What do you mean by n/a? So no?
0
I'll add you on skype
Edit: I did a search for your name, nothing came up.
0
Applications:
Ign:
Age:
Skype:
Do you have a mic:
Time Zone:
Here's a good site to find your time zone: http://www.timezoneconverter.com/cgi-bin/findzone.tzc
For example, here would be my application:
Ign: CenturyDuster
Age: 12(2 months from being 13)
Skype: Century Duster
Do you have a mic: Yes
Time Zone: Pacific Time
I'm looking for people around my age, so like 12, 13, 14 would be good.
If you are accepted I will pm you the IP and whitelist you, then add you on skype.
0
Anyways, heres an album.
http://imgur.com/a/fbj42
This server is fun, if you are considering applying, you should do so
0
IGN: CenturyDuster
How long have you been playing Minecraft? I have been playing since Beta 1.6.6, so that would be roughly 2 years.
Have you ever been banned before? I have never been banned before.
I understand that I'm kinda young, and even though so many people say this, I am mature for my age.
Also, assuming we ever Skype, my Skype name is Century Duster. (I don't have a squeaky voice, it's deepish)
Anyways... Hope I can play with you guys soon
0
0
0
From what I can tell the code for setting its state is worldObj.setEntityState(this, (byte)7); but where do I put this? Hoepfully we can sort this out so we can all have a piggy to protect us one day. Please Help!
EntityCaptPig.java
mod_HeroPigs.java
0
0
0
Just in case it IS a problem with my RenderCaptPig file, here it is:
Taken from RenderPig.java and removed all the parts with saddles because we cant have people riding around on Captain America now can we?
On a serious note thanks again for helping and being fast to respond too
0
I made all the changes you said, changed it to
But now it gives error message Exception in thread "Minecraft main thread" java.lang.Error: Unresolved compilation problem:
The constructor RenderCaptPig(ModelCaptPig, float) is undefined
Thanks again for helping!
Also its not an error with any other classes because they do not produce a single error message.
0
It gives out Error Message:
Exception in thread "Minecraft main thread" java.lang.Error: Unresolved compilation problem:
The method java(ModelCaptPig, float) is undefined for the type RenderCaptPig
I think i'm doing everything right. Thanks for the help, You've brought a few error messages down to one!
Sorry for asking questions on a thread that isnt mine...
0
0