Jump to content

NovaViper

Forge Modder
  • Posts

    1061
  • Joined

  • Last visited

Everything posted by NovaViper

  1. No, I'm doing it like that Its in the code I posted
  2. It's not a variable though.. its a datawatcher.
  3. I don't see any datawatchers in the variables tab
  4. Strange.. I don't see the datawatcher
  5. I put extra cases and it still doesn't switch
  6. I do have a texture issue also, the male wild textures do not render when the male is wild
  7. The bounding box isn't changing but everything else I have does work package common.zeroquest.entity.zertum; import java.util.HashMap; import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; 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.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.potion.PotionEffect; import net.minecraft.util.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import common.zeroquest.ModAchievements; import common.zeroquest.ModItems; import common.zeroquest.api.ZeroQuestAPI; import common.zeroquest.core.helper.ChatHelper; import common.zeroquest.entity.EntityCustomTameable; import common.zeroquest.entity.ai.EntityAIBeg; import common.zeroquest.entity.ai.EntityAIFetchToy; import common.zeroquest.entity.ai.EntityAIFollowOwner; import common.zeroquest.entity.ai.EntityAIModeAttackTarget; import common.zeroquest.entity.ai.EntityAIOwnerHurtByTarget; import common.zeroquest.entity.ai.EntityAIOwnerHurtTarget; import common.zeroquest.entity.ai.EntityAIRoundUp; import common.zeroquest.entity.zertum.util.LevelUtil; import common.zeroquest.entity.zertum.util.ModeUtil; import common.zeroquest.entity.zertum.util.ModeUtil.EnumMode; import common.zeroquest.entity.zertum.util.TalentHelper; import common.zeroquest.entity.zertum.util.TalentUtil; import common.zeroquest.inventory.InventoryPack; import common.zeroquest.lib.Constants; import common.zeroquest.lib.DataValues; import common.zeroquest.lib.Sound; public abstract class EntityZertumEntity extends EntityCustomTameable { 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 EntityAIFetchToy aiFetchBone; 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 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; public EntityZertumEntity(World worldIn) { super(worldIn); if (!this.hasEvolved() && !this.inFinalStage()) { this.setSize(0.6F, 1.5F); } else if (this.hasEvolved() && this.inFinalStage()) { this.setSize(16F, 16F); } this.objects = new HashMap<String, Object>(); ((PathNavigateGround) this.getNavigator()).setAvoidsWater(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 EntityAIFetchToy(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 EntityAIBeg(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() { 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 getCommandSenderName() { String name = this.getPetName(); if (name != "" && this.isTamed()) { return name; } else { return super.getCommandSenderName(); } } @Override @SideOnly(Side.CLIENT) public boolean getAlwaysRenderNameTagForRender() { return true; } //@formatter:off @Override protected void entityInit() { super.entityInit(); this.talents = new TalentUtil(this); this.levels = new LevelUtil(this); this.mode = new ModeUtil(this); this.dataWatcher.addObject(DataValues.ownerName, new String("")); //Owner Name this.dataWatcher.addObject(DataValues.ownerID, new String("")); //Owner Id this.dataWatcher.addObject(DataValues.collarCollar, new Byte((byte) EnumDyeColor.RED.getMetadata())); //Collar this.dataWatcher.addObject(DataValues.dogName, new String("")); //Dog Name this.dataWatcher.addObject(DataValues.talentData, new String("")); //Talent Data this.dataWatcher.addObject(DataValues.hungerTicks, new Integer(Constants.hungerTicks)); //Dog Hunger this.dataWatcher.addObject(DataValues.levelData, new String("0:0")); //Level Data this.dataWatcher.addObject(DataValues.evolve, Byte.valueOf((byte)0)); //Evolution this.dataWatcher.addObject(DataValues.obeyOthers, new Integer(0)); //Obey Others this.dataWatcher.addObject(DataValues.zertumMode, new Integer(0)); //Zertum Mode this.dataWatcher.addObject(DataValues.mouth, Integer.valueOf(0)); //Mouth this.dataWatcher.addObject(DataValues.beg, new Byte((byte) 0)); //Begging } //@formatter:on @Override public void writeEntityToNBT(NBTTagCompound tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setString("ownerId", this.getOwnerID()); tagCompound.setString("ownerName", this.getOwnerName()); tagCompound.setByte("collarColor", (byte) this.getCollarColor().getDyeDamage()); tagCompound.setBoolean("evolve", this.hasEvolved()); tagCompound.setBoolean("finalEvolve", this.inFinalStage()); tagCompound.setString("version", Constants.version); tagCompound.setString("dogName", this.getPetName()); tagCompound.setInteger("dogHunger", this.getZertumHunger()); tagCompound.setBoolean("willObey", this.willObeyOthers()); tagCompound.setBoolean("dogBeg", this.isBegging()); this.talents.writeTalentsToNBT(tagCompound); this.levels.writeTalentsToNBT(tagCompound); this.mode.writeToNBT(tagCompound); TalentHelper.writeToNBT(this, tagCompound); } @Override public void readEntityFromNBT(NBTTagCompound tagCompound) { super.readEntityFromNBT(tagCompound); this.saveOwnerID(tagCompound.getString("ownerId")); this.saveOwnerName(tagCompound.getString("ownerName")); if (tagCompound.hasKey("collarColor", 99)) { this.setCollarColor(EnumDyeColor.byDyeDamage(tagCompound.getByte("collarColor"))); } this.setEvolved(tagCompound.getBoolean("evolve")); this.setFinalStage(tagCompound.getBoolean("finalEvolve")); String lastVersion = tagCompound.getString("version"); this.setPetName(tagCompound.getString("dogName")); this.setZertumHunger(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); 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; } // if(!this.inFinalStage()){ return this.isAngry() ? "mob.wolf.growl" : this.wantToHowl ? Sound.ZertumHowl : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.getHealth() <= Constants.lowHP ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); // }else{ return Sound.; } } /** * 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; } /** * Gets the pitch of living sounds in living entities. */ @Override public float getPitch() { if (!this.isChild()) { return super.getSoundPitch(); } else { return super.getSoundPitch() * 1; } } /** * Get number of ticks, at least during which the living entity will be * silent. */ @Override public int getTalkInterval() { int ticks = TalentHelper.getTalkInterval(this); if (ticks != 0) { return ticks; } else if (this.wantToHowl) { return 150; } else if (this.getHealth() <= Constants.lowHP) { 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() // NAV: Living Updates { 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.DEF_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.setZertumHunger(this.getZertumHunger() - 1); this.hungerTick -= 400; } } if (this.getHealth() != Constants.lowHP) { 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.getZertumHunger() == 0 && this.worldObj.getWorldInfo().getWorldTime() % 100L == 0L && this.getHealth() >= Constants.lowHP) { 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()) { 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.isBegging()) { 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 * 5.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() { 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.stage2Level && this.hasEvolved()) { speed += 0.3D; } else if (this.hasEvolved() && this.levels.getLevel() != Constants.stage2Level) { speed += 0.3D; } } 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.stage2Level && this.hasEvolved()) { damage += 1.0D; } else if (this.hasEvolved() && this.levels.getLevel() != Constants.stage2Level) { damage += 1.0D; } else if (this.levels.getLevel() == Constants.maxLevel && this.hasEvolved() && this.inFinalStage()) { damage += 3.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) { 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() <= Constants.lowHP) { 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() { // NAV: Master Order 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.getZertumHunger() > 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() { return (this.levels.getLevel()) / 10; } public String getPetName() { return this.dataWatcher.getWatchableObjectString(DataValues.dogName); } public void setPetName(String var1) { this.dataWatcher.updateObject(DataValues.dogName, var1); } public void setWillObeyOthers(boolean flag) { this.dataWatcher.updateObject(DataValues.obeyOthers, flag ? 1 : 0); } public boolean willObeyOthers() { return this.dataWatcher.getWatchableObjectInt(DataValues.obeyOthers) != 0; } public int points() { return this.levels.getLevel() + (this.getGrowingAge() < 0 ? 0 : Constants.startingPoints); } public int spendablePoints() { return this.points() - this.usedPoints(); } public int usedPoints() { return TalentHelper.getUsedPoints(this); } public int getZertumHunger() { return this.dataWatcher.getWatchableObjectInt(DataValues.hungerTicks); } public void setZertumHunger(int par1) { this.dataWatcher.updateObject(DataValues.hungerTicks, 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; } @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 stack) { return stack != null && ZeroQuestAPI.breedList.containsItem(stack); } @Override public int getMaxSpawnedInChunk() { return 8; } public EnumDyeColor getCollarColor() { return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectByte(DataValues.collarCollar) & 15); } public void setCollarColor(EnumDyeColor collarcolor) { this.dataWatcher.updateObject(DataValues.collarCollar, Byte.valueOf((byte) (collarcolor.getDyeDamage() & 15))); } private boolean getHorseWatchableBoolean(int p_110233_1_) { return (this.dataWatcher.getWatchableObjectInt(DataValues.mouth) & p_110233_1_) != 0; } private void setHorseWatchableBoolean(int p_110208_1_, boolean p_110208_2_) { int j = this.dataWatcher.getWatchableObjectInt(DataValues.mouth); if (p_110208_2_) { this.dataWatcher.updateObject(DataValues.mouth, Integer.valueOf(j | p_110208_1_)); } else { this.dataWatcher.updateObject(DataValues.mouth, Integer.valueOf(j & ~p_110208_1_)); } } @SideOnly(Side.CLIENT) public float getMouthOpennessAngle(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(DataValues.beg, Byte.valueOf((byte) (flag ? 1 : 0))); } public boolean isBegging() { return this.dataWatcher.getWatchableObjectByte(DataValues.beg) == 1; } public boolean hasEvolved() { return (this.dataWatcher.getWatchableObjectByte(DataValues.evolve) & 4) != 0; } public void setEvolved(boolean evolved) { byte b0 = this.dataWatcher.getWatchableObjectByte(DataValues.evolve); if (evolved) { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 | 4))); } else { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 & -5))); } if (evolved) { 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 boolean inFinalStage() { return (this.dataWatcher.getWatchableObjectByte(DataValues.evolve) & 2) != 0; } public void setFinalStage(boolean finalStage) { byte b0 = this.dataWatcher.getWatchableObjectByte(DataValues.evolve); if (finalStage) { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 | 2))); } else { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 & -3))); } } 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); } /** Custom Zertum Taming Code */ @Override public void tamedFor(EntityPlayer player, boolean successful) { if (successful) { this.setTamed(true); this.navigator.clearPathEntity(); this.setAttackTarget((EntityLivingBase) null); this.aiSit.setSitting(false); this.setOwnerId(player.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); this.saveOwnerName(player.getDisplayNameString()); this.saveOwnerID(player.getUniqueID().toString()); player.triggerAchievement(ModAchievements.ZertTame); //@formatter:off //System.out.println("ID: " + zertum.getOwnerID() + ", Name: " + zertum.getOwnerName()); //@formatter:on } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } } public void unTame() { this.setTamed(false); this.setEvolved(false); this.setFinalStage(false); this.navigator.clearPathEntity(); this.setSitting(false); this.talents.resetTalents(); this.levels.resetLevel(); this.setOwnerId(""); this.saveOwnerName(""); this.setPetName(""); this.setWillObeyOthers(false); this.mode.setMode(EnumMode.DOCILE); } public void evolveOnClient(EntityPlayer player) { this.setEvolved(true); this.worldObj.playBroadcastSound(1013, new BlockPos(this), 0); this.setHealth(this.getMaxHealth()); player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + this.getPetName() + " has been evolved!")); } public void evolveOnServer(EntityZertumEntity entity, EntityPlayer player) { entity.setEvolved(true); entity.worldObj.playBroadcastSound(1013, new BlockPos(entity), 0); entity.setHealth(entity.getMaxHealth()); player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + entity.getPetName() + " has been evolved!")); } public void finaEvolveOnClient(EntityPlayer player) { this.setFinalStage(true); this.worldObj.playBroadcastSound(1013, new BlockPos(this), 0); this.setHealth(this.getMaxHealth()); player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + this.getPetName() + " has been evolved to the final stage!")); } public void finaEvolveOnServer(EntityZertumEntity entity, EntityPlayer player) { entity.setFinalStage(true); entity.worldObj.playBroadcastSound(1013, new BlockPos(entity), 0); entity.setHealth(entity.getMaxHealth()); player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.GREEN + entity.getPetName() + " has been evolved to the final stage!")); } public void devolveOnServer(EntityZertumEntity entity, EntityPlayer player) { if (entity.hasEvolved() && !entity.inFinalStage()) { entity.setEvolved(false); } else if (entity.hasEvolved() && entity.inFinalStage()) { entity.setFinalStage(false); } entity.worldObj.playBroadcastSound(1013, new BlockPos(entity), 0); entity.setHealth(entity.getMaxHealth()); player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.DARK_RED + entity.getPetName() + " has been devolved!")); } public String genderPronoun() { if (this.getGender() == true) { return "him"; } else { return "her"; } } public String genderSubject() { if (this.getGender() == true) { return "he"; } else { return "she"; } } public void doNotOwnMessage(EntityZertumEntity zertum, EntityPlayer player) { player.addChatMessage(ChatHelper.getChatComponent(EnumChatFormatting.RED + "You do not own " + zertum.getPetName() + " and " + zertum.getOwnerName() + " doesn't allow " + zertum.genderPronoun() + EnumChatFormatting.RED + " to" + EnumChatFormatting.RED + " obey" + EnumChatFormatting.RED + "non-owners!")); } } For the female, it's suppose to not render the male textures at all, which is what it is doing. But when the male is wild, it shows the tamed male textures and vice versa.
  8. Yeah. When the creature evolves, the model changes and when the gender isn't a male, the male texture do not render.
  9. Yeah, the variables are in datawatchers
  10. Anyone know how to fix this?
  11. I've been trying to get the layers and the bounding box sizes of my entities to switch based on entity. For the layers, the other sets of layers in the class switch but this one part of it doesn't switch when it checks for the entity's gender and within that, the tamed state. And for the bounding box size, the smaller box renders but the larger one doesn't based on the entity's evolution state. For Layers: package common.zeroquest.client.render.layers; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.EnumDyeColor; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import common.zeroquest.client.render.zertum.RenderZertum; import common.zeroquest.entity.zertum.EntityZertum; import common.zeroquest.lib.Constants; import common.zeroquest.lib.DataValues; import common.zeroquest.util.ResourceReference; @SideOnly(Side.CLIENT) public class LayersZertum implements LayerRenderer { private final RenderZertum renderer; public LayersZertum(RenderZertum p_177145_1_) { this.renderer = p_177145_1_; } public void func_177145_a(EntityZertum entity, float par1, float par2, float par3, float par4, float par5, float par6, float par7) { if (!entity.isInvisible()) { if (!entity.hasEvolved() && !entity.inFinalStage()) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZLayers("collar")); EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entity.getCollarColor().getMetadata()); float[] afloat = EntitySheep.func_175513_a(enumdyecolor); GlStateManager.color(afloat[0], afloat[1], afloat[2]); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.getHealth() <= Constants.lowHP) { this.renderer.bindTexture(ResourceReference.getZLayers("dying")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.isSaddled()) { this.renderer.bindTexture(ResourceReference.getZLayers("saddle")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.getGender() == true) { <<<<Here is where the gender is checked if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZMaleTameLayers("")); <<<<Switches to this in tamed GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } else if(!entity.isTamed()){ this.renderer.bindTexture(ResourceReference.getZMaleLayers("")); <<<<<But never switches to this when not tamed GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } } } else if (entity.hasEvolved() && !entity.inFinalStage()) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZELayers("collar")); EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entity.getCollarColor().getMetadata()); float[] afloat = EntitySheep.func_175513_a(enumdyecolor); GlStateManager.color(afloat[0], afloat[1], afloat[2]); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.getHealth() <= Constants.lowHP) { this.renderer.bindTexture(ResourceReference.getZELayers("dying")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.isSaddled()) { this.renderer.bindTexture(ResourceReference.getZELayers("saddle")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.getGender() == true) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZEMaleLayers("")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } } } else if (entity.hasEvolved() && entity.inFinalStage()) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZFinalLayers("collar")); EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entity.getCollarColor().getMetadata()); float[] afloat = EntitySheep.func_175513_a(enumdyecolor); GlStateManager.color(afloat[0], afloat[1], afloat[2]); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.getHealth() <= Constants.lowHP) { this.renderer.bindTexture(ResourceReference.getZFinalLayers("dying")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.isSaddled()) { this.renderer.bindTexture(ResourceReference.getZFinalLayers("saddle")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.getGender() == true) { this.renderer.bindTexture(ResourceReference.getZFinalMaleLayers("")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } } } } @Override public boolean shouldCombineTextures() { return true; } @Override public void doRenderLayer(EntityLivingBase entity, float par1, float par2, float par3, float par4, float par5, float par6, float par7) { this.func_177145_a((EntityZertum) entity, par1, par2, par3, par4, par5, par6, par7); } } For Bounding Box: if (!this.hasEvolved() && !this.inFinalStage()) { this.setSize(0.6F, 1.5F); <<<Starts as this } else if (this.hasEvolved() && this.inFinalStage()) { this.setSize(16F, 16F); <<<But never turns into this when condition is met }
  12. Hey, I noticed that there was a commit on Github that added fluid renderers. How do I access them and use them to render the textures of my liquids?
  13. It's still not updating even though I checked to make sure that it is changing but it isn't
  14. The stages are stored in datawatchers but it still isn't switching
  15. Nvm that post, for the entity's bounding box to update, how do I let the client know that I am changing the entity's bounding box? Should I send a packet to the client via packethandler?
  16. Er... I'm not sure what I did wrong here but I did this if (!this.inFinalStage()) { this.setEntityBoundingBox(new AxisAlignedBB(0.6, 1.5, 1.5, 0.0, 0.0, 0.0)); // this.setSize(0.6F, 1.5F); } else if (this.inFinalStage()) { // this.setSize(2F, 4F); this.setEntityBoundingBox(new AxisAlignedBB(2.0, 5.0, 5.0, 0.0, 0.0, 0.0)); } And when I enter the game, it appears that the box is completely gone and the entities are dying from suffocation. Debug [22:16:27] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5] [22:16:27] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5] [22:16:27] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5] [22:16:27] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5] [22:16:27] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5] [22:16:27] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5] [22:16:31] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5] [22:16:31] [Client thread/INFO] [sTDOUT]: [common.zeroquest.entity.zertum.EntityZertumEntity:<init>:126]: box[0.0, 0.0, 0.0 -> 0.6, 1.5, 1.5]
  17. I'm trying to make the sizes switch based on my entity's state, the sizes won't switch for some reason when the creature is evolved if (!this.inFinalStage()) { this.setSize(0.6F, 1.5F); } else if (this.inFinalStage()) { this.setEntityBoundingBox(new AxisAlignedBB(3.0, 3.0, 3.0, 3.0, 3.0, 3.0)); }
  18. What about this this.setEntityBoundingBox(new AxisAlignedBB(x1, y1, z1, x2, y2, z2));
  19. Alrighty, I fixed it after doing some research on what I was doing wrong. And I have I think my final question, how do I extend the entity bounding box on the Z axis?
  20. No, I'm not using the same datawatcher as vanilla and it appears that vanilla uses the same datawatcher in 2 different ways. The code that vanilla uses looks like this /** * Determines whether this wolf is angry or not. */ public boolean isAngry() { return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; } /** * Sets whether this wolf is angry or not. */ public void setAngry(boolean angry) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (angry) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); } } public boolean isTamed() { return (this.dataWatcher.getWatchableObjectByte(16) & 4) != 0; } public void setTamed(boolean tamed) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (tamed) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 4))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -5))); } this.setupTamedAI(); }
  21. Oh, and I got a question, Minecraft has 4 methods that use the same datawatcher but do two different things: its the and angry methods that vanilla wolves use. I'm not sure how Minecraft is doing these but I have something like this public boolean hasEvolved() // TODO { return (this.dataWatcher.getWatchableObjectByte(DataValues.evolve) & 1) != 0; } public boolean isFinalStage() { return (this.dataWatcher.getWatchableObjectByte(DataValues.evolve) & 2) != 0; } public void setFinalStage(boolean finalStage) { byte b0 = this.dataWatcher.getWatchableObjectByte(DataValues.evolve); if (finalStage) { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 | 2))); } else { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 & -3))); } } public void setEvolved(boolean evolved) { byte b0 = this.dataWatcher.getWatchableObjectByte(DataValues.evolve); if (evolved) { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 | 1))); } else { this.dataWatcher.updateObject(DataValues.evolve, Byte.valueOf((byte) (b0 & -5))); } if (evolved) { 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()); } } }
  22. *Facepalm* I misread myself.. I meant to say was this: "You can use the same renderer for multiple entities?" And I didn't realize you can have multiple fields like "private final ModelBase model1, model2, model3;"
  23. That is not possible, there should be many model. But you can do it with only one Renderer class. Wait, I can use the same renderer for multiple models?
  24. I looked at what you guys said for a while and begin something like this: package common.zeroquest.client.render.zertum; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; import common.zeroquest.client.model.ModelZertum2; import common.zeroquest.client.model.ModelZertumEvo1; import common.zeroquest.client.render.layers.LayersZertum; import common.zeroquest.entity.zertum.EntityZertum; import common.zeroquest.entity.zertum.EntityZertumEntity; import common.zeroquest.lib.Constants; import common.zeroquest.util.ResourceReference; @SideOnly(Side.CLIENT) public class RenderZertums extends RenderLiving { public RenderZertums(RenderManager render, ModelBase base, float par1, EntityZertumEntity entity) { super(render, base, par1); if(entity.hasEvolved()){ this.mainModel = new ModelZertum2(); }else if(entity.hasEvolved()){ this.mainModel = new ModelZertumEvo1(); } //this.addLayer(new LayersZertum(this)); } public void func_177135_a(EntityZertum entity, double par1, double par2, double par3, float par4, float par5) { if (entity.isWolfWet()) { float f2 = entity.getBrightness(par5) * entity.getShadingWhileWet(par5); GlStateManager.color(f2, f2, f2); } super.doRender(entity, par1, par2, par3, par4, par5); } protected ResourceLocation getEntityTexture(EntityZertum entity) { if (!entity.hasEvolved()) { if (entity.isTamed()) { return ResourceReference.getZTameSkins(""); } else if (entity.isAngry()) { return ResourceReference.getZAngrySkins(""); } else if (!entity.isTamed() && !entity.isAngry()) { return ResourceReference.getZWildSkins(""); } } else if (entity.hasEvolved()) { if (entity.isTamed()) { return ResourceReference.getZEvoTamekins(""); } else if (!entity.isTamed() && !entity.isAngry()) { return ResourceReference.getZEvoWildSkins(""); } } return null; } @Override public void doRender(EntityLiving entity, double par1, double par2, double par3, float par4, float par5) { this.func_177135_a((EntityZertum) entity, par1, par2, par3, par4, par5); } @Override public void doRender(EntityLivingBase entity, double par1, double par2, double par3, float par4, float par5) { this.func_177135_a((EntityZertum) entity, par1, par2, par3, par4, par5); } @Override protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityZertum) p_110775_1_); } @Override public void passSpecialRender(EntityLivingBase entityLivingBase, double par1, double par2, double par3) { EntityZertum dog = (EntityZertum) entityLivingBase; if (!dog.getPetName().isEmpty()) { super.passSpecialRender(entityLivingBase, par1, par2, par3); } } @Override protected void renderOffsetLivingLabel(Entity entity, double x, double y, double z, String displayName, float scale, double distanceFromPlayer) { super.renderOffsetLivingLabel(entity, x, y, z, displayName, scale, distanceFromPlayer); EntityZertum dog = (EntityZertum) entity; if (distanceFromPlayer < 100.0D) { y += this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.016666668F * 0.7F; String tip = dog.mode.getMode().getTip(); String label = String.format("%s[%d]", tip, dog.getZertumHunger()); if (dog.isPlayerSleeping()) { this.renderLivingLabel(dog, label, x, y - 0.5D, z, 64, 0.7F); } else { this.renderLivingLabel(dog, label, x, y, z, 64, 0.7F); } } if (distanceFromPlayer < 100.0D) { y += this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.016666668F * 0.5F; if (this.renderManager.livingPlayer.isSneaking()) { EntityLivingBase owner = dog.getOwnerEntity(); if (owner != null) { this.renderLivingLabel(dog, owner.getDisplayName().getUnformattedText(), x, y, z, 5, 0.5F); } else { this.renderLivingLabel(dog, dog.getOwnerName(), x, y, z, 5, 0.5F); } } } } protected void renderLivingLabel(Entity p_147906_1_, String p_147906_2_, double p_147906_3_, double p_147906_5_, double p_147906_7_, int p_147906_9_, float scale) { double d3 = p_147906_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); if (d3 <= p_147906_9_ * p_147906_9_) { FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); float f1 = 0.016666668F * scale; GlStateManager.pushMatrix(); GlStateManager.translate((float) p_147906_3_ + 0.0F, (float) p_147906_5_ + p_147906_1_.height + 0.5F, (float) p_147906_7_); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); byte b0 = 0; if (p_147906_2_.equals("deadmau5")) { b0 = -10; } GlStateManager.disableTexture2D(); worldrenderer.startDrawingQuads(); int j = fontrenderer.getStringWidth(p_147906_2_) / 2; worldrenderer.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); worldrenderer.addVertex(-j - 1, -1 + b0, 0.0D); worldrenderer.addVertex(-j - 1, 8 + b0, 0.0D); worldrenderer.addVertex(j + 1, 8 + b0, 0.0D); worldrenderer.addVertex(j + 1, -1 + b0, 0.0D); tessellator.draw(); GlStateManager.enableTexture2D(); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, 553648127); GlStateManager.enableDepth(); GlStateManager.depthMask(true); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, -1); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } } } Now the question is, should I put the Entity in the constructor or do I just make a new variable like EntityZertum zertum = new EntityZertum(); for the entity to get the state or is there another way to do this?
  25. What I meant was I had multiple renders for each entity, the renderers all used the same ModelBase. And is it possible to switch the mainModel by the entity state?
×
×
  • Create New...

Important Information

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