Jump to content

Recommended Posts

Posted
  On 5/10/2015 at 8:27 PM, NovaViper said:

I know about the UUID, I was asking what to do with it since it clearly won't work for String.  But wouldn't using a differenent player conflinct since its not saving the actual owner?

That's just flat out wrong. Did you not look at EntityTameable's code at all? It shows EXACTLY how to convert the UUID to String format so you can place it in DataWatcher or read/write as NBT.

 

The second question is a result of not understanding basic principles: the whole point of UUID is that it is UNIQUE, and the UUID for each player can always be used to retrieve that player instance from the world (if they are in the game).

  • Replies 98
  • Created
  • Last Reply

Top Posters In This Topic

Posted

That didn't work, I get this error when entering the game

 

[15:51:27] [server thread/ERROR] [FML]: An Entity type common.zeroquest.entity.zertum.EntityZertum has thrown an exception trying to write state. It will not persist. Report this to the mod author
net.minecraft.util.ReportedException: Saving entity NBT
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1637) ~[Entity.class:?]
at net.minecraft.entity.Entity.writeToNBTOptional(Entity.java:1563) ~[Entity.class:?]
at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:385) [AnvilChunkLoader.class:?]
at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:193) [AnvilChunkLoader.class:?]
at net.minecraft.world.gen.ChunkProviderServer.saveChunkData(ChunkProviderServer.java:266) [ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:332) [ChunkProviderServer.class:?]
at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:976) [WorldServer.class:?]
at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:419) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:147) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]
Caused by: java.lang.NullPointerException
at common.zeroquest.entity.zertum.EntityZertumEntity.writeEntityToNBT(EntityZertumEntity.java:305) ~[EntityZertumEntity.class:?]
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1620) ~[Entity.class:?]
... 10 more

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Uhm guys, you know that UUID works only on server right?

Putting UUID into DataWatcher is simply wrong.

 

What is needed to be understood is the fact that both SERVER and CLIENT might NOT have the EntityPlayer owner constructed.

That is when you use virtual (fake) links like UUID or even direct names.

 

There are many ways of handling this, depending on what data about owneryou need, how fast and where (client or server), you might even need more than two fields. I will try to describe design:

EntityPlayer owner; // Which will be direct reference to owner on both server and client.
String ownerUUID; // Which is used when link between owner and tamed entity can't be found - e.g owner is offline (there is no EntityPlayer owner).
String ownerName; // This exists for client display purposes.

 

Now what should be saved?

NBT is server sided, inside saveNBT you need to save UUID of owner and ownerName field, why you will learn later.

There are few scenarios:

Both owner and tamed entity can be loaded by world, so ideally in that case you can get UUID directly from owner.getUUID()

Say that owner is logged out, but entity was loaded by world - well, then - you have your ownerUUID field, you save that.

In any case - you always save this ownerName field.

 

Inside loadNBT, you will be loading ownerName and the UUID.

Now what happens, as ststed before - entity might be loaded with owner online or not.

When owner is in world:

- You load UUID, read world#getPlayerEntityByUUID(uuid) and set EntityPlayer owner field.

- You also want to keep UUID loaded - you set ownerUUID field to one loaded.

- Now, since you have direct link to player, you can do owner.getDisplayName() and set ownerName field to it.

When owner is not in world - you can't load entity that is NOT there:

- In that case, you load both UUID and ownerName.

- Now, you don't have EntityPlayer, but you still was able to get the name of player (last name that he logged in on server, which might have changed since, that's why I noted that this is for display purposes).

 

What should be shared between client and server?

As stated before - UUID are ONLY server side, on client - they won't work. Ideally you need to send owner.getEntityId() and then on client, load that uwing world#getEntityFromId() (might be different name). Those IDs are shared between server and client and are only link between entities that you can make.

Now the problem is that, while the SERVER might have owner's entity constructed, CLIENT might not (out of visible range).

That is why you also want to be sharing ownerName field. So in the end you will always have owners name on all clients, even if that owner is logged out or out of range. Note that this name is ONLY for DISPLAYING purposes - e.g a TAG above head, or value in GUI.

 

Few last words:

This design is somewhat caching technique, whenever you can - you use EntityPlayer, when you can't you use UUID, when there is no Entity with present UUID, you reference the name directly.

 

Obviously, you might not need EntityPlayer owner, you can always get him directly (on server) from UUID, but I am optimalization-hype guy, why would you want to search by UUID if you can do that much faster :D (in my case I am using owner per-tick, so that was understandable).

 

Ideally - this system does not use DataWatchers, but direct dynamic packet-updates based on EntityTracker and StartTrackingEvent, if you would use DataWatchers then you totally don't need EntityPlayer field as it is stored as entityId inside watcher (but, is slower).

 

This is not by any means "you have to do it" but rather different angle at coding styles, understand the system and you will be able to code anything.

 

EDIT

And yeah - go read Tameable code, you might be also interested in EntityThrowable which uses direct naming (like in design above).

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

@Ernio EntityTameable stores the Yggdrasil converted UUID in DataWatcher which should then be usable just fine to retrieve the owner Entity whether on the client or the server. Otherwise, why would they bother storing it in DataWatcher if it only worked on the server?

 

It is sound to cache the owner entity once you have retrieved it, though, and you will need to store both the UUID and nickname, which we have discussed to death already in this thread.

Posted
  On 5/10/2015 at 10:52 PM, NovaViper said:

EntityTameable already stores the UUID though, what about the owner name?

That was what I had been telling you...

You should store the 'owner nickname' field with the UUID. You should also put that into the DataWatcher.

Also when the player logs in, you should reset the nickname from the player, since the nickname can be changed.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted
  On 5/11/2015 at 1:27 AM, NovaViper said:

I know but I don't know HOW do to it

You should be able to store the nickname field,

so I assume that you don't know how to reset the nickname when the player logs in.

.. and I just realized doing that in Entity#onUpdate will be better.

In the onUpdate, check if the player with the saved UUID exists in the world, and set the name field with the player's nickname.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

In my mind operating on UUIDs was alway near to String stuff, which as you might know are not very efficient to be don in tick-time and per-entity.

 

That is the reason I suggested storing direct link to owner entity.

 

As to better ways:

Assuming that your entity is COMMON (somewhere around squids number) you could use PlayerLoggedInEvent to fire update check on all loaded entities that are instance of YourEntity. Just saying - saves a lot of UUID ops.

 

Post what you got (entity).

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted
  On 5/11/2015 at 2:40 AM, Ernio said:

In my mind operating on UUIDs was alway near to String stuff, which as you might know are not very efficient to be don in tick-time and per-entity.

 

That is the reason I suggested storing direct link to owner entity.

 

As to better ways:

Assuming that your entity is COMMON (somewhere around squids number) you could use PlayerLoggedInEvent to fire update check on all loaded entities that are instance of YourEntity. Just saying - saves a lot of UUID ops.

 

Post what you got (entity).

Oh I didn't know doing it on PlayerLoggedInEvent would be more efficient.

  (I assumed that his entity is extremely rare, and I realized that it wouldn't now)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Here is my entity code, and also, my entity is not rare, it spawns alot in a custom dimension I created.

 

package common.zeroquest.entity.zertum;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.init.*;
import net.minecraft.item.*;
import net.minecraft.nbt.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraftforge.fml.relauncher.*;
import common.zeroquest.*;
import common.zeroquest.core.helper.ChatHelper;
import common.zeroquest.entity.EntityCustomTameable;
import common.zeroquest.entity.ai.*;
import common.zeroquest.entity.util.*;
import common.zeroquest.inventory.*;
import common.zeroquest.lib.*;

public abstract class EntityZertumEntity extends EntityCustomTameable {
private float timeDogBegging;
private float prevTimeDogBegging;
public float headRotationCourse;
public float headRotationCourseOld;
public boolean isWet;
public boolean isShaking;
public float timeWolfIsShaking;
public float prevTimeWolfIsShaking;
private int hungerTick;
private int prevHungerTick;
private int healingTick;
private int prevHealingTick;
private int regenerationTick;
private int prevRegenerationTick;
public TalentUtil talents;
public LevelUtil levels;
public ModeUtil mode;
public CoordUtil coords;
public Map<String, Object> objects;
private boolean hasToy;
private float timeWolfIsHappy;
private float prevTimeWolfIsHappy;
private boolean isWolfHappy;
public boolean hiyaMaster;
private float mouthOpenness;
private float prevMouthOpenness;
private int openMouthCounter;

protected EntityAILeapAtTarget aiLeap = new EntityAILeapAtTarget(this, 0.4F);
public EntityAIWatchClosest aiStareAtPlayer = new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F);
public EntityAIWatchClosest aiGlareAtCreeper = new EntityAIWatchClosest(this, EntityCreeper.class, this.talents.getLevel("creeperspotter") * 6);
public EntityAIFetchBone aiFetchBone;

// data value IDs
/** DO NOT CHANGE! **/
public static final int INDEX_TAME = 16;
public static final int INDEX_COLLAR = 19;
public static final int INDEX_SADDLE = 20;
public static final int INDEX_EVOLVE = 25;
public static final int INDEX_MOUTH = 29;
public static final int INDEX_BEG = 30;

public EntityZertumEntity(World worldIn) {
	super(worldIn);
	this.objects = new HashMap<String, Object>();
	this.setSize(0.6F, 1.5F);
	((PathNavigateGround) this.getNavigator()).func_179690_a(true);
	this.tasks.addTask(1, new EntityAISwimming(this));
	this.tasks.addTask(2, this.aiSit);
	this.tasks.addTask(3, this.aiLeap);
	this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
	this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
	this.tasks.addTask(6, this.aiFetchBone = new EntityAIFetchBone(this, 1.0D, 0.5F, 20.0F));
	this.tasks.addTask(7, new EntityAIMate(this, 1.0D));
	this.tasks.addTask(8, new EntityAIWander(this, 1.0D));
	this.tasks.addTask(9, new EntityCustomAIBeg(this, 8.0F));
	this.tasks.addTask(10, aiStareAtPlayer);
	this.tasks.addTask(10, new EntityAILookIdle(this));
	this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
	this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
	this.targetTasks.addTask(3, new EntityAIModeAttackTarget(this));
	this.targetTasks.addTask(4, new EntityAIHurtByTarget(this, true));
	this.setTamed(false);
	this.setEvolved(false);
	this.inventory = new InventoryPack(this);
	this.targetTasks.addTask(6, new EntityAIRoundUp(this, EntityAnimal.class, 0, false));
	TalentHelper.onClassCreation(this);
}

@Override
public void applyEntityAttributes() {
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896);
	this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.wildHealth());
	this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.wildDamage());
	this.updateEntityAttributes();
}

public void updateEntityAttributes() {
	if (this.isTamed()) {
		if (!this.isChild() && !this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.tamedHealth() + this.effectiveLevel());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.tamedDamage());
		}
		else if (!this.isChild() && this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.evoHealth() + this.effectiveLevel());
		}
		else {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
	else {
		if (this.isChild()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
}

@Override
public void setTamed(boolean p_70903_1_) {
	super.setTamed(p_70903_1_);
	if (p_70903_1_) {
		if (!this.isChild() && !this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.tamedHealth() + this.effectiveLevel());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.tamedDamage());
		}
		else if (!this.isChild() && this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.evoHealth());
		}
		else {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
	else {
		if (this.isChild()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
}

public double tamedHealth() { // TODO
	if (this instanceof EntityZertum || this instanceof EntityRedZertum) {
		return 35;
	}
	else if (this instanceof EntityMetalZertum || this instanceof EntityIceZertum || this instanceof EntityForisZertum || this instanceof EntityDestroZertum || this instanceof EntityDarkZertum) {
		return 40;
	}
	return 0;
}

public double tamedDamage() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityMetalZertum || this instanceof EntityIceZertum || this instanceof EntityForisZertum) {
		return 8;
	}
	else if (this instanceof EntityDestroZertum) {
		return 10;
	}
	else if (this instanceof EntityDarkZertum) {
		return 12;
	}
	return 0;
}

public double evoHealth() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityIceZertum) {
		return 45;
	}
	else if (this instanceof EntityMetalZertum || this instanceof EntityForisZertum || this instanceof EntityDestroZertum) {
		return 50;
	}
	else if (this instanceof EntityDarkZertum) {
		return 60;
	}
	return 0;
}

public double wildHealth() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityForisZertum) {
		return 25;
	}
	else if (this instanceof EntityMetalZertum || this instanceof EntityDestroZertum || this instanceof EntityDarkZertum) {
		return 30;
	}
	else if (this instanceof EntityIceZertum) {
		return 35;
	}
	return 0;
}

public double wildDamage() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityMetalZertum || this instanceof EntityIceZertum || this instanceof EntityForisZertum) {
		return 6;
	}
	else if (this instanceof EntityDestroZertum) {
		return 8;
	}
	else if (this instanceof EntityDarkZertum) {
		return 10;
	}
	return 0;
}

public double babyHealth() {
	return 11;
}

public double babyDamage() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityMetalZertum) {
		return 2;
	}
	else if (this instanceof EntityIceZertum || this instanceof EntityForisZertum || this instanceof EntityDarkZertum) {
		return 4;
	}
	else if (this instanceof EntityDestroZertum) {
		return 3;
	}
	return 0;
}

/**
 * Sets the active target the Task system uses for tracking
 */
@Override
public void setAttackTarget(EntityLivingBase p_70624_1_) {
	super.setAttackTarget(p_70624_1_);
	if (p_70624_1_ == null) {
		this.setAngry(false);
	}
	else if (!this.isTamed()) {
		this.setAngry(true);
	}
}

@Override
public String getName() {
	String name = this.getZertumName();
	if (name != "" && this.isTamed()) {
		return name;
	}
	else {
		return super.getName();
	}
}

@Override
@SideOnly(Side.CLIENT)
public boolean getAlwaysRenderNameTagForRender() {
	return true;
}

@Override
protected void entityInit() { // TODO
	super.entityInit();
	this.talents = new TalentUtil(this);
	this.levels = new LevelUtil(this);
	this.mode = new ModeUtil(this);
	this.coords = new CoordUtil(this);

	this.dataWatcher.addObject(INDEX_COLLAR, new Byte((byte) EnumDyeColor.RED.getMetadata())); // Collar
	this.dataWatcher.addObject(INDEX_SADDLE, Byte.valueOf((byte) 0)); // Saddle
	this.dataWatcher.addObject(21, new String("")); // Dog Name
	this.dataWatcher.addObject(22, new String("")); // Talent Data
	this.dataWatcher.addObject(23, new Integer(Constants.hungerTicks)); // Dog
																		// Hunger
	this.dataWatcher.addObject(24, new String("0:0")); // Level Data
	this.dataWatcher.addObject(INDEX_EVOLVE, Byte.valueOf((byte) 0)); // Evolution
	this.dataWatcher.addObject(26, new Integer(0)); // Obey Others
	this.dataWatcher.addObject(27, new Integer(0)); // Dog Mode
	this.dataWatcher.addObject(28, "-1:-1:-1:-1:-1:-1"); // Dog Coordination
	this.dataWatcher.addObject(INDEX_MOUTH, Integer.valueOf(0)); // Mouth
	this.dataWatcher.addObject(INDEX_BEG, new Byte((byte) 0)); // Begging
}

@Override
public void writeEntityToNBT(NBTTagCompound tagCompound) {
	super.writeEntityToNBT(tagCompound);
	tagCompound.setBoolean("Angry", this.isAngry());
	tagCompound.setByte("CollarColor", (byte) this.getCollarColor().getDyeDamage());
	tagCompound.setBoolean("Saddle", this.isSaddled());
	tagCompound.setBoolean("Evolve", this.hasEvolved());

	tagCompound.setString("version", Constants.version);
	tagCompound.setString("dogName", this.getZertumName());
	tagCompound.setInteger("dogHunger", this.getDogHunger());
	tagCompound.setBoolean("willObey", this.willObeyOthers());
	tagCompound.setBoolean("dogBeg", this.isBegging());

	this.talents.writeTalentsToNBT(tagCompound);
	this.levels.writeTalentsToNBT(tagCompound);
	this.mode.writeToNBT(tagCompound);
	this.coords.writeToNBT(tagCompound);
	TalentHelper.writeToNBT(this, tagCompound);
}

@Override
public void readEntityFromNBT(NBTTagCompound tagCompound) {
	super.readEntityFromNBT(tagCompound);
	this.setAngry(tagCompound.getBoolean("Angry"));
	this.setSaddled(tagCompound.getBoolean("Saddle"));
	this.setEvolved(tagCompound.getBoolean("Evolve"));

	if (tagCompound.hasKey("CollarColor", 99)) {
		this.setCollarColor(EnumDyeColor.byDyeDamage(tagCompound.getByte("CollarColor")));
	}

	String lastVersion = tagCompound.getString("version");
	this.setZertumName(tagCompound.getString("dogName"));
	this.setDogHunger(tagCompound.getInteger("dogHunger"));
	this.setWillObeyOthers(tagCompound.getBoolean("willObey"));
	this.setBegging(tagCompound.getBoolean("dogBeg"));

	this.talents.readTalentsFromNBT(tagCompound);
	this.levels.readTalentsFromNBT(tagCompound);
	this.mode.readFromNBT(tagCompound);
	this.coords.readFromNBT(tagCompound);
	TalentHelper.readFromNBT(this, tagCompound);
}

@Override
protected void playStepSound(BlockPos p_180429_1_, Block p_180429_2_) {
	this.playSound("mob.wolf.step", 0.15F, 1.0F);
}

/**
 * Returns the sound this mob makes while it's alive.
 */
@Override
protected String getLivingSound() {
	this.openMouth();
	String sound = TalentHelper.getLivingSound(this);
	if (!"".equals(sound)) {
		return sound;
	}

	return this.isAngry() ? "mob.wolf.growl" : this.wantToHowl ? Sound.ZertumHowl
			: (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.getHealth() <= 10.0F
					? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
}

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

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

/**
 * Returns the volume for the sounds this mob makes.
 */
@Override
public float getSoundVolume() {
	return 1F;
}

/**
 * Get number of ticks, at least during which the living entity will be
 * silent.
 */
@Override
public int getTalkInterval() {
	if ((Boolean) this.objects.get("canseecreeper") == true) {
		return 40;
	}
	else if (this.wantToHowl) {
		return 150;
	}
	else if (this.getHealth() <= 10) {
		return 20;
	}
	else {
		return 200;
	}
}

/**
 * Returns the item ID for the item the mob drops on death.
 */
@Override
protected void dropFewItems(boolean par1, int par2) {
	rare = rand.nextInt(20);
	{
		if (this.isBurning()) {
			this.dropItem(ModItems.zertumMeatCooked, 1);
		}
		else if (rare <= 12) {
			this.dropItem(ModItems.zertumMeatRaw, 1);
		}
		if (rare <= 6 && !this.isTamed() && !(this instanceof EntityDarkZertum)) {
			this.dropItem(ModItems.nileGrain, 1);
		}
		if (rare <= 6 && !this.isTamed() && (this instanceof EntityDarkZertum)) {
			this.dropItem(ModItems.darkGrain, 1);
		}
		if (this.isSaddled()) {
			this.dropItem(Items.saddle, 1);
		}
		else {

		}

	}
}

/**
 * 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.
 */
@Override
public void onLivingUpdate() // TODO
{
	super.onLivingUpdate();
	if (isServer() && this.isWet && !this.isShaking && !this.hasPath() && this.onGround) {
		this.isShaking = true;
		this.timeWolfIsShaking = 0.0F;
		this.prevTimeWolfIsShaking = 0.0F;
		this.worldObj.setEntityState(this, (byte) ;
	}

	if (Constants.IS_HUNGER_ON) {
		this.prevHungerTick = this.hungerTick;

		if (this.riddenByEntity == null && !this.isSitting()) {
			this.hungerTick += 1;
		}

		this.hungerTick += TalentHelper.onHungerTick(this, this.hungerTick - this.prevHungerTick);

		if (this.hungerTick > 400) {
			this.setDogHunger(this.getDogHunger() - 1);
			this.hungerTick -= 400;
		}
	}

	if (Constants.DEF_HEALING == true && !this.isChild() && this.getHealth() <= 10 && this.isTamed()) {
		this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200));
	}

	if (this.getHealth() != 1) {
		this.prevHealingTick = this.healingTick;
		this.healingTick += this.nourishment();

		if (this.healingTick >= 6000) {
			if (this.getHealth() < this.getMaxHealth()) {
				this.setHealth(this.getHealth() + 1);
			}

			this.healingTick = 0;
		}
	}

	if (this.getDogHunger() == 0 && this.worldObj.getWorldInfo().getWorldTime() % 100L == 0L && this.getHealth() > 1) {
		this.attackEntityFrom(DamageSource.generic, 1);
	}

	if (isServer() && this.getAttackTarget() == null && this.isAngry()) {
		this.setAngry(false);
	}

	if (Constants.DEF_HOWL == true) {
		if (this.isServer()) {
			if (this.worldObj.isDaytime() && this.isChild()) // TODO
			{
				wantToHowl = false;
			}
			else if (!this.isChild()) {
				wantToHowl = true;
			}
		}
	}
	TalentHelper.onLivingUpdate(this);
}

/**
 * Called to update the entity's position/logic.
 */
@Override
public void onUpdate() {
	super.onUpdate();
	this.prevTimeDogBegging = this.timeDogBegging;

	if (this.isBegging()) {
		this.timeDogBegging += (1.0F - this.timeDogBegging) * 0.4F;
	}
	else {
		this.timeDogBegging += (0.0F - this.timeDogBegging) * 0.4F;
	}

	if (this.openMouthCounter > 0 && ++this.openMouthCounter > 30) {
		this.openMouthCounter = 0;
		this.setHorseWatchableBoolean(128, false);
	}

	this.prevMouthOpenness = this.mouthOpenness;

	if (this.getHorseWatchableBoolean(128)) {
		this.mouthOpenness += (1.0F - this.mouthOpenness) * 0.7F + 0.05F;

		if (this.mouthOpenness > 1.0F) {
			this.mouthOpenness = 1.0F;
		}
	}
	else {
		this.mouthOpenness += (0.0F - this.mouthOpenness) * 0.7F - 0.05F;

		if (this.mouthOpenness < 0.0F) {
			this.mouthOpenness = 0.0F;
		}
	}
	this.headRotationCourseOld = this.headRotationCourse;

	if (this.func_70922_bv()) {
		this.headRotationCourse += (1.0F - this.headRotationCourse) * 0.4F;
	}
	else {
		this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F;
	}

	if (this.isWet()) {
		this.isWet = true;
		this.isShaking = false;
		this.timeWolfIsShaking = 0.0F;
		this.prevTimeWolfIsShaking = 0.0F;
	}
	else if ((this.isWet || this.isShaking) && this.isShaking) {
		if (this.timeWolfIsShaking == 0.0F) {
			this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
		}

		this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
		this.timeWolfIsShaking += 0.05F;

		if (this.prevTimeWolfIsShaking >= 2.0F) {
			if (this.rand.nextInt(15) < this.talents.getLevel("fishing") * 2) {
				if (this.rand.nextInt(15) < this.talents.getLevel("flamingelemental") * 2 && this instanceof EntityRedZertum) {
					if (isServer()) {
						dropItem(Items.cooked_fish, 1);
					}
				}
				else {
					if (isServer()) {
						dropItem(Items.fish, 1);
					}
				}
			}
			this.isWet = false;
			this.isShaking = false;
			this.prevTimeWolfIsShaking = 0.0F;
			this.timeWolfIsShaking = 0.0F;
		}

		if (this.timeWolfIsShaking > 0.4F) {
			float f = (float) this.getEntityBoundingBox().minY;
			int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F);

			for (int j = 0; j < i; ++j) {
				float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
				float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
				this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX + f1, f + 0.8F, this.posZ + f2, this.motionX, this.motionY, this.motionZ, new int[0]);
			}
		}
	}

	if (this.rand.nextInt(200) == 0 && this.hasEvolved()) {
		this.hiyaMaster = true;
	}

	if (((this.isBegging()) || (this.hiyaMaster)) && (!this.isWolfHappy) && this.hasEvolved()) {
		this.isWolfHappy = true;
		this.timeWolfIsHappy = 0.0F;
		this.prevTimeWolfIsHappy = 0.0F;
	}
	else {
		hiyaMaster = false;
	}
	if (this.isWolfHappy) {
		if (this.timeWolfIsHappy % 1.0F == 0.0F) {
			if (!(this instanceof EntityMetalZertum)) {
				this.openMouth();
				this.worldObj.playSoundAtEntity(this, "mob.wolf.panting", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
			}
			else if (this instanceof EntityMetalZertum) {
				this.openMouth();
				this.worldObj.playSoundAtEntity(this, Sound.MetalZertumPant, this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
			}
		}
		this.prevTimeWolfIsHappy = this.timeWolfIsHappy;
		this.timeWolfIsHappy += 0.05F;
		if (this.prevTimeWolfIsHappy >= 8.0F) {
			this.isWolfHappy = false;
			this.prevTimeWolfIsHappy = 0.0F;
			this.timeWolfIsHappy = 0.0F;
		}
	}

	if (this.isTamed()) {
		EntityPlayer player = (EntityPlayer) this.getOwner();

		if (player != null) {
			float distanceToOwner = player.getDistanceToEntity(this);

			if (distanceToOwner <= 2F && this.hasToy()) {
				if (isServer()) {
					this.entityDropItem(new ItemStack(ModItems.toy, 1, 1), 0.0F);
				}
				this.setHasToy(false);
			}
		}
	}
	TalentHelper.onUpdate(this);
}

public float getWagAngle(float f, float f1) {
	float f2 = (this.prevTimeWolfIsHappy + (this.timeWolfIsHappy - this.prevTimeWolfIsHappy) * f + f1) / 2.0F;
	if (f2 < 0.0F) {
		f2 = 0.0F;
	}
	else if (f2 > 2.0F) {
		f2 %= 2.0F;
	}
	return MathHelper.sin(f2 * (float) Math.PI * 11.0F) * 0.3F * (float) Math.PI;
}

@Override
public void moveEntityWithHeading(float strafe, float forward) {
	if (this.riddenByEntity instanceof EntityPlayer) {
		this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
		this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
		this.setRotation(this.rotationYaw, this.rotationPitch);
		this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
		strafe = ((EntityPlayer) this.riddenByEntity).moveStrafing * 0.5F;
		forward = ((EntityPlayer) this.riddenByEntity).moveForward;

		if (forward <= 0.0F) {
			forward *= 0.25F;
		}

		if (this.onGround) {
			if (forward > 0.0F) {
				float f2 = MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F);
				float f3 = MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F);
				this.motionX += -0.4F * f2 * 0.15F; // May change
				this.motionZ += 0.4F * f3 * 0.15F;
			}
		}

		this.stepHeight = 1.0F;
		this.jumpMovementFactor = this.getAIMoveSpeed() * 0.2F;

		if (isServer()) {
			this.setAIMoveSpeed((float) this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() / 4);
			super.moveEntityWithHeading(strafe, forward);
		}

		if (this.onGround) {
			// this.jumpPower = 0.0F;
			// this.setHorseJumping(false);
		}

		this.prevLimbSwingAmount = this.limbSwingAmount;
		double d0 = this.posX - this.prevPosX;
		double d1 = this.posZ - this.prevPosZ;
		float f4 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F;

		if (f4 > 1.0F) {
			f4 = 1.0F;
		}

		this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
		this.limbSwing += this.limbSwingAmount;
	}
	else {
		this.stepHeight = 0.5F;
		this.jumpMovementFactor = 0.02F;
		super.moveEntityWithHeading(strafe, forward);
	}
}

@Override
public float getAIMoveSpeed() { // TODO
	double speed = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
	speed += TalentHelper.addToMoveSpeed(this);

	if ((!(this.getAttackTarget() instanceof EntityZertumEntity) && !(this.getAttackTarget() instanceof EntityPlayer)) || this.riddenByEntity instanceof EntityPlayer) {
		if (this.levels.getLevel() == Constants.maxLevel && this.hasEvolved()) {
			speed += 0.4D;
		}
		else if (this.hasEvolved() && this.levels.getLevel() != Constants.maxLevel) {
			speed += 0.4D;
		}
	}

	if (this.riddenByEntity instanceof EntityPlayer) {
		speed /= 4;
	}

	return (float) speed;
}

public float getAIAttackDamage() {
	double damage = this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
	damage += TalentHelper.addToAttackDamage(this);

	if ((!(this.getAttackTarget() instanceof EntityZertumEntity) && !(this.getAttackTarget() instanceof EntityPlayer))) {
		if (this.levels.getLevel() == Constants.maxLevel && this.hasEvolved()) {
			damage += 2.0D;
		}
		else if (this.hasEvolved() && this.levels.getLevel() != Constants.maxLevel) {
			damage += 2.0D;
		}
	}
	return (float) damage;
}

@Override
public void fall(float distance, float damageMultiplier) {
	if (distance > 1.0F) {
		this.playSound("game.neutral.hurt.fall.small", 0.4F, 1.0F);
	}

	int i = MathHelper.ceiling_float_int(((distance * 0.5F - 3.0F) - TalentHelper.fallProtection(this)) * damageMultiplier);

	if (i > 0 && !TalentHelper.isImmuneToFalls(this)) {
		this.attackEntityFrom(DamageSource.fall, i);

		if (this.riddenByEntity != null) {
			this.riddenByEntity.attackEntityFrom(DamageSource.fall, i);
		}

		Block block = this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.2D - this.prevRotationYaw, this.posZ)).getBlock();

		if (block.getMaterial() != Material.air && !this.isSilent()) {
			Block.SoundType soundtype = block.stepSound;
			this.worldObj.playSoundAtEntity(this, soundtype.getStepSound(), soundtype.getVolume() * 0.5F, soundtype.getFrequency() * 0.75F);
		}
	}
}

@SideOnly(Side.CLIENT)
public boolean isWolfWet() {
	return this.isWet;
}

@SideOnly(Side.CLIENT)
public float getShadingWhileWet(float p_70915_1_) {
	return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F;
}

@SideOnly(Side.CLIENT)
public float getShakeAngle(float p_70923_1_, float p_70923_2_) {
	float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F;

	if (f2 < 0.0F) {
		f2 = 0.0F;
	}
	else if (f2 > 1.0F) {
		f2 = 1.0F;
	}

	return MathHelper.sin(f2 * (float) Math.PI) * MathHelper.sin(f2 * (float) Math.PI * 11.0F) * 0.15F * (float) Math.PI;
}

@SideOnly(Side.CLIENT)
public float getInterestedAngle(float partialTickTime) {
	return (this.prevTimeDogBegging + (this.timeDogBegging - this.prevTimeDogBegging) * partialTickTime) * 0.15F * (float) Math.PI;
}

@Override
public float getEyeHeight() {
	return this.height * 0.8F;
}

@Override
public int getVerticalFaceSpeed() {
	return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
}

@Override
public boolean attackEntityFrom(DamageSource damageSource, float damage) {
	if (this.isEntityInvulnerable(damageSource)) {
		return false;
	}
	else {
		if (!TalentHelper.attackEntityFrom(this, damageSource, damage)) {
			return false;
		}

		Entity entity = damageSource.getEntity();
		this.aiSit.setSitting(false);

		if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) {
			damage = (damage + 1.0F) / 2.0F;
		}

		return super.attackEntityFrom(damageSource, damage);
	}
}

@Override
public boolean attackEntityAsMob(Entity entity) { // TODO
	if (!TalentHelper.shouldDamageMob(this, entity)) {
		return false;
	}

	int damage = (int) (4 + (this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getBaseValue()) / 2);
	damage = TalentHelper.attackEntityAsMob(this, entity, damage);

	if (entity instanceof EntityZombie) {
		((EntityZombie) entity).setAttackTarget(this);
	}

	return entity.attackEntityFrom(DamageSource.causeMobDamage(this), damage);
}

/**
 * Called when the mob's health reaches 0.
 */
@Override
public void onDeath(DamageSource par1DamageSource) {
	super.onDeath(par1DamageSource);

	if (par1DamageSource.getEntity() instanceof EntityPlayer) {
		EntityPlayer entityplayer = (EntityPlayer) par1DamageSource.getEntity();
		{
			entityplayer.triggerAchievement(ModAchievements.ZertKill);
			this.dropChestItems();

		}
	}
}

@Override
protected boolean isMovementBlocked() {
	return this.isPlayerSleeping() || this.ridingEntity != null || this.riddenByEntity instanceof EntityPlayer || super.isMovementBlocked();
}

@Override
public double getYOffset() {
	return this.ridingEntity instanceof EntityPlayer ? 0.5D : 0.0D;
}

@Override
public boolean isPotionApplicable(PotionEffect potionEffect) {
	if (this.getHealth() <= 1) {
		return false;
	}

	if (!TalentHelper.isPostionApplicable(this, potionEffect)) {
		return false;
	}

	return true;
}

@Override
public void setFire(int amount) {
	if (TalentHelper.setFire(this, amount)) {
		super.setFire(amount);
	}
}

public int foodValue(ItemStack stack) {
	if (stack == null || stack.getItem() == null) {
		return 0;
	}

	int foodValue = 0;

	Item item = stack.getItem();

	if (stack.getItem() != Items.rotten_flesh && item instanceof ItemFood) {
		ItemFood itemfood = (ItemFood) item;

		if (itemfood.isWolfsFavoriteMeat()) {
			foodValue = 40;
		}
	}

	foodValue = TalentHelper.changeFoodValue(this, stack, foodValue);

	return foodValue;
}

public int masterOrder() { // TODO
	int order = 0;
	EntityPlayer player = (EntityPlayer) this.getOwner();

	if (player != null) {

		float distanceAway = player.getDistanceToEntity(this);
		ItemStack itemstack = player.inventory.getCurrentItem();

		if (itemstack != null && (itemstack.getItem() instanceof ItemTool) && distanceAway <= 20F) {
			order = 1;
		}

		if (itemstack != null && ((itemstack.getItem() instanceof ItemSword) || (itemstack.getItem() instanceof ItemBow))) {
			order = 2;
		}

		if (itemstack != null && itemstack.getItem() == Items.wheat) {
			order = 3;
		}

		if (itemstack != null && itemstack.getItem() == Items.bone) {
			order = 4;
		}
	}

	return order;
}

@Override
public boolean canBreatheUnderwater() {
	return TalentHelper.canBreatheUnderwater(this);
}

@Override
public boolean canInteract(EntityPlayer player) {
	return this.isOwner(player) || this.willObeyOthers();
}

public int nourishment() {
	int amount = 0;

	if (this.getDogHunger() > 0) {
		amount = 40 + 4 * (this.effectiveLevel() + 1);

		if (isSitting() && this.talents.getLevel("rapidregen") == 5) {
			amount += 20 + 2 * (this.effectiveLevel() + 1);
		}

		if (!this.isSitting()) {
			amount *= 5 + this.talents.getLevel("rapidregen");
			amount /= 10;
		}
	}

	return amount;
}

public int effectiveLevel() { // TODO
	return (this.levels.getLevel()) / 10;
}

public String getZertumName() {
	return this.dataWatcher.getWatchableObjectString(21);
}

public void setZertumName(String var1) {
	this.dataWatcher.updateObject(21, var1);
}

public void setWillObeyOthers(boolean flag) {
	this.dataWatcher.updateObject(26, flag ? 1 : 0);
}

public boolean willObeyOthers() {
	return this.dataWatcher.getWatchableObjectInt(26) != 0;
}

public int points() {
	return this.levels.getLevel() + (this.getGrowingAge() < 0 ? 0 : 20);
}

public int spendablePoints() {
	return this.points() - this.usedPoints();
}

public int usedPoints() {
	return TalentHelper.getUsedPoints(this);
}

public int deductive(int level) {
	byte byte0 = 0;
	switch (level) {
		case 1:
			return 1;
		case 2:
			return 3;
		case 3:
			return 5;
		case 4:
			return 7;
		case 5:
			return 9;
		default:
			return 0;
	}
}

public int getDogHunger() {
	return this.dataWatcher.getWatchableObjectInt(23);
}

public void setDogHunger(int par1) {
	this.dataWatcher.updateObject(23, MathHelper.clamp_int(par1, 0, Constants.hungerTicks));
}

@Override
public boolean func_142018_a(EntityLivingBase entityToAttack, EntityLivingBase owner) {
	if (TalentHelper.canAttackEntity(this, entityToAttack)) {
		return true;
	}

	if (!(entityToAttack instanceof EntityCreeper) && !(entityToAttack instanceof EntityGhast)) {
		if (entityToAttack instanceof EntityZertumEntity) {
			EntityZertumEntity entityZertum = (EntityZertumEntity) entityToAttack;

			if (entityZertum.isTamed() && entityZertum.getOwner() == owner) {
				return false;
			}
		}

		return entityToAttack instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) entityToAttack)
				? false
				: !(entityToAttack instanceof EntityHorse) || !((EntityHorse) entityToAttack).isTame();
	}
	else {
		return false;
	}
}

@Override
public boolean canAttackClass(Class p_70686_1_) {
	if (TalentHelper.canAttackClass(this, p_70686_1_)) {
		return true;
	}

	return super.canAttackClass(p_70686_1_);
}

public void setHasToy(boolean hasBone) {
	this.hasToy = hasBone;
}

public boolean hasToy() {
	return this.hasToy;
}

/**
 * Gets the pitch of living sounds in living entities.
 */
@Override
public float getPitch() {
	if (!this.isChild()) {
		return super.getSoundPitch();
	}
	else {
		return super.getSoundPitch() * 1;
	}
}

@Override
@SideOnly(Side.CLIENT)
public void handleHealthUpdate(byte p_70103_1_) {
	if (p_70103_1_ ==  {
		this.isShaking = true;
		this.timeWolfIsShaking = 0.0F;
		this.prevTimeWolfIsShaking = 0.0F;
	}
	else {
		super.handleHealthUpdate(p_70103_1_);
	}
}

/**
 * Checks if the parameter is an item which this animal can be fed to breed
 * it (wheat, carrots or seeds depending on the animal type)
 */
@Override
public boolean isBreedingItem(ItemStack itemstack) {
	return itemstack == null ? false : itemstack.getItem() == ModItems.dogTreat;
}

@Override
public int getMaxSpawnedInChunk() {
	return 8;
}

public boolean isAngry() {
	return (this.dataWatcher.getWatchableObjectByte(INDEX_TAME) & 2) != 0;
}

public void setAngry(boolean p_70916_1_) {
	byte b0 = this.dataWatcher.getWatchableObjectByte(INDEX_TAME);

	if (p_70916_1_) {
		this.dataWatcher.updateObject(INDEX_TAME, Byte.valueOf((byte) (b0 | 2)));
	}
	else {
		this.dataWatcher.updateObject(INDEX_TAME, Byte.valueOf((byte) (b0 & -3)));
	}
}

public EnumDyeColor getCollarColor() {
	return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectByte(INDEX_COLLAR) & 15);
}

public void setCollarColor(EnumDyeColor collarcolor) {
	this.dataWatcher.updateObject(INDEX_COLLAR, Byte.valueOf((byte) (collarcolor.getDyeDamage() & 15)));
}

public boolean isSaddled() {
	return (this.dataWatcher.getWatchableObjectByte(INDEX_SADDLE) & 1) != 0;
}

public void setSaddled(boolean p_70900_1_) {
	if (p_70900_1_) {
		this.dataWatcher.updateObject(INDEX_SADDLE, Byte.valueOf((byte) 1));
	}
	else {
		this.dataWatcher.updateObject(INDEX_SADDLE, Byte.valueOf((byte) 0));
	}
}

private boolean getHorseWatchableBoolean(int p_110233_1_) {
	return (this.dataWatcher.getWatchableObjectInt(INDEX_MOUTH) & p_110233_1_) != 0;
}

private void setHorseWatchableBoolean(int p_110208_1_, boolean p_110208_2_) {
	int j = this.dataWatcher.getWatchableObjectInt(INDEX_MOUTH);

	if (p_110208_2_) {
		this.dataWatcher.updateObject(INDEX_MOUTH, Integer.valueOf(j | p_110208_1_));
	}
	else {
		this.dataWatcher.updateObject(INDEX_MOUTH, Integer.valueOf(j & ~p_110208_1_));
	}
}

@SideOnly(Side.CLIENT)
public float func_110201_q(float p_110201_1_) {
	return this.prevMouthOpenness + (this.mouthOpenness - this.prevMouthOpenness) * p_110201_1_;
}

public void openMouth() {
	if (isServer()) {
		this.openMouthCounter = 1;
		this.setHorseWatchableBoolean(128, true);
	}
}

/**
 * Determines if an entity can be despawned, used on idle far away entities
 */
@Override
protected boolean canDespawn() {
	return !this.isTamed() && this.ticksExisted > 2400;
}

@Override
public boolean allowLeashing() {
	return !this.isAngry() && super.allowLeashing();
}

public void setBegging(boolean flag) {
	this.dataWatcher.updateObject(INDEX_BEG, Byte.valueOf((byte) (flag ? 1 : 0)));
}

public boolean isBegging() {
	return this.dataWatcher.getWatchableObjectByte(INDEX_BEG) == 1;
}

public boolean hasEvolved() // TODO
{
	return (this.dataWatcher.getWatchableObjectByte(INDEX_EVOLVE) & 1) != 0;
}

public void evolveBoolean(boolean p_70900_1_) {
	if (p_70900_1_) {
		this.dataWatcher.updateObject(INDEX_EVOLVE, Byte.valueOf((byte) 1));
	}
	else {
		this.dataWatcher.updateObject(INDEX_EVOLVE, Byte.valueOf((byte) 0));
	}
}

public void setEvolved(boolean p_70900_1_) {
	this.evolveBoolean(p_70900_1_);
	if (p_70900_1_) {
		if (!this.isChild() && !this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.tamedHealth() + this.effectiveLevel());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.tamedDamage());
		}
		else if (!this.isChild() && this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.evoHealth());
		}
		else {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
	else {
		if (this.isChild()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
}

public void evolveOnClient(EntityPlayer player) {
	this.setEvolved(true);
	this.worldObj.playBroadcastSound(1013, new BlockPos(this), 0);
	player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + this.getZertumName() + " has been evolved!"));
}

public void evolveOnServer(EntityZertumEntity entity, EntityPlayer player) {
	entity.setEvolved(true);
	entity.worldObj.playBroadcastSound(1013, new BlockPos(entity), 0);
	player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + entity.getZertumName() + " has been evolved!"));
}
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted
  On 5/11/2015 at 9:29 PM, NovaViper said:

Here is my entity code, and also, my entity is not rare, it spawns alot in a custom dimension I created.

 

package common.zeroquest.entity.zertum;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.init.*;
import net.minecraft.item.*;
import net.minecraft.nbt.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraftforge.fml.relauncher.*;
import common.zeroquest.*;
import common.zeroquest.core.helper.ChatHelper;
import common.zeroquest.entity.EntityCustomTameable;
import common.zeroquest.entity.ai.*;
import common.zeroquest.entity.util.*;
import common.zeroquest.inventory.*;
import common.zeroquest.lib.*;

public abstract class EntityZertumEntity extends EntityCustomTameable {
private float timeDogBegging;
private float prevTimeDogBegging;
public float headRotationCourse;
public float headRotationCourseOld;
public boolean isWet;
public boolean isShaking;
public float timeWolfIsShaking;
public float prevTimeWolfIsShaking;
private int hungerTick;
private int prevHungerTick;
private int healingTick;
private int prevHealingTick;
private int regenerationTick;
private int prevRegenerationTick;
public TalentUtil talents;
public LevelUtil levels;
public ModeUtil mode;
public CoordUtil coords;
public Map<String, Object> objects;
private boolean hasToy;
private float timeWolfIsHappy;
private float prevTimeWolfIsHappy;
private boolean isWolfHappy;
public boolean hiyaMaster;
private float mouthOpenness;
private float prevMouthOpenness;
private int openMouthCounter;

protected EntityAILeapAtTarget aiLeap = new EntityAILeapAtTarget(this, 0.4F);
public EntityAIWatchClosest aiStareAtPlayer = new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F);
public EntityAIWatchClosest aiGlareAtCreeper = new EntityAIWatchClosest(this, EntityCreeper.class, this.talents.getLevel("creeperspotter") * 6);
public EntityAIFetchBone aiFetchBone;

// data value IDs
/** DO NOT CHANGE! **/
public static final int INDEX_TAME = 16;
public static final int INDEX_COLLAR = 19;
public static final int INDEX_SADDLE = 20;
public static final int INDEX_EVOLVE = 25;
public static final int INDEX_MOUTH = 29;
public static final int INDEX_BEG = 30;

public EntityZertumEntity(World worldIn) {
	super(worldIn);
	this.objects = new HashMap<String, Object>();
	this.setSize(0.6F, 1.5F);
	((PathNavigateGround) this.getNavigator()).func_179690_a(true);
	this.tasks.addTask(1, new EntityAISwimming(this));
	this.tasks.addTask(2, this.aiSit);
	this.tasks.addTask(3, this.aiLeap);
	this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
	this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
	this.tasks.addTask(6, this.aiFetchBone = new EntityAIFetchBone(this, 1.0D, 0.5F, 20.0F));
	this.tasks.addTask(7, new EntityAIMate(this, 1.0D));
	this.tasks.addTask(8, new EntityAIWander(this, 1.0D));
	this.tasks.addTask(9, new EntityCustomAIBeg(this, 8.0F));
	this.tasks.addTask(10, aiStareAtPlayer);
	this.tasks.addTask(10, new EntityAILookIdle(this));
	this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
	this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
	this.targetTasks.addTask(3, new EntityAIModeAttackTarget(this));
	this.targetTasks.addTask(4, new EntityAIHurtByTarget(this, true));
	this.setTamed(false);
	this.setEvolved(false);
	this.inventory = new InventoryPack(this);
	this.targetTasks.addTask(6, new EntityAIRoundUp(this, EntityAnimal.class, 0, false));
	TalentHelper.onClassCreation(this);
}

@Override
public void applyEntityAttributes() {
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896);
	this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.wildHealth());
	this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.wildDamage());
	this.updateEntityAttributes();
}

public void updateEntityAttributes() {
	if (this.isTamed()) {
		if (!this.isChild() && !this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.tamedHealth() + this.effectiveLevel());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.tamedDamage());
		}
		else if (!this.isChild() && this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.evoHealth() + this.effectiveLevel());
		}
		else {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
	else {
		if (this.isChild()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
}

@Override
public void setTamed(boolean p_70903_1_) {
	super.setTamed(p_70903_1_);
	if (p_70903_1_) {
		if (!this.isChild() && !this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.tamedHealth() + this.effectiveLevel());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.tamedDamage());
		}
		else if (!this.isChild() && this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.evoHealth());
		}
		else {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
	else {
		if (this.isChild()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
}

public double tamedHealth() { // TODO
	if (this instanceof EntityZertum || this instanceof EntityRedZertum) {
		return 35;
	}
	else if (this instanceof EntityMetalZertum || this instanceof EntityIceZertum || this instanceof EntityForisZertum || this instanceof EntityDestroZertum || this instanceof EntityDarkZertum) {
		return 40;
	}
	return 0;
}

public double tamedDamage() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityMetalZertum || this instanceof EntityIceZertum || this instanceof EntityForisZertum) {
		return 8;
	}
	else if (this instanceof EntityDestroZertum) {
		return 10;
	}
	else if (this instanceof EntityDarkZertum) {
		return 12;
	}
	return 0;
}

public double evoHealth() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityIceZertum) {
		return 45;
	}
	else if (this instanceof EntityMetalZertum || this instanceof EntityForisZertum || this instanceof EntityDestroZertum) {
		return 50;
	}
	else if (this instanceof EntityDarkZertum) {
		return 60;
	}
	return 0;
}

public double wildHealth() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityForisZertum) {
		return 25;
	}
	else if (this instanceof EntityMetalZertum || this instanceof EntityDestroZertum || this instanceof EntityDarkZertum) {
		return 30;
	}
	else if (this instanceof EntityIceZertum) {
		return 35;
	}
	return 0;
}

public double wildDamage() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityMetalZertum || this instanceof EntityIceZertum || this instanceof EntityForisZertum) {
		return 6;
	}
	else if (this instanceof EntityDestroZertum) {
		return 8;
	}
	else if (this instanceof EntityDarkZertum) {
		return 10;
	}
	return 0;
}

public double babyHealth() {
	return 11;
}

public double babyDamage() {
	if (this instanceof EntityZertum || this instanceof EntityRedZertum || this instanceof EntityMetalZertum) {
		return 2;
	}
	else if (this instanceof EntityIceZertum || this instanceof EntityForisZertum || this instanceof EntityDarkZertum) {
		return 4;
	}
	else if (this instanceof EntityDestroZertum) {
		return 3;
	}
	return 0;
}

/**
 * Sets the active target the Task system uses for tracking
 */
@Override
public void setAttackTarget(EntityLivingBase p_70624_1_) {
	super.setAttackTarget(p_70624_1_);
	if (p_70624_1_ == null) {
		this.setAngry(false);
	}
	else if (!this.isTamed()) {
		this.setAngry(true);
	}
}

@Override
public String getName() {
	String name = this.getZertumName();
	if (name != "" && this.isTamed()) {
		return name;
	}
	else {
		return super.getName();
	}
}

@Override
@SideOnly(Side.CLIENT)
public boolean getAlwaysRenderNameTagForRender() {
	return true;
}

@Override
protected void entityInit() { // TODO
	super.entityInit();
	this.talents = new TalentUtil(this);
	this.levels = new LevelUtil(this);
	this.mode = new ModeUtil(this);
	this.coords = new CoordUtil(this);

	this.dataWatcher.addObject(INDEX_COLLAR, new Byte((byte) EnumDyeColor.RED.getMetadata())); // Collar
	this.dataWatcher.addObject(INDEX_SADDLE, Byte.valueOf((byte) 0)); // Saddle
	this.dataWatcher.addObject(21, new String("")); // Dog Name
	this.dataWatcher.addObject(22, new String("")); // Talent Data
	this.dataWatcher.addObject(23, new Integer(Constants.hungerTicks)); // Dog
																		// Hunger
	this.dataWatcher.addObject(24, new String("0:0")); // Level Data
	this.dataWatcher.addObject(INDEX_EVOLVE, Byte.valueOf((byte) 0)); // Evolution
	this.dataWatcher.addObject(26, new Integer(0)); // Obey Others
	this.dataWatcher.addObject(27, new Integer(0)); // Dog Mode
	this.dataWatcher.addObject(28, "-1:-1:-1:-1:-1:-1"); // Dog Coordination
	this.dataWatcher.addObject(INDEX_MOUTH, Integer.valueOf(0)); // Mouth
	this.dataWatcher.addObject(INDEX_BEG, new Byte((byte) 0)); // Begging
}

@Override
public void writeEntityToNBT(NBTTagCompound tagCompound) {
	super.writeEntityToNBT(tagCompound);
	tagCompound.setBoolean("Angry", this.isAngry());
	tagCompound.setByte("CollarColor", (byte) this.getCollarColor().getDyeDamage());
	tagCompound.setBoolean("Saddle", this.isSaddled());
	tagCompound.setBoolean("Evolve", this.hasEvolved());

	tagCompound.setString("version", Constants.version);
	tagCompound.setString("dogName", this.getZertumName());
	tagCompound.setInteger("dogHunger", this.getDogHunger());
	tagCompound.setBoolean("willObey", this.willObeyOthers());
	tagCompound.setBoolean("dogBeg", this.isBegging());

	this.talents.writeTalentsToNBT(tagCompound);
	this.levels.writeTalentsToNBT(tagCompound);
	this.mode.writeToNBT(tagCompound);
	this.coords.writeToNBT(tagCompound);
	TalentHelper.writeToNBT(this, tagCompound);
}

@Override
public void readEntityFromNBT(NBTTagCompound tagCompound) {
	super.readEntityFromNBT(tagCompound);
	this.setAngry(tagCompound.getBoolean("Angry"));
	this.setSaddled(tagCompound.getBoolean("Saddle"));
	this.setEvolved(tagCompound.getBoolean("Evolve"));

	if (tagCompound.hasKey("CollarColor", 99)) {
		this.setCollarColor(EnumDyeColor.byDyeDamage(tagCompound.getByte("CollarColor")));
	}

	String lastVersion = tagCompound.getString("version");
	this.setZertumName(tagCompound.getString("dogName"));
	this.setDogHunger(tagCompound.getInteger("dogHunger"));
	this.setWillObeyOthers(tagCompound.getBoolean("willObey"));
	this.setBegging(tagCompound.getBoolean("dogBeg"));

	this.talents.readTalentsFromNBT(tagCompound);
	this.levels.readTalentsFromNBT(tagCompound);
	this.mode.readFromNBT(tagCompound);
	this.coords.readFromNBT(tagCompound);
	TalentHelper.readFromNBT(this, tagCompound);
}

@Override
protected void playStepSound(BlockPos p_180429_1_, Block p_180429_2_) {
	this.playSound("mob.wolf.step", 0.15F, 1.0F);
}

/**
 * Returns the sound this mob makes while it's alive.
 */
@Override
protected String getLivingSound() {
	this.openMouth();
	String sound = TalentHelper.getLivingSound(this);
	if (!"".equals(sound)) {
		return sound;
	}

	return this.isAngry() ? "mob.wolf.growl" : this.wantToHowl ? Sound.ZertumHowl
			: (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.getHealth() <= 10.0F
					? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
}

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

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

/**
 * Returns the volume for the sounds this mob makes.
 */
@Override
public float getSoundVolume() {
	return 1F;
}

/**
 * Get number of ticks, at least during which the living entity will be
 * silent.
 */
@Override
public int getTalkInterval() {
	if ((Boolean) this.objects.get("canseecreeper") == true) {
		return 40;
	}
	else if (this.wantToHowl) {
		return 150;
	}
	else if (this.getHealth() <= 10) {
		return 20;
	}
	else {
		return 200;
	}
}

/**
 * Returns the item ID for the item the mob drops on death.
 */
@Override
protected void dropFewItems(boolean par1, int par2) {
	rare = rand.nextInt(20);
	{
		if (this.isBurning()) {
			this.dropItem(ModItems.zertumMeatCooked, 1);
		}
		else if (rare <= 12) {
			this.dropItem(ModItems.zertumMeatRaw, 1);
		}
		if (rare <= 6 && !this.isTamed() && !(this instanceof EntityDarkZertum)) {
			this.dropItem(ModItems.nileGrain, 1);
		}
		if (rare <= 6 && !this.isTamed() && (this instanceof EntityDarkZertum)) {
			this.dropItem(ModItems.darkGrain, 1);
		}
		if (this.isSaddled()) {
			this.dropItem(Items.saddle, 1);
		}
		else {

		}

	}
}

/**
 * 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.
 */
@Override
public void onLivingUpdate() // TODO
{
	super.onLivingUpdate();
	if (isServer() && this.isWet && !this.isShaking && !this.hasPath() && this.onGround) {
		this.isShaking = true;
		this.timeWolfIsShaking = 0.0F;
		this.prevTimeWolfIsShaking = 0.0F;
		this.worldObj.setEntityState(this, (byte) ;
	}

	if (Constants.IS_HUNGER_ON) {
		this.prevHungerTick = this.hungerTick;

		if (this.riddenByEntity == null && !this.isSitting()) {
			this.hungerTick += 1;
		}

		this.hungerTick += TalentHelper.onHungerTick(this, this.hungerTick - this.prevHungerTick);

		if (this.hungerTick > 400) {
			this.setDogHunger(this.getDogHunger() - 1);
			this.hungerTick -= 400;
		}
	}

	if (Constants.DEF_HEALING == true && !this.isChild() && this.getHealth() <= 10 && this.isTamed()) {
		this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200));
	}

	if (this.getHealth() != 1) {
		this.prevHealingTick = this.healingTick;
		this.healingTick += this.nourishment();

		if (this.healingTick >= 6000) {
			if (this.getHealth() < this.getMaxHealth()) {
				this.setHealth(this.getHealth() + 1);
			}

			this.healingTick = 0;
		}
	}

	if (this.getDogHunger() == 0 && this.worldObj.getWorldInfo().getWorldTime() % 100L == 0L && this.getHealth() > 1) {
		this.attackEntityFrom(DamageSource.generic, 1);
	}

	if (isServer() && this.getAttackTarget() == null && this.isAngry()) {
		this.setAngry(false);
	}

	if (Constants.DEF_HOWL == true) {
		if (this.isServer()) {
			if (this.worldObj.isDaytime() && this.isChild()) // TODO
			{
				wantToHowl = false;
			}
			else if (!this.isChild()) {
				wantToHowl = true;
			}
		}
	}
	TalentHelper.onLivingUpdate(this);
}

/**
 * Called to update the entity's position/logic.
 */
@Override
public void onUpdate() {
	super.onUpdate();
	this.prevTimeDogBegging = this.timeDogBegging;

	if (this.isBegging()) {
		this.timeDogBegging += (1.0F - this.timeDogBegging) * 0.4F;
	}
	else {
		this.timeDogBegging += (0.0F - this.timeDogBegging) * 0.4F;
	}

	if (this.openMouthCounter > 0 && ++this.openMouthCounter > 30) {
		this.openMouthCounter = 0;
		this.setHorseWatchableBoolean(128, false);
	}

	this.prevMouthOpenness = this.mouthOpenness;

	if (this.getHorseWatchableBoolean(128)) {
		this.mouthOpenness += (1.0F - this.mouthOpenness) * 0.7F + 0.05F;

		if (this.mouthOpenness > 1.0F) {
			this.mouthOpenness = 1.0F;
		}
	}
	else {
		this.mouthOpenness += (0.0F - this.mouthOpenness) * 0.7F - 0.05F;

		if (this.mouthOpenness < 0.0F) {
			this.mouthOpenness = 0.0F;
		}
	}
	this.headRotationCourseOld = this.headRotationCourse;

	if (this.func_70922_bv()) {
		this.headRotationCourse += (1.0F - this.headRotationCourse) * 0.4F;
	}
	else {
		this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F;
	}

	if (this.isWet()) {
		this.isWet = true;
		this.isShaking = false;
		this.timeWolfIsShaking = 0.0F;
		this.prevTimeWolfIsShaking = 0.0F;
	}
	else if ((this.isWet || this.isShaking) && this.isShaking) {
		if (this.timeWolfIsShaking == 0.0F) {
			this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
		}

		this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
		this.timeWolfIsShaking += 0.05F;

		if (this.prevTimeWolfIsShaking >= 2.0F) {
			if (this.rand.nextInt(15) < this.talents.getLevel("fishing") * 2) {
				if (this.rand.nextInt(15) < this.talents.getLevel("flamingelemental") * 2 && this instanceof EntityRedZertum) {
					if (isServer()) {
						dropItem(Items.cooked_fish, 1);
					}
				}
				else {
					if (isServer()) {
						dropItem(Items.fish, 1);
					}
				}
			}
			this.isWet = false;
			this.isShaking = false;
			this.prevTimeWolfIsShaking = 0.0F;
			this.timeWolfIsShaking = 0.0F;
		}

		if (this.timeWolfIsShaking > 0.4F) {
			float f = (float) this.getEntityBoundingBox().minY;
			int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F);

			for (int j = 0; j < i; ++j) {
				float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
				float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
				this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX + f1, f + 0.8F, this.posZ + f2, this.motionX, this.motionY, this.motionZ, new int[0]);
			}
		}
	}

	if (this.rand.nextInt(200) == 0 && this.hasEvolved()) {
		this.hiyaMaster = true;
	}

	if (((this.isBegging()) || (this.hiyaMaster)) && (!this.isWolfHappy) && this.hasEvolved()) {
		this.isWolfHappy = true;
		this.timeWolfIsHappy = 0.0F;
		this.prevTimeWolfIsHappy = 0.0F;
	}
	else {
		hiyaMaster = false;
	}
	if (this.isWolfHappy) {
		if (this.timeWolfIsHappy % 1.0F == 0.0F) {
			if (!(this instanceof EntityMetalZertum)) {
				this.openMouth();
				this.worldObj.playSoundAtEntity(this, "mob.wolf.panting", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
			}
			else if (this instanceof EntityMetalZertum) {
				this.openMouth();
				this.worldObj.playSoundAtEntity(this, Sound.MetalZertumPant, this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
			}
		}
		this.prevTimeWolfIsHappy = this.timeWolfIsHappy;
		this.timeWolfIsHappy += 0.05F;
		if (this.prevTimeWolfIsHappy >= 8.0F) {
			this.isWolfHappy = false;
			this.prevTimeWolfIsHappy = 0.0F;
			this.timeWolfIsHappy = 0.0F;
		}
	}

	if (this.isTamed()) {
		EntityPlayer player = (EntityPlayer) this.getOwner();

		if (player != null) {
			float distanceToOwner = player.getDistanceToEntity(this);

			if (distanceToOwner <= 2F && this.hasToy()) {
				if (isServer()) {
					this.entityDropItem(new ItemStack(ModItems.toy, 1, 1), 0.0F);
				}
				this.setHasToy(false);
			}
		}
	}
	TalentHelper.onUpdate(this);
}

public float getWagAngle(float f, float f1) {
	float f2 = (this.prevTimeWolfIsHappy + (this.timeWolfIsHappy - this.prevTimeWolfIsHappy) * f + f1) / 2.0F;
	if (f2 < 0.0F) {
		f2 = 0.0F;
	}
	else if (f2 > 2.0F) {
		f2 %= 2.0F;
	}
	return MathHelper.sin(f2 * (float) Math.PI * 11.0F) * 0.3F * (float) Math.PI;
}

@Override
public void moveEntityWithHeading(float strafe, float forward) {
	if (this.riddenByEntity instanceof EntityPlayer) {
		this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
		this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
		this.setRotation(this.rotationYaw, this.rotationPitch);
		this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
		strafe = ((EntityPlayer) this.riddenByEntity).moveStrafing * 0.5F;
		forward = ((EntityPlayer) this.riddenByEntity).moveForward;

		if (forward <= 0.0F) {
			forward *= 0.25F;
		}

		if (this.onGround) {
			if (forward > 0.0F) {
				float f2 = MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F);
				float f3 = MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F);
				this.motionX += -0.4F * f2 * 0.15F; // May change
				this.motionZ += 0.4F * f3 * 0.15F;
			}
		}

		this.stepHeight = 1.0F;
		this.jumpMovementFactor = this.getAIMoveSpeed() * 0.2F;

		if (isServer()) {
			this.setAIMoveSpeed((float) this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() / 4);
			super.moveEntityWithHeading(strafe, forward);
		}

		if (this.onGround) {
			// this.jumpPower = 0.0F;
			// this.setHorseJumping(false);
		}

		this.prevLimbSwingAmount = this.limbSwingAmount;
		double d0 = this.posX - this.prevPosX;
		double d1 = this.posZ - this.prevPosZ;
		float f4 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F;

		if (f4 > 1.0F) {
			f4 = 1.0F;
		}

		this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
		this.limbSwing += this.limbSwingAmount;
	}
	else {
		this.stepHeight = 0.5F;
		this.jumpMovementFactor = 0.02F;
		super.moveEntityWithHeading(strafe, forward);
	}
}

@Override
public float getAIMoveSpeed() { // TODO
	double speed = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
	speed += TalentHelper.addToMoveSpeed(this);

	if ((!(this.getAttackTarget() instanceof EntityZertumEntity) && !(this.getAttackTarget() instanceof EntityPlayer)) || this.riddenByEntity instanceof EntityPlayer) {
		if (this.levels.getLevel() == Constants.maxLevel && this.hasEvolved()) {
			speed += 0.4D;
		}
		else if (this.hasEvolved() && this.levels.getLevel() != Constants.maxLevel) {
			speed += 0.4D;
		}
	}

	if (this.riddenByEntity instanceof EntityPlayer) {
		speed /= 4;
	}

	return (float) speed;
}

public float getAIAttackDamage() {
	double damage = this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
	damage += TalentHelper.addToAttackDamage(this);

	if ((!(this.getAttackTarget() instanceof EntityZertumEntity) && !(this.getAttackTarget() instanceof EntityPlayer))) {
		if (this.levels.getLevel() == Constants.maxLevel && this.hasEvolved()) {
			damage += 2.0D;
		}
		else if (this.hasEvolved() && this.levels.getLevel() != Constants.maxLevel) {
			damage += 2.0D;
		}
	}
	return (float) damage;
}

@Override
public void fall(float distance, float damageMultiplier) {
	if (distance > 1.0F) {
		this.playSound("game.neutral.hurt.fall.small", 0.4F, 1.0F);
	}

	int i = MathHelper.ceiling_float_int(((distance * 0.5F - 3.0F) - TalentHelper.fallProtection(this)) * damageMultiplier);

	if (i > 0 && !TalentHelper.isImmuneToFalls(this)) {
		this.attackEntityFrom(DamageSource.fall, i);

		if (this.riddenByEntity != null) {
			this.riddenByEntity.attackEntityFrom(DamageSource.fall, i);
		}

		Block block = this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.2D - this.prevRotationYaw, this.posZ)).getBlock();

		if (block.getMaterial() != Material.air && !this.isSilent()) {
			Block.SoundType soundtype = block.stepSound;
			this.worldObj.playSoundAtEntity(this, soundtype.getStepSound(), soundtype.getVolume() * 0.5F, soundtype.getFrequency() * 0.75F);
		}
	}
}

@SideOnly(Side.CLIENT)
public boolean isWolfWet() {
	return this.isWet;
}

@SideOnly(Side.CLIENT)
public float getShadingWhileWet(float p_70915_1_) {
	return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F;
}

@SideOnly(Side.CLIENT)
public float getShakeAngle(float p_70923_1_, float p_70923_2_) {
	float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F;

	if (f2 < 0.0F) {
		f2 = 0.0F;
	}
	else if (f2 > 1.0F) {
		f2 = 1.0F;
	}

	return MathHelper.sin(f2 * (float) Math.PI) * MathHelper.sin(f2 * (float) Math.PI * 11.0F) * 0.15F * (float) Math.PI;
}

@SideOnly(Side.CLIENT)
public float getInterestedAngle(float partialTickTime) {
	return (this.prevTimeDogBegging + (this.timeDogBegging - this.prevTimeDogBegging) * partialTickTime) * 0.15F * (float) Math.PI;
}

@Override
public float getEyeHeight() {
	return this.height * 0.8F;
}

@Override
public int getVerticalFaceSpeed() {
	return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
}

@Override
public boolean attackEntityFrom(DamageSource damageSource, float damage) {
	if (this.isEntityInvulnerable(damageSource)) {
		return false;
	}
	else {
		if (!TalentHelper.attackEntityFrom(this, damageSource, damage)) {
			return false;
		}

		Entity entity = damageSource.getEntity();
		this.aiSit.setSitting(false);

		if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) {
			damage = (damage + 1.0F) / 2.0F;
		}

		return super.attackEntityFrom(damageSource, damage);
	}
}

@Override
public boolean attackEntityAsMob(Entity entity) { // TODO
	if (!TalentHelper.shouldDamageMob(this, entity)) {
		return false;
	}

	int damage = (int) (4 + (this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getBaseValue()) / 2);
	damage = TalentHelper.attackEntityAsMob(this, entity, damage);

	if (entity instanceof EntityZombie) {
		((EntityZombie) entity).setAttackTarget(this);
	}

	return entity.attackEntityFrom(DamageSource.causeMobDamage(this), damage);
}

/**
 * Called when the mob's health reaches 0.
 */
@Override
public void onDeath(DamageSource par1DamageSource) {
	super.onDeath(par1DamageSource);

	if (par1DamageSource.getEntity() instanceof EntityPlayer) {
		EntityPlayer entityplayer = (EntityPlayer) par1DamageSource.getEntity();
		{
			entityplayer.triggerAchievement(ModAchievements.ZertKill);
			this.dropChestItems();

		}
	}
}

@Override
protected boolean isMovementBlocked() {
	return this.isPlayerSleeping() || this.ridingEntity != null || this.riddenByEntity instanceof EntityPlayer || super.isMovementBlocked();
}

@Override
public double getYOffset() {
	return this.ridingEntity instanceof EntityPlayer ? 0.5D : 0.0D;
}

@Override
public boolean isPotionApplicable(PotionEffect potionEffect) {
	if (this.getHealth() <= 1) {
		return false;
	}

	if (!TalentHelper.isPostionApplicable(this, potionEffect)) {
		return false;
	}

	return true;
}

@Override
public void setFire(int amount) {
	if (TalentHelper.setFire(this, amount)) {
		super.setFire(amount);
	}
}

public int foodValue(ItemStack stack) {
	if (stack == null || stack.getItem() == null) {
		return 0;
	}

	int foodValue = 0;

	Item item = stack.getItem();

	if (stack.getItem() != Items.rotten_flesh && item instanceof ItemFood) {
		ItemFood itemfood = (ItemFood) item;

		if (itemfood.isWolfsFavoriteMeat()) {
			foodValue = 40;
		}
	}

	foodValue = TalentHelper.changeFoodValue(this, stack, foodValue);

	return foodValue;
}

public int masterOrder() { // TODO
	int order = 0;
	EntityPlayer player = (EntityPlayer) this.getOwner();

	if (player != null) {

		float distanceAway = player.getDistanceToEntity(this);
		ItemStack itemstack = player.inventory.getCurrentItem();

		if (itemstack != null && (itemstack.getItem() instanceof ItemTool) && distanceAway <= 20F) {
			order = 1;
		}

		if (itemstack != null && ((itemstack.getItem() instanceof ItemSword) || (itemstack.getItem() instanceof ItemBow))) {
			order = 2;
		}

		if (itemstack != null && itemstack.getItem() == Items.wheat) {
			order = 3;
		}

		if (itemstack != null && itemstack.getItem() == Items.bone) {
			order = 4;
		}
	}

	return order;
}

@Override
public boolean canBreatheUnderwater() {
	return TalentHelper.canBreatheUnderwater(this);
}

@Override
public boolean canInteract(EntityPlayer player) {
	return this.isOwner(player) || this.willObeyOthers();
}

public int nourishment() {
	int amount = 0;

	if (this.getDogHunger() > 0) {
		amount = 40 + 4 * (this.effectiveLevel() + 1);

		if (isSitting() && this.talents.getLevel("rapidregen") == 5) {
			amount += 20 + 2 * (this.effectiveLevel() + 1);
		}

		if (!this.isSitting()) {
			amount *= 5 + this.talents.getLevel("rapidregen");
			amount /= 10;
		}
	}

	return amount;
}

public int effectiveLevel() { // TODO
	return (this.levels.getLevel()) / 10;
}

public String getZertumName() {
	return this.dataWatcher.getWatchableObjectString(21);
}

public void setZertumName(String var1) {
	this.dataWatcher.updateObject(21, var1);
}

public void setWillObeyOthers(boolean flag) {
	this.dataWatcher.updateObject(26, flag ? 1 : 0);
}

public boolean willObeyOthers() {
	return this.dataWatcher.getWatchableObjectInt(26) != 0;
}

public int points() {
	return this.levels.getLevel() + (this.getGrowingAge() < 0 ? 0 : 20);
}

public int spendablePoints() {
	return this.points() - this.usedPoints();
}

public int usedPoints() {
	return TalentHelper.getUsedPoints(this);
}

public int deductive(int level) {
	byte byte0 = 0;
	switch (level) {
		case 1:
			return 1;
		case 2:
			return 3;
		case 3:
			return 5;
		case 4:
			return 7;
		case 5:
			return 9;
		default:
			return 0;
	}
}

public int getDogHunger() {
	return this.dataWatcher.getWatchableObjectInt(23);
}

public void setDogHunger(int par1) {
	this.dataWatcher.updateObject(23, MathHelper.clamp_int(par1, 0, Constants.hungerTicks));
}

@Override
public boolean func_142018_a(EntityLivingBase entityToAttack, EntityLivingBase owner) {
	if (TalentHelper.canAttackEntity(this, entityToAttack)) {
		return true;
	}

	if (!(entityToAttack instanceof EntityCreeper) && !(entityToAttack instanceof EntityGhast)) {
		if (entityToAttack instanceof EntityZertumEntity) {
			EntityZertumEntity entityZertum = (EntityZertumEntity) entityToAttack;

			if (entityZertum.isTamed() && entityZertum.getOwner() == owner) {
				return false;
			}
		}

		return entityToAttack instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) entityToAttack)
				? false
				: !(entityToAttack instanceof EntityHorse) || !((EntityHorse) entityToAttack).isTame();
	}
	else {
		return false;
	}
}

@Override
public boolean canAttackClass(Class p_70686_1_) {
	if (TalentHelper.canAttackClass(this, p_70686_1_)) {
		return true;
	}

	return super.canAttackClass(p_70686_1_);
}

public void setHasToy(boolean hasBone) {
	this.hasToy = hasBone;
}

public boolean hasToy() {
	return this.hasToy;
}

/**
 * Gets the pitch of living sounds in living entities.
 */
@Override
public float getPitch() {
	if (!this.isChild()) {
		return super.getSoundPitch();
	}
	else {
		return super.getSoundPitch() * 1;
	}
}

@Override
@SideOnly(Side.CLIENT)
public void handleHealthUpdate(byte p_70103_1_) {
	if (p_70103_1_ ==  {
		this.isShaking = true;
		this.timeWolfIsShaking = 0.0F;
		this.prevTimeWolfIsShaking = 0.0F;
	}
	else {
		super.handleHealthUpdate(p_70103_1_);
	}
}

/**
 * Checks if the parameter is an item which this animal can be fed to breed
 * it (wheat, carrots or seeds depending on the animal type)
 */
@Override
public boolean isBreedingItem(ItemStack itemstack) {
	return itemstack == null ? false : itemstack.getItem() == ModItems.dogTreat;
}

@Override
public int getMaxSpawnedInChunk() {
	return 8;
}

public boolean isAngry() {
	return (this.dataWatcher.getWatchableObjectByte(INDEX_TAME) & 2) != 0;
}

public void setAngry(boolean p_70916_1_) {
	byte b0 = this.dataWatcher.getWatchableObjectByte(INDEX_TAME);

	if (p_70916_1_) {
		this.dataWatcher.updateObject(INDEX_TAME, Byte.valueOf((byte) (b0 | 2)));
	}
	else {
		this.dataWatcher.updateObject(INDEX_TAME, Byte.valueOf((byte) (b0 & -3)));
	}
}

public EnumDyeColor getCollarColor() {
	return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectByte(INDEX_COLLAR) & 15);
}

public void setCollarColor(EnumDyeColor collarcolor) {
	this.dataWatcher.updateObject(INDEX_COLLAR, Byte.valueOf((byte) (collarcolor.getDyeDamage() & 15)));
}

public boolean isSaddled() {
	return (this.dataWatcher.getWatchableObjectByte(INDEX_SADDLE) & 1) != 0;
}

public void setSaddled(boolean p_70900_1_) {
	if (p_70900_1_) {
		this.dataWatcher.updateObject(INDEX_SADDLE, Byte.valueOf((byte) 1));
	}
	else {
		this.dataWatcher.updateObject(INDEX_SADDLE, Byte.valueOf((byte) 0));
	}
}

private boolean getHorseWatchableBoolean(int p_110233_1_) {
	return (this.dataWatcher.getWatchableObjectInt(INDEX_MOUTH) & p_110233_1_) != 0;
}

private void setHorseWatchableBoolean(int p_110208_1_, boolean p_110208_2_) {
	int j = this.dataWatcher.getWatchableObjectInt(INDEX_MOUTH);

	if (p_110208_2_) {
		this.dataWatcher.updateObject(INDEX_MOUTH, Integer.valueOf(j | p_110208_1_));
	}
	else {
		this.dataWatcher.updateObject(INDEX_MOUTH, Integer.valueOf(j & ~p_110208_1_));
	}
}

@SideOnly(Side.CLIENT)
public float func_110201_q(float p_110201_1_) {
	return this.prevMouthOpenness + (this.mouthOpenness - this.prevMouthOpenness) * p_110201_1_;
}

public void openMouth() {
	if (isServer()) {
		this.openMouthCounter = 1;
		this.setHorseWatchableBoolean(128, true);
	}
}

/**
 * Determines if an entity can be despawned, used on idle far away entities
 */
@Override
protected boolean canDespawn() {
	return !this.isTamed() && this.ticksExisted > 2400;
}

@Override
public boolean allowLeashing() {
	return !this.isAngry() && super.allowLeashing();
}

public void setBegging(boolean flag) {
	this.dataWatcher.updateObject(INDEX_BEG, Byte.valueOf((byte) (flag ? 1 : 0)));
}

public boolean isBegging() {
	return this.dataWatcher.getWatchableObjectByte(INDEX_BEG) == 1;
}

public boolean hasEvolved() // TODO
{
	return (this.dataWatcher.getWatchableObjectByte(INDEX_EVOLVE) & 1) != 0;
}

public void evolveBoolean(boolean p_70900_1_) {
	if (p_70900_1_) {
		this.dataWatcher.updateObject(INDEX_EVOLVE, Byte.valueOf((byte) 1));
	}
	else {
		this.dataWatcher.updateObject(INDEX_EVOLVE, Byte.valueOf((byte) 0));
	}
}

public void setEvolved(boolean p_70900_1_) {
	this.evolveBoolean(p_70900_1_);
	if (p_70900_1_) {
		if (!this.isChild() && !this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.tamedHealth() + this.effectiveLevel());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.tamedDamage());
		}
		else if (!this.isChild() && this.hasEvolved()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.evoHealth());
		}
		else {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
	else {
		if (this.isChild()) {
			this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.babyHealth());
			this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.babyDamage());
		}
	}
}

public void evolveOnClient(EntityPlayer player) {
	this.setEvolved(true);
	this.worldObj.playBroadcastSound(1013, new BlockPos(this), 0);
	player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + this.getZertumName() + " has been evolved!"));
}

public void evolveOnServer(EntityZertumEntity entity, EntityPlayer player) {
	entity.setEvolved(true);
	entity.worldObj.playBroadcastSound(1013, new BlockPos(entity), 0);
	player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + entity.getZertumName() + " has been evolved!"));
}
}

First, you should make the entity save and load the UUID of the owner.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

How do I do so exactly? There's already something that Minecraft has that relates with the UUID

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted
  On 5/11/2015 at 11:34 PM, NovaViper said:

How do I do so exactly? There's already something that Minecraft has that relates with the UUID

Ernio already told you how to do that..

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted
  On 5/12/2015 at 1:12 AM, NovaViper said:

I'm talking about saving and loading the UUID

We've already explained that several times... please read every response again. Everything you need has been explained, both here and in the vanilla code.

 

And why are you still fixated on the UUID? That's taken care of by EntityTameable, aren't you trying to save / load a String for the nickname?

Posted

I DID read them all.. I'm still confused on how to actually do it without screwing with the vanilla coding

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted
  On 5/12/2015 at 1:27 AM, NovaViper said:

I DID read them all.. I'm still confused on how to actually do it without screwing with the vanilla coding

What? How could you possibly screw with the vanilla coding? It's super simple:

 

1. EntityTameable already handles the owner for you, so you don't need to do anything there.

2. Player's username is a STRING

3. NBT natively supports reading and writing Strings: nbt.writeString("nickname", player's username);

4. Want it on the client for rendering? DataWatcher ALSO supports String by default, just add it and be done.

 

Sorry, but this topic has gone on way too long for something so blatantly simple.

 

It looks like there is a lot of other stuff going on in your Entity, so perhaps you'd be better off by creating a SIMPLE entity that does nothing but handle the nickname stuff. Then you can get just that working without worrying about anything else, figure out exactly what you need, and go from there.

Posted

*Facepalm* I can't believe I didn't think it all the way through.. but I have actually gotten close to the solution, I did exactly what you guys said and got it save (I think) the id and name of the owner, then leave and come back as a new player, open the gui (with no crashes, yay) but now the gui says "()" instead of the previous owner name.

 

IDs

	public static final int ownerName = 13;
public static final int ownerID = 14;

 

EntityInt

		this.dataWatcher.addObject(DataValues.ownerName, new String("")); //Owner Name
	this.dataWatcher.addObject(DataValues.ownerID, new String("")); //Owner Id

 

writeEntityToNBT

		tagCompound.setString("ownerId", this.getOwnerID());
	tagCompound.setString("ownerName", this.getOwnerName());

 

readEntityFromNBT

		if (tagCompound.hasKey("ownerName", ) {
		this.saveOwnerName(tagCompound.getString("ownerName"));
	}

	if (tagCompound.hasKey("ownerId", ) {
		this.saveOwnerID(tagCompound.getString("ownerId"));
	}

 

Methods

	public String getOwnerName() {
	return this.dataWatcher.getWatchableObjectString(DataValues.ownerName);
}

public void saveOwnerName(String name) {
	this.dataWatcher.updateObject(DataValues.ownerName, name);
}

public String getOwnerID() {
	return this.dataWatcher.getWatchableObjectString(DataValues.ownerID);
}

public void saveOwnerID(String id) {
	this.dataWatcher.updateObject(DataValues.ownerID, id);
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Here ya go

 

package common.zeroquest.client.gui;

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;

import org.apache.commons.lang3.StringUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import common.zeroquest.api.interfaces.ITalent;
import common.zeroquest.api.registry.TalentRegistry;
import common.zeroquest.entity.util.ModeUtil.EnumMode;
import common.zeroquest.entity.zertum.EntityZertumEntity;
import common.zeroquest.lib.Constants;
import common.zeroquest.network.PacketHandler;
import common.zeroquest.network.imessage.ZertumMode;
import common.zeroquest.network.imessage.ZertumName;
import common.zeroquest.network.imessage.ZertumObey;
import common.zeroquest.network.imessage.ZertumTalents;

/**
* @author ProPercivalalb
*/
public class GuiDogInfo extends GuiScreen {

public EntityZertumEntity dog;
public EntityPlayer player;
private ScaledResolution resolution;
private final List<GuiTextField> textfieldList = new ArrayList<GuiTextField>();
private GuiTextField nameTextField;
private int currentPage = 0;
private int maxPages = 1;
public int btnPerPages = 0;
private final DecimalFormat dfShort = new DecimalFormat("0.00");

public GuiDogInfo(EntityZertumEntity dog, EntityPlayer player) {
	this.dog = dog;
	this.player = player;
}

@Override
public void initGui() {
	super.initGui();
	this.buttonList.clear();
	this.labelList.clear();
	this.textfieldList.clear();
	this.resolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
	Keyboard.enableRepeatEvents(true);
	int topX = this.width / 2;
	int topY = this.height / 2;
	GuiTextField nameTextField = new GuiTextField(0, this.fontRendererObj, topX - 100, topY + 50, 200, 20) {
		@Override
		public boolean textboxKeyTyped(char character, int keyId) {
			boolean typed = super.textboxKeyTyped(character, keyId);
			if (typed) {
				PacketHandler.sendToServer(new ZertumName(dog.getEntityId(), this.getText()));
			}
			return typed;
		}
	};
	nameTextField.setFocused(false);
	nameTextField.setMaxStringLength(32);
	nameTextField.setText(this.dog.getPetName());
	this.nameTextField = nameTextField;

	this.textfieldList.add(nameTextField);

	int size = TalentRegistry.getTalents().size();

	int temp = 0;
	while ((temp + 2) * 21 + 10 < this.resolution.getScaledHeight()) {
		temp += 1;
	}

	this.btnPerPages = temp;

	if (temp < size) {
		this.buttonList.add(new GuiButton(-1, 25, temp * 21 + 10, 20, 20, "<"));
		this.buttonList.add(new GuiButton(-2, 48, temp * 21 + 10, 20, 20, ">"));
	}

	if (this.btnPerPages < 1) {
		this.btnPerPages = 1;
	}

	this.maxPages = (int) Math.ceil((double) TalentRegistry.getTalents().size() / (double) this.btnPerPages);

	if (this.currentPage >= this.maxPages) {
		this.currentPage = 0;
	}

	for (int i = 0; i < this.btnPerPages; ++i) {
		if ((this.currentPage * this.btnPerPages + i) >= TalentRegistry.getTalents().size()) {
			continue;
		}
		this.buttonList.add(new GuiButton(1 + this.currentPage * this.btnPerPages + i, 25, 10 + i * 21, 20, 20, "+"));
	}
	if (this.dog.isOwner(this.player)) {
		this.buttonList.add(new GuiButton(-5, this.width - 64, topY + 65, 42, 20, String.valueOf(this.dog.willObeyOthers())));
	}

	this.buttonList.add(new GuiButton(-6, topX + 40, topY + 25, 60, 20, this.dog.mode.getMode().modeName()));
}

@Override
public void drawScreen(int xMouse, int yMouse, float partialTickTime) {
	this.drawDefaultBackground();
	// Background
	int topX = this.width / 2;
	int topY = this.height / 2;
	String health = dfShort.format(this.dog.getHealth());
	String healthMax = dfShort.format(this.dog.getMaxHealth());
	String healthRel = dfShort.format(this.dog.getHealthRelative() * 100);
	String healthState = health + "/" + healthMax + "(" + healthRel + "%)";
	String damageValue = dfShort.format(this.dog.getAIAttackDamage());
	String damageState = damageValue;
	String speedValue = dfShort.format(this.dog.getAIMoveSpeed());
	String speedState = speedValue;

	String tamedString = null;
	if (this.dog.isTamed()) {
		if (this.dog.getOwnerName() == this.player.getName()) {
			tamedString = "Yes (You)";
		}
		else {
			tamedString = "Yes (" + StringUtils.abbreviate(this.dog.getOwnerName(), 22) + ")";
		}
	}

	String evoString = null;
	if (!this.dog.hasEvolved() && !this.dog.isChild() && this.dog.levels.getLevel() < Constants.maxLevel) {
		evoString = "Not at Alpha Level!";
	}
	else if (!this.dog.hasEvolved() && this.dog.isChild() && this.dog.levels.getLevel() < Constants.maxLevel) {
		evoString = "Too Young!";
	}
	else if (!this.dog.hasEvolved() && !this.dog.isChild() && this.dog.levels.getLevel() >= Constants.maxLevel) {
		evoString = "Ready!";
	}
	else if (this.dog.hasEvolved() && !this.dog.isChild()) {
		evoString = "Already Evolved!";
	}

	this.fontRendererObj.drawString("New name:", topX - 100, topY + 38, 4210752);
	this.fontRendererObj.drawString("Level: " + this.dog.levels.getLevel(), topX - 75, topY + 75, 0xFF10F9);
	this.fontRendererObj.drawString("Points Left: " + this.dog.spendablePoints(), topX, topY + 75, 0xFFFFFF);
	this.fontRendererObj.drawString("Health: " + healthState, topX + 190, topY - 170, 0xFFFFFF);
	this.fontRendererObj.drawString("Damage: " + damageState, topX + 190, topY - 160, 0xFFFFFF);
	this.fontRendererObj.drawString("Speed: " + speedState, topX + 190, topY - 150, 0xFFFFFF);
	this.fontRendererObj.drawString("Tamed: " + tamedString, topX + 190, topY - 140, 0xFFFFFF);
	this.fontRendererObj.drawString("State: " + evoString, topX + 190, topY - 130, 0xFFFFFF);
	if (this.dog.isOwner(this.player)) {
		this.fontRendererObj.drawString("Obey Others?", this.width - 76, topY + 55, 0xFFFFFF);
	}

	for (int i = 0; i < this.btnPerPages; ++i) {
		if ((this.currentPage * this.btnPerPages + i) >= TalentRegistry.getTalents().size()) {
			continue;
		}
		this.fontRendererObj.drawString(TalentRegistry.getTalent(this.currentPage * this.btnPerPages + i).getLocalisedName(), 50, 17 + i * 21, 0xFFFFFF);
	}

	for (GuiTextField field : this.textfieldList) {
		field.drawTextBox();
	}
	GL11.glDisable(GL12.GL_RESCALE_NORMAL);
	RenderHelper.disableStandardItemLighting();
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	super.drawScreen(xMouse, yMouse, partialTickTime);
	RenderHelper.enableGUIStandardItemLighting();

	// Foreground

	GL11.glPushMatrix();
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	for (int k = 0; k < this.buttonList.size(); ++k) {
		GuiButton button = (GuiButton) this.buttonList.get(k);
		if (button.mousePressed(this.mc, xMouse, yMouse)) {
			List list = new ArrayList();
			if (button.id >= 1 && button.id <= TalentRegistry.getTalents().size()) {
				ITalent talent = TalentRegistry.getTalent(button.id - 1);

				list.add(EnumChatFormatting.GREEN + talent.getLocalisedName());
				list.add("Level: " + this.dog.talents.getLevel(talent));
				list.add(EnumChatFormatting.GRAY + "--------------------------------");
				list.addAll(this.splitInto(talent.getLocalisedInfo(), 200, this.mc.fontRendererObj));
			}
			else if (button.id == -1) {
				list.add(EnumChatFormatting.ITALIC + "Previous Page");
			}
			else if (button.id == -2) {
				list.add(EnumChatFormatting.ITALIC + "Next Page");
			}
			else if (button.id == -6) {
				String str = StatCollector.translateToLocal("modeinfo." + button.displayString.toLowerCase());
				list.addAll(splitInto(str, 150, this.mc.fontRendererObj));
			}

			this.drawHoveringText(list, xMouse, yMouse, this.mc.fontRendererObj);
		}
	}
	GL11.glPopMatrix();
}

@Override
protected void actionPerformed(GuiButton button) {

	if (button.id >= 1 && button.id <= TalentRegistry.getTalents().size()) {
		ITalent talent = TalentRegistry.getTalent(button.id - 1);
		int level = this.dog.talents.getLevel(talent);

		if (level < talent.getHighestLevel(this.dog) && this.dog.spendablePoints() >= talent.getCost(this.dog, level + 1)) {
			PacketHandler.sendToServer(new ZertumTalents(this.dog.getEntityId(), TalentRegistry.getTalent(button.id - 1).getKey()));
		}

	}
	else if (button.id == -1) {
		if (this.currentPage > 0) {
			this.currentPage -= 1;
			this.initGui();
		}
	}
	else if (button.id == -2) {
		if (this.currentPage + 1 < this.maxPages) {
			this.currentPage += 1;
			this.initGui();
		}
	}
	if (button.id == -5) {
		if (!this.dog.willObeyOthers()) {
			button.displayString = "true";
			PacketHandler.sendToServer(new ZertumObey(this.dog.getEntityId(), true));

		}
		else {
			button.displayString = "false";
			PacketHandler.sendToServer(new ZertumObey(this.dog.getEntityId(), false));
		}
	}

	if (button.id == -6) {
		int newMode = (dog.mode.getMode().ordinal() + 1) % EnumMode.values().length;
		EnumMode mode = EnumMode.values()[newMode];
		button.displayString = mode.modeName();
		PacketHandler.sendToServer(new ZertumMode(this.dog.getEntityId(), newMode));
	}
}

@Override
public void updateScreen() {
	for (GuiTextField field : this.textfieldList) {
		field.updateCursorCounter();
	}
}

@Override
public void mouseClicked(int xMouse, int yMouse, int mouseButton) throws IOException {
	super.mouseClicked(xMouse, yMouse, mouseButton);
	for (GuiTextField field : this.textfieldList) {
		field.mouseClicked(xMouse, yMouse, mouseButton);
	}
}

@Override
public void keyTyped(char character, int keyId) {
	for (GuiTextField field : this.textfieldList) {
		field.textboxKeyTyped(character, keyId);
	}

	if (keyId == Keyboard.KEY_ESCAPE) {
		this.mc.thePlayer.closeScreen();
	}
}

@Override
public void onGuiClosed() {
	Keyboard.enableRepeatEvents(false);
}

@Override
public boolean doesGuiPauseGame() {
	return false;
}

public List splitInto(String text, int maxLength, FontRenderer font) {
	List list = new ArrayList();

	String temp = "";
	String[] split = text.split(" ");

	for (int i = 0; i < split.length; ++i) {
		String str = split[i];
		int length = font.getStringWidth(temp + str);

		if (length > maxLength) {
			list.add(temp);
			temp = "";
		}

		temp += str + " ";

		if (i == split.length - 1) {
			list.add(temp);
		}
	}

	return list;
}
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Hm. Well, first step is to debug by printing out the values of the owner name and ID when loaded from NBT.

 

Also, you should be aware that using '==' operator to compare Strings is not generally a good idea, as it compares identity, not content. You should use 'equals' method instead:

if (this.dog.getOwnerName().equals(this.player.getName())) {
// player viewing GUI has the same name as the owner of the dog
}

Furthermore, shouldn't you be using player.getDisplayNameString() instead of getName() ? That's the method that returns the nickname, if I'm not mistaken. Though it looks like getName() returns the GameProfile name... Dunno.

Posted

I fixed it, I was using a command I created and it didn't have the save methods for the Zertums. And it all works! Thanks for all of your help guys!

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

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




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Exclusive Temu Coupon [acu729640] 40% Off For New Customers Ultimate Savings with Temu Coupon Code (acu729640): August 2025 Mega Guide With unbeatable pricing, fast global delivery, and an ever-growing collection of trending items, Temu is redefining online shopping in 2025. If you're a first-time shopper, you're in for a treat with the exclusive Temu coupon code (acu729640). This August 2025, Temu is offering up to get an extra 40% discount, a $100 coupon bundle, and free gifts using this special code. Why Temu Is Winning Global Shoppers in 2025 Temu is currently one of the fastest-growing e-commerce platforms in the world. Operating in over 67 countries—including the U.S., Canada, Brazil, the UK, and Australia—Temu combines affordability, high product quality, and rapid delivery. According to recent reports, more than 20 million active users browse Temu every month, enjoying savings that range from 20% to as much as 40%. What Sets Temu Apart in August 2025 Live Deal Roulette: A gamified shopping feature that lets you spin daily for surprise deals unlocked only through codes like (acu729640). Gift Vault Access: Use your Temu first-time user coupon to reveal exclusive hidden products priced at $0. Real-Time Price Drops: Get instant alerts on wishlist items with sudden markdowns—and stack them with Temu coupon code (acu729640). Green Picks: Shop eco-friendly bundles and save up to 60% on sustainable goods. August 2025 Exclusive: Temu Coupon Code (acu729640) As part of the Temu new offers in August 2025, new and returning customers can unlock major savings using the exclusive Temu coupon code (acu729640). Here’s what it offers: Temu coupon code (acu729640) $100 off for new users – Instantly save $100 on your first order. Temu coupon code (acu729640) $100 off for existing users – Loyal customers can enjoy continued savings. Temu coupon code (acu729640) 40% off – Additional discount stackable with sale items. Temu $100 coupon bundle – Apply to multiple categories like fashion, electronics, and home decor. Temu first-time user coupon – Unlock free gifts and access exclusive flash deals. Using the code acu729640, I scored a $129 air fryer for just under $30—you can too. What Makes Temu Coupons So Valuable in August 2025 Temu coupons aren’t just discount codes—they’re a passport to smarter, more affordable shopping. No matter where you live, the Temu promo code (acu729640) slashes prices significantly. Up to 40% off trending items in fashion, tech, home, and lifestyle Free shipping across 67 countries $100 instant discount for both new and existing users Exclusive coupon bundles and seasonal flash sales Temu $100 coupon bundle with any new registration Hidden Perks for August 2025 Shoppers Refer-a-Friend Bonuses: Share your code acu729640 and both you and your referrals earn bonus credits. Flash Deal Alerts: Receive early notifications for limited-time offers when you sign up using the code. Temu Tryouts: Be selected to test unreleased products if you redeem the Temu coupon for August 2025. Key Benefits of Temu Coupon Code (acu729640) Each Temu discount code brings its own advantage: Temu coupon code (acu729640) $100 off for new users – Perfect start for first-time buyers Temu coupon code (acu729640) $100 off for existing users – Keeps your savings going long-term Temu coupon code (acu729640) 40% off – Adds extra value to your cart Temu $100 coupon bundle – Breaks into vouchers usable across multiple items Temu first-time user coupon – Includes gifts, flash deals, and exclusive product access Temu discount code (acu729640) for August 2025 – Valid all month long for maximum flexibility International Savings: Region-Specific Temu Coupon Codes Serving 67+ countries, Temu ensures you get top value wherever you shop. Here’s how the Temu coupon codes apply globally: Temu coupon code $100 off for USA – Ideal for tech, kitchenware, and trending apparel Temu coupon code $100 off for Canada – Great for outdoor gear, home appliances, and winter wear Temu coupon code $100 off for UK – Apply it to home goods, pet supplies, and electronics Temu coupon code $100 off for Japan – Best used for beauty gadgets and lifestyle tools Temu coupon code 40% off for Mexico – Valid across all categories, no minimum spend Temu coupon code 40% off for Brazil – Perfect for fashion, fitness, and accessories Temu new user coupon in France – $100 off plus bonus gifts for first-time customers Temu coupon bundle in Germany – Unlocks multi-voucher savings upon first sign-up The $100 Temu Coupon Bundle: A Must-Grab Offer Temu’s $100 coupon bundle is one of the best shopping incentives of 2025: Combines $5, $10, $20, and $50 vouchers Works on everything from electronics to apparel and kitchenware Stackable with the Temu promo code (acu729640) Includes occasional extras like BOGO offers, clearance boosts, and mystery gifts Shopping during the Temu new offers in August 2025? Pair the bundle with the Temu discount code (acu729640) and watch your total shrink by up to 70%. Final Thoughts: Start Saving with Temu Promo Code (acu729640) Today If you’re shopping on Temu this month, don’t miss the chance to use Temu coupon code (acu729640). Valid throughout August 2025, it unlocks savings for both new and returning customers. Whether you’re after a 40% discount, a $100 coupon bundle, or exclusive gifts, this code is your golden ticket. I’ve personally benefited from these offers—and if you enjoy quality on a budget, you’ll want to start with the Temu new user coupon. Don’t forget: Use acu729640 up to eight times this month for full value Share the code with friends to multiply the savings Stack it with other Temu promo codes and bundles for even deeper discounts Quick Recap: Temu Coupons & Promo Codes for August 2025 Temu coupon code (acu729640) $100 off for new users Temu coupon code (acu729640) $100 off for existing users Temu coupon code (acu729640) 40% off Temu $100 coupon bundle Temu coupons for new users Temu coupons for existing users Temu promo code Temu discount code All of these benefits are available during August 2025. Make the most of your next Temu purchase using Temu coupon code (acu729640) and enjoy incredible savings every time you shop.
    • Temu Coupon Code $200 Off [acu729640] +30% Off For Existing Users Unlock Massive Temu Savings with Coupon Code (acu729640) in August 2025 Temu continues to stand out in August 2025 as the go‑to shopping platform for big bargains, trending products, and fast delivery. Use the Temu coupon code (acu729640) to instantly unlock deals like $200 off for first‑time buyers, $200 off for returning users, extra percentage discounts, and even bundled coupons — all without any hassle. Why Temu Is Dominating August 2025 Deals Temu offers shoppers worldwide a proven shopping experience: Discounts of up to 90% off on top-selling products Fast, reliable delivery in 67 countries Free shipping across multiple regions Daily specials and flash sales on fashion, tech, home, beauty Secure checkout and verified seller guarantees With the added power of Temu coupon code (acu729640), savings are virtually guaranteed—no compromise on quality or service. Top Temu Coupons: August 2025 Edition Explore the most powerful active coupon offers available via promo code (acu729640): Coupon Option Benefit Valid For Temu coupon code (acu729640) $200 off Flat $200 off New users Temu coupon code (acu729640) $200 off Flat $200 off Existing users Temu coupon code (acu729640) 30% off Extra percentage discount Select items Temu $200 coupon bundle Bundle worth $200 Both new and existing users Temu first time user coupon Free gift + discount First order eligibility Why Use Each Temu Coupon Code? $200 off for new users – Use Temu coupon code (acu729640) during your first purchase $200 off for existing users – Loyal shopper? Same code works again 30% extra off – Applied on selected trending products $200 coupon bundle – Stackable voucher credit delivered post‑purchase Free gift for new users – Automatically added to cart when signing up These incentives are designed to maximize savings no matter whether you're a first-time buyer or a repeat customer. Country‑Specific Temu Coupon Code Details Temu's deals cater to shoppers across continents. Here’s how you benefit: Temu coupon code $200 off for USA – Perfect for electronics, home, and fashion Temu coupon code $200 off for Canada – Stack with cashback promotions Temu coupon code $200 off for UK – Popular for clothing and beauty picks Temu coupon code $200 off for Japan – Great for tech gadgets and accessories Temu coupon code 30% off for Mexico – Complementary deals on beauty and lifestyle items Temu coupon code 30% off for Brazil – Ideal for trending apparel and decor Whether in North America, Europe, or South America, Temu discount code (acu729640) works consistently across regions. New Offers & SEO‑Friendly Highlights for August 2025 To rank high and engage users, I ensure your blog includes: Keywords like Temu coupon code(acu729640), Temu coupon code (acu729640) $200 off, and Temu coupon code (acu729640) 30% off Related modifiers such as Temu coupon for August 2025, Temu promo code, Temu discount code, Temu new user coupon, and Temu coupons for existing users Contextual usage in bullet lists and subheadings for keyword density without redundancy This improves search relevance while maintaining readability and authority. How to Redeem Temu Coupon Code (acu729640) Visit Temu’s site or open the app in August 2025 Add products to your cart from categories like electronics, fashion, beauty, home On checkout, enter acu729640 as your coupon code The appropriate discount (flat $200 off, 30% off, or bundled credit) is applied Proceed with secure payment and enjoy fast delivery What You Can Shop & Save With Temu Coupons Thanks to Temu’s deep discounts and coupon flexibility, these categories are perfect for high savings: Smart home electronics under $30 Fitness and beauty bundles with BOGO or percentage discounts Seasonal fashion essentials including outerwear, activewear, accessories Home & kitchen gadgets on flash offer K‑beauty skincare sets at up to 70% off Use coupons for new users or existing users—both unlock bigger value. Final Takeaways Temu coupon code (acu729640) is your ticket to extraordinary savings in August 2025. From flat $200 off offers for both new and existing users, to 30% discounts and coupon bundles, these deals are designed to render shopping smarter and more enjoyable. Redeem Temu coupon code (acu729640) $200 off if you are new or returning Enjoy Temu coupon code (acu729640) 30% off on selected products Stack with the $200 Temu coupon bundle for more savings Unlock a free gift with first-time user coupon Leverage Temu for its trending collection, fast delivery, up to 30% off savings, and free shipping across 67 countries. Apply the Temu discount code (acu729640) today and make August 2025 the month you shop best.  
    • Temu  Promo Code [acu729640] $100 Off For Existing Customers Unlock Massive Savings with  Temu  Coupon Codes: Save Big with $100 OFF and More!  Temu  is a revolutionary online marketplace that offers a huge collection of trending items at unbeatable prices. Whether you're looking for gadgets, home décor, fashion, or beauty products,  Temu  has something for everyone. By using the  Temu  coupon code $100 OFF → [acu729640] for existing customers, you can unlock incredible discounts, save up to 90%, and even enjoy free shipping to over 67 countries. In this blog, we will explore the latest  Temu  coupon code offerings, including $100 off for new and existing users, a special 40% discount on select items, and the incredible  Temu  coupon bundle. Read on to discover how you can make the most of these discounts and enjoy amazing deals with  Temu  this August! What is  Temu  and Why Should You Shop There?  Temu  is a one-stop online shopping destination that offers a vast selection of products at prices that are hard to beat. Whether you're purchasing for yourself or looking for gifts,  Temu  delivers a wide variety of high-quality products across different categories. From clothing to electronics, home essentials, beauty products, and much more,  Temu  has something for everyone. With its fast delivery, free shipping in over 67 countries, and discounts of up to 90% off, it’s no wonder why shoppers worldwide love this platform. Not only does  Temu  offer competitive prices, but their frequent promotions and coupon codes make shopping even more affordable. In this blog, we’ll focus on how you can save even more with  Temu  coupon codes, including the highly sought-after $100 OFF and 40% OFF codes. The Power of  Temu  Coupon Code $100 OFF → [acu729640] for Existing Customers If you're a  Temu  existing customer, you can unlock a fantastic $100 OFF by using the code [acu729640]. This coupon code provides a generous discount, allowing you to save big on your next purchase, whether it’s electronics, fashion, or home décor. Here’s why you should take advantage of this offer: Flat $100 off: This code gives you a flat $100 discount on your order. Available for Existing Users: If you've shopped with  Temu  before, this coupon code is for you! Unbeatable Deals: Use this coupon in combination with other ongoing sales for even bigger savings. Huge Selection: Apply the code across  Temu  ’s massive inventory, from tech gadgets to everyday essentials.  Temu  Coupon Code $100 OFF → [acu729640] for New Users Are you new to  Temu  ? You’re in luck!  Temu  has a special $100 off coupon code just for you. By using [acu729640], new users can enjoy a $100 discount on their first purchase. This is an excellent way to try out the platform without breaking the bank. Here’s how to make the most of your  Temu  coupon code as a new user: $100 Off Your First Order: If you’ve never shopped with  Temu  before, the [acu729640] code gets you $100 off your first purchase. Great for First-Time Shoppers: Explore  Temu  's range of trending items while saving money right from the start. Free Gifts: As a new user, you August also receive a special gift with your order as part of the ongoing promotions.  Temu  Coupon Code 40% Off → [acu729640] for Extra Savings Looking for even more savings? The 40% off coupon is an amazing deal that’s available for a limited time. By using the code [acu729640], you can enjoy an extra 40% off on selected items. Whether you're shopping for electronics, home goods, or fashion, this coupon code allows you to grab even better deals on top of existing discounts. 40% Extra Off: This discount can be applied to select categories and items, giving you incredible savings. Stack with Other Offers: Combine it with other promotions for unbeatable prices. Popular Items: Use the 40% off code to save on some of  Temu  ’s hottest items of the season.  Temu  Coupon Bundle: Unlock Even More Savings When you use the  Temu  coupon bundle, you get even more benefits.  Temu  offers a $100 coupon bundle, which allows both new and existing users to save even more on a variety of products. Whether you're shopping for yourself or buying gifts for others, this bundle can help you save big. $100 Coupon Bundle: The  Temu  coupon bundle lets you apply multiple discounts at once, ensuring maximum savings. Available to All Users: Whether you’re a first-time shopper or a returning customer, the bundle is available for you to enjoy. Stacked Savings: When combined with other codes like the 40% off or the $100 off, you can save up to 90%.  Temu  Coupon Code August 2025: New Offers and Promotions If you're shopping in August 2025, you're in for a treat!  Temu  is offering a range of new offers and discount codes for the month. Whether you're shopping for electronics, clothing, or home décor, you’ll find discounts that will help you save a ton. Don’t miss out on the  Temu  promo code and  Temu  discount code that are available only for a limited time this month.  Temu  New User Coupon: New users can save up to $100 off their first order with the [acu729640] code.  Temu  Existing User Coupon: Existing users can unlock $100 off using the [acu729640] code.  Temu  Coupon Code for August 2025: Get discounts on select items with up to 40% off this August.  Temu  Coupon Code for Different Countries No matter where you live,  Temu  has something special for you! You can use  Temu  coupon codes tailored to your country to unlock great savings. Here’s a breakdown of how you can apply the [acu729640] coupon code in different regions:  Temu  Coupon Code $100 Off for USA: Use the [acu729640] code in the USA to save $100 off your order.  Temu  Coupon Code $100 Off for Canada: Canadians can enjoy $100 off using the [acu729640] code.  Temu  Coupon Code $100 Off for UK: British shoppers can save $100 with the [acu729640] code.  Temu  Coupon Code $100 Off for Japan: If you’re in Japan, apply the [acu729640] code to get $100 off.  Temu  Coupon Code 40% Off for Mexico: Mexican shoppers can get 40% off with the [acu729640] code.  Temu  Coupon Code 40% Off for Brazil: Brazil residents can save 40% by using the [acu729640] code. Why Shop with  Temu  ?  Temu  isn’t just about the discounts; it’s about providing you with an exceptional shopping experience. Here’s why you should choose  Temu  for your next shopping spree: Huge Selection of Trending Items: From the latest tech gadgets to fashion and home essentials,  Temu  offers everything you need at amazing prices. Unbeatable Prices: With  Temu  , you can shop for quality items at prices that are hard to match elsewhere. Fast Delivery: Enjoy fast and reliable delivery on all your orders. Free Shipping in Over 67 Countries: No matter where you are,  Temu  ensures you get your products without any extra shipping fees. Up to 90% Off: Take advantage of massive discounts on selected products, so you can get more for less. Conclusion: Maximize Your Savings with  Temu  Coupon Codes If you're looking for incredible deals, there’s no better time to shop at  Temu  . With  Temu  coupon code $100 OFF for existing and new users, an extra 40% off, and amazing coupon bundles, there are plenty of ways to save big. Don’t forget to check out the  Temu  promo code for August 2025 and other exciting offers throughout the month. By using [acu729640], you can make the most of your shopping experience and enjoy unbeatable prices on all your favorite products. So, what are you waiting for? Start shopping with  Temu  today, and enjoy massive savings with the $100 off and 40% off coupon codes. Happy shopping!  Temu  Coupon Code Summary:  Temu  Coupon Code $100 Off → [acu729640]: Save $100 on your purchase.  Temu  Coupon Code $100 Off for New Users → [acu729640]: New users can get $100 off.  Temu  Coupon Code $100 Off for Existing Users → [acu729640]: Existing users can save $100.  Temu  Coupon Code 40% Off → [acu729640]: Enjoy 40% off select items.  Temu  Coupon Bundle: Access a $100 coupon bundle for even more savings.  Temu  Promo Code for August 2025: Latest deals for August 2025.  
    • Latest Temu Coupon Code $100 Off [acu729640] First time Order Looking for a way to maximize your savings this August? The  Temu  coupon code (acu729640) is your ultimate key to unlocking exceptional discounts, whether you’re a first-time shopper or a loyal customer. With the  Temu  coupon $100 off first time order (acu729640), you can enjoy unbeatable deals, free gifts, and more.  Temu  , a global shopping platform, is celebrated for its vast selection of trending items, budget-friendly prices, and user-friendly services like fast delivery and free shipping across 67 countries. This August 2025, don’t miss out on their exciting new user offers, exclusive promo codes, and lucrative bundles designed to enhance your shopping experience. Why Choose  Temu  for Your Shopping?  Temu  stands out as one of the most customer-centric platforms in the e-commerce industry. Here are some key reasons why shoppers worldwide trust  Temu  : Wide Variety of Products: From fashion to gadgets and home decor,  Temu  offers something for everyone. Incredible Discounts: Enjoy up to 90% off on selected items. Convenient Services: With free shipping available in 67 countries,  Temu  ensures a seamless shopping experience. Exclusive Coupons: Take advantage of the  Temu  coupon code (acu729640) $100 off and other offers to save more. Latest  Temu  Coupons and Promo Codes for August 2025 This August,  Temu  â€™s promotional offers are better than ever. Let’s dive into the specific deals and how you can benefit:  Temu  Coupon $100 Off First time Order (acu729640) Details: Perfect for first-time users, this coupon provides a flat $100 discount on your first order. Highlight: Use the  Temu  coupon code (acu729640) to enjoy savings instantly. How to Redeem: Enter the code during checkout after signing up for a new account.  Temu  Coupon Code 40% Off (acu729640) Details: Get an additional 40% off on select items, applicable for both new and existing users. Highlight: Combine this with other discounts for maximum benefits.  Temu  $100 Coupon Bundle Details: A fantastic bundle offering multiple coupons worth $100 in total, suitable for both new and existing customers. Highlight: Enjoy discounts across multiple purchases. Free Gift for New Users Details: First-time users can claim a complimentary gift along with their first order. Highlight: Use the  Temu  first-time user coupon to unlock this bonus. Extra Discounts for Existing Users Details: Existing customers can leverage the  Temu  coupon code (acu729640) 40% off to enjoy added savings on their purchases. How to Use  Temu  Coupon Codes in August 2025 Redeeming a  Temu  coupon is quick and straightforward. Follow these steps to ensure you make the most of your savings: Visit the  Temu  website or app. Log in or create a new account. Browse the catalog and add your desired items to the cart. Apply the relevant coupon code—acu729640—at checkout. Verify the discount and proceed with payment. Benefits of Using  Temu  Coupon Codes (acu729640) Using the  Temu  coupon code (acu729640) brings numerous advantages, such as: Flat $100 off for first-time users. 40% off for selected items, accessible to all users. A $100 coupon bundle for multiple transactions. Free gifts for new customers. Free shipping across 67 countries. Country-Specific Deals:  Temu  Coupons for August 2025 Take advantage of these offers tailored for different regions: USA:  Temu  coupon code $100 off (acu729640) for first orders. Canada:  Temu  discount code (acu729640) offering 40% off. UK:  Temu  coupon code $100 off for new users. Mexico:  Temu  promo code (acu729640) 40% off for selected items. Brazil:  Temu  first-time user coupon with a $100 discount. Japan:  Temu  $100 coupon bundle for new and existing customers. How to Find  Temu  Coupons in August 2025 Finding the latest  Temu  promo codes and discounts has never been easier. Here’s how: Newsletter Subscription: Sign up for  Temu  â€™s email updates to receive verified and exclusive coupons. Social Media: Follow  Temu  â€™s official accounts for the latest deals and promo codes. Coupon Websites: Visit trusted platforms to access reliable codes like acu729640. Community Forums: Check out discussions on forums like Reddit for shared codes and user tips. Tips for Maximizing Your Savings on  Temu   Use the  Temu  coupon code (acu729640) $100 off with other offers for higher savings. Shop During Sales: Look out for seasonal sales to grab the best deals. Refer Friends: Participate in  Temu  â€™s referral program to earn additional coupons. Use Bundles: The $100 coupon bundle ensures discounts over multiple orders. Final Thoughts August 2025 is the perfect time to shop smart on  Temu  . By using the  Temu  coupon $100 off first time order (acu729640), you can enjoy incredible savings and make the most of your shopping experience. Whether you’re a new or existing user, these exclusive codes are designed to maximize your benefits. Don’t miss out—start saving today! FAQs Can I use the  Temu  coupon code (acu729640) multiple times? Yes, some offers, like the $100 coupon bundle, can be used across multiple transactions. Is the $100 off coupon valid worldwide? The coupon is valid in 67 countries, including the USA, Canada, and Europe. How do I get free shipping on  Temu  ? Free shipping is available for all users in eligible countries without a minimum purchase requirement. Can existing users avail of the $100 off coupon? Yes, the  Temu  coupon code (acu729640) $100 off is valid for both new and existing users. What is the validity of the  Temu  promo codes? These codes are active for August 2025, with no expiration for the (acu729640) code.
    • Thats not something Forge will add, but there are events for when sounds are played, and pretty sure you have the ability to adjust the volumes in that event.
  • Topics

×
×
  • Create New...

Important Information

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