Jump to content

[1.8.9] Entity creates lag in game and walks into blocks


Glistre

Recommended Posts

As stated in subject line:  my custom entity walks right into blocks.  I have tried a few methods such as #getCollisionBox, #getEntityBoundingBox, and #getCollisionBoundingBox from AxisAlignedBB

 

When my custom mob walks through any block the game lags, nearly stalls.  Please let me know and I can post any code

 

EntityBlackTobo class:

 

package com.glistre.glistremod.entities.blacktobie;

 

import java.util.Calendar;

import java.util.Iterator;

import java.util.List;

 

import com.glistre.glistremod.GlistreMod;

import com.glistre.glistremod.entities.guardian.EntityTobieSkel;

import com.glistre.glistremod.entities.wolf.EntityGlistreWolf;

import com.glistre.glistremod.init.GlistreEntityRegistry;

import com.glistre.glistremod.init.ItemRegistry;

import com.glistre.glistremod.projectiles.blaster.EntityBlasterBolt;

 

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.enchantment.Enchantment;

import net.minecraft.enchantment.EnchantmentHelper;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityCreature;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.EnumCreatureAttribute;

import net.minecraft.entity.IEntityLivingData;

import net.minecraft.entity.IRangedAttackMob;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.EntityAIArrowAttack;

import net.minecraft.entity.ai.EntityAIAttackOnCollide;

import net.minecraft.entity.ai.EntityAIFleeSun;

import net.minecraft.entity.ai.EntityAIHurtByTarget;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAIRestrictSun;

import net.minecraft.entity.ai.EntityAISwimming;

import net.minecraft.entity.ai.EntityAITargetNonTamed;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.ai.EntityAIWatchClosest;

import net.minecraft.entity.item.EntityItem;

//import net.minecraft.entity.item.EntityItem;

import net.minecraft.entity.monster.EntityCaveSpider;

import net.minecraft.entity.monster.EntityEnderman;

import net.minecraft.entity.monster.EntityIronGolem;

//import net.minecraft.entity.monster.EntityCreeper;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.entity.monster.EntitySkeleton;

import net.minecraft.entity.monster.EntitySpider;

import net.minecraft.entity.monster.EntityWitch;

import net.minecraft.entity.monster.EntityZombie;

import net.minecraft.entity.monster.IMob;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.projectile.EntityArrow;

import net.minecraft.entity.projectile.EntityLargeFireball;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.stats.AchievementList;

import net.minecraft.util.AxisAlignedBB;

import net.minecraft.util.ChatComponentText;

import net.minecraft.util.DamageSource;

import net.minecraft.util.EnumChatFormatting;

import net.minecraft.util.EnumParticleTypes;

import net.minecraft.util.MathHelper;

import net.minecraft.world.DifficultyInstance;

import net.minecraft.world.World;

import net.minecraft.world.WorldProviderHell;

 

public class EntityBlackTobo extends EntityMob implements IRangedAttackMob

{

    private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);

//returning false fourth parameter will remove that entity 

    private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);

    private static final ItemStack defaultHeldItem = new ItemStack(ItemRegistry.tobie_gun_1, 1);

 

    public AxisAlignedBB boundingBox;

    private int attackTimer;

   

    public EntityBlackTobo(World world)

    {

        super(world);

        //trying to make immune to fire damage not working

 

//      this.isImmuneToFire();

 

        //trying to raise the hit box

        setSize(1.0F, 4.5F);

//        this.boundingBox.setBounds(minX,minY,minZ,maxX,maxY,maxZ);

        this.getEntityBoundingBox().fromBounds(0D, 0D, 0D, .5D, .5D, .5D);

 

        this.setSkeletonType(0);

        this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));

        this.tasks.addTask(0, new EntityAISwimming(this));

        //should match same method above for Double and fourth parameter no need for Player set to false above

//      this.tasks.addTask(1,  new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));

        this.tasks.addTask(1,  new EntityAIAttackOnCollide(this, EntityTobieSkel.class, 1.0D, true));     

        this.tasks.addTask(3, new EntityAIRestrictSun(this));

        this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D));

        this.tasks.addTask(0, new EntityAIWander(this, 1.0D));

        this.tasks.addTask(0, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));

        this.tasks.addTask(0, new EntityAIWatchClosest(this, EntityTobieSkel.class, 8.0F));

       

        this.tasks.addTask(4, new EntityAILookIdle(this));

        this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, true));

        this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityTobieSkel.class, 2, true, false, IMob.mobSelector));

        this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityGlistreWolf.class, 3, true, false, IMob.mobSelector));

     

 

        if (world != null && !world.isRemote)

        {

            this.setCombatTask();

        }

    }

 

 

  @Override

public AxisAlignedBB getCollisionBox(Entity par1Entity) {

   

return boundingBox;

}

 

@Override

//#getBoundingBox changed to #getCollisionBoundingBox 1.8.9  //collision defines hitbox //selected defines area around

public AxisAlignedBB getCollisionBoundingBox() {

return boundingBox;

}

@Override

    protected void applyEntityAttributes()

    {

        super.applyEntityAttributes();

//      this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);

        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D);

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.34000000417232513D);

        this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);

        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(65.0D);

        this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(10.0D);

    }

@Override

    protected void entityInit()

    {

        super.entityInit();

        //changed 13 to 26 can go up to 31 better to use packets

        this.dataWatcher.addObject(13, new Byte((byte)0));

    }

 

    /**

    * Returns true if the newer Entity AI code should be run

    */

    public boolean isAIEnabled()

    {

        return true;

    }

 

    /**

    * Returns the sound this mob makes while it's alive.

    */

    protected String getLivingSound()

    {

        return "mob.skeleton.say";

    }

 

    /**

    * Returns the sound this mob makes when it is hurt.

    */

    protected String getHurtSound()

    {

        return "mob.skeleton.hurt";

    }

 

    /**

    * Returns the sound this mob makes on death.

    */

    protected String getDeathSound()

    {

        return "mob.skeleton.death";

    }

 

    protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_)

    {

        this.playSound("mob.skeleton.step", 0.15F, 1.0F);

    }

 

    @SideOnly(Side.CLIENT)

    public int getAttackTimer()

    {

        return this.attackTimer;

    }

   

    public boolean attackEntityAsMob(Entity targetEntity)

    {

      if (super.attackEntityAsMob(targetEntity))

      {

                  /*  if (this.getSkeletonType() == 1 && targetEntity instanceof EntityLivingBase)

                    {

                        ((EntityLivingBase)targetEntity).addPotionEffect(new PotionEffect(Potion.wither.id, 200));

                    }*/

        this.attackTimer = 10;

        this.worldObj.setEntityState(this, (byte)4);

        boolean flag = targetEntity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15)));

 

        if (flag)

        {

          targetEntity.motionY += 0.4000000059604645D;

        }

 

                    this.playSound("mob.irongolem.throw", 1.0F, 1.0F);

                    return flag;

                }

                else

                {

                    return false;

                }

      }

 

    /**

    * Get this Entity's EnumCreatureAttribute

    */

    public EnumCreatureAttribute getCreatureAttribute()

    {

        return EnumCreatureAttribute.UNDEAD;

    }

 

    /**

    * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons

    * use this to react to sunlight and start to burn.

    */

/*  public void onLivingUpdate()

    {

        if (this.worldObj.isDaytime() && !this.worldObj.isRemote)

        {

            float f = this.getBrightness(1.0F);

 

            if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))

            {

                boolean flag = true;

                ItemStack itemstack = this.getEquipmentInSlot(4);

 

                if (itemstack != null)

                {

                    if (itemstack.isItemStackDamageable())

                    {

                        itemstack.setItemDamage(itemstack.getItemDamageForDisplay() + this.rand.nextInt(2));

 

                        if (itemstack.getItemDamageForDisplay() >= itemstack.getMaxDamage())

                        {

                            this.renderBrokenItemStack(itemstack);

                            this.setCurrentItemOrArmor(4, (ItemStack)null);

                        }

                    }

 

                    flag = false;

                }

 

                if (flag)

                {

                    this.setFire(8);

                }

            }

        }

 

        if (this.worldObj.isRemote && this.getSkeletonType() == 1)

        {

            this.setSize(0.72F, 2.34F);

        }

 

        super.onLivingUpdate();

    }*/

 

    /**

    * Handles updating while being ridden by an entity

    */

    public void updateRidden()

    {

        super.updateRidden();

 

        if (this.ridingEntity instanceof EntityCreature)

        {

            EntityCreature entitycreature = (EntityCreature)this.ridingEntity;

            this.renderYawOffset = entitycreature.renderYawOffset;

        }

    }

 

    /**

    * Called when the mob's health reaches 0.

    */

/*    public void onDeath(DamageSource source)

    {

        super.onDeath(source);

//source.getSourceOfDamage() instanceof EntityBlasterBolt &&

        if ( source.getEntity() instanceof EntityPlayer)

        {

            EntityPlayer entityplayer = (EntityPlayer)source.getEntity();

            double d0 = entityplayer.posX - this.posX;

            double d1 = entityplayer.posZ - this.posZ;

 

            if (d0 * d0 + d1 * d1 >= 2500.0D)

            {

                entityplayer.triggerAchievement(AchievementList.snipeSkeleton);

            }

        }

    }*/

 

    protected Item getDropItem()

    {

        return ItemRegistry.ender_gun;

    }

   

 

    /**

    * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param

    * par2 - Level of Looting used to kill this mob.

    */

    @Override

    protected void dropFewItems(boolean hasPlayerHit, int lootingLev)

    {

    World world = worldObj;

        int j;

        int k;

       

        if (this.getSkeletonType() == 0)

        {   

        final String KEY = "activated";

            ItemStack toDrop = new ItemStack(ItemRegistry.mighty_sword, 1);

            if(toDrop.getTagCompound() == null)

            {

                toDrop.setTagCompound(new NBTTagCompound());

                toDrop.getTagCompound().setBoolean(KEY, false);

 

            }

    //      j = this.rand.nextInt(3 + lootingLev) - 1;

    //    for (k = 0; k < j; ++k)

             

    //        {

            if (!(worldObj.isRemote)){

            EntityItem dropItem = new EntityItem(worldObj, this.posX, this.posY, this.posZ, toDrop);

 

            worldObj.spawnEntityInWorld(dropItem);

            }

 

        j = this.rand.nextInt(3 + lootingLev) - 1;

             

            for (k = 0; k < j; ++k)

            {

          this.entityDropItem(new ItemStack(ItemRegistry.glistre_sword, 1, 1), 1.0F);

            }

       

        j = this.rand.nextInt(3 + lootingLev) - 1;

 

        for (k = 0; k < j; ++k)

        {

            this.dropItem(ItemRegistry.nausea_protection, 1);

        }

       

        j = this.rand.nextInt(3 + lootingLev);

 

        for (k = 0; k < j; ++k)

        {

        ItemRegistry instance = new ItemRegistry();

        ItemStack ancientBook = instance.getAncientBook();

        ancientBook.getItem();

        this.entityDropItem(ancientBook, 1.0F);

        }

       

        j = this.rand.nextInt(3 + lootingLev) - 1;

 

        for (k = 0; k < j; ++k)

        {

        this.dropItem(GlistreEntityRegistry.splash_poison_protection, 1);

        }

 

        //1.8 way to make 40% chance of drop

        if(rand.nextInt(100)<40){

        int p;

                int q;

               

            p = this.rand.nextInt(3 + lootingLev) + 1;

 

        for (q = 0; q < p; ++q)

            // what does float do here?  likelihood of drop?         

              {

           

            this.entityDropItem(new ItemStack(GlistreEntityRegistry.tobie_worst_projectile_1, 1, 1), 1.0F);

              }

        for (q = 0; q < p; ++q)

                // what does float do here?  likelihood of drop?         

                  {

               

                this.entityDropItem(new ItemStack(ItemRegistry.chain_helmet_1, 1, 1), 1.0F);

                  }

        p = this.rand.nextInt(3 + lootingLev);

 

        for (q = 0; q < p; ++q)

            {

            this.dropItem(ItemRegistry.custom_bow_1, 1);

            }

        }

        }

       

    }

 

/*  @Override

    protected void dropRareDrop(int num)

    {

       

        if (this.getSkeletonType() == 0){

        int j;

            int k;

           

        j = this.rand.nextInt(3 + num) + 1;

 

    for (k = 0; k < j; ++k)

        // what does float do here?  likelihood of drop?         

          {

       

        this.entityDropItem(new ItemStack(GlistreEntityRegistry.tobie_worst_projectile_1, 1, 1), 1.0F);

          }

    for (k = 0; k < j; ++k)

            // what does float do here?  likelihood of drop?         

              {

           

            this.entityDropItem(new ItemStack(ItemRegistry.chain_helmet_1, 1, 1), 1.0F);

              }

       

    j = this.rand.nextInt(3 + num);

 

    for (k = 0; k < j; ++k)

        {

        this.dropItem(ItemRegistry.item_spawn_egg_3, 1);

        }

        } 

    }*/

 

   

    /**

    * Makes entity wear random armor based on difficulty

    */

 

  protected void addRandomArmor()

    {

//      super.addRandomArmor();

      this.setCurrentItemOrArmor(0, new ItemStack(ItemRegistry.tobie_gun_1));

        // sets the ability for the RayGun to drop which is different than enderGun don't want RayGun for player

        this.equipmentDropChances[0] = 0.0F;

    }

  @Override

  //1.8.9 changed func_180482_a to #onInitialSpawn

  public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData entitylivingdata)

    {

  entitylivingdata = super.onInitialSpawn(difficulty, entitylivingdata);

 

        if (this.worldObj.provider instanceof WorldProviderHell && this.getRNG().nextInt(5) > 0)

        {

            this.tasks.addTask(2, this.aiAttackOnCollide);

            this.setSkeletonType(1);

            this.setCurrentItemOrArmor(0, new ItemStack(ItemRegistry.sceptre_1));

            this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);

// sets the ability for the RayGun to drop which is different than blaster dont want RayGun for player

            this.equipmentDropChances[0] = 0.0F;

        }

        else

        {

            this.tasks.addTask(0, this.aiArrowAttack);

            this.addRandomArmor();

            this.setCurrentItemOrArmor(0, new ItemStack(ItemRegistry.tobie_gun_1));

            this.enchantEquipment();

        }

 

        this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * difficulty.getClampedAdditionalDifficulty());

//      this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * this.worldObj.(this.posX, this.posY, this.posZ));

 

        if (this.getEquipmentInSlot(4) == null)

        {

            Calendar calendar = this.worldObj.getCurrentDate();

 

            if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F)

            {

                this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.lit_pumpkin : Blocks.pumpkin));

                this.equipmentDropChances[4] = 0.0F;

            }

        }

 

        return entitylivingdata;

    }

  /**

    * Enchants the entity's armor and held item based on difficulty

    */

  public void enchantEquipment()

  {

      float f = 1.0F;

 

      if (this.getHeldItem() != null && this.rand.nextFloat() < 0.25F * f)

      {

          EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItem(), (int)(5.0F + f * (float)this.rand.nextInt(18)));

      }

 

  //    for (int i = 0; i < 4; ++i)

  //    {

     

//1.8 update not doubt this probably will not work :  change func_130225_q(i) to this getHeldItem  and dleteled for loop        for (int i = 0; i < 4; ++i)

    //      {  

          ItemStack itemstack = this.getHeldItem();

 

          if (itemstack != null && this.rand.nextFloat() < 0.5F * f)

          {

              EnchantmentHelper.addRandomEnchantment(this.rand, itemstack, (int)(5.0F + f * (float)this.rand.nextInt(18)));

          }

//      }

  }

 

 

    /**

    * sets this entity's combat AI.

    */

//  @Override

    public void setCombatTask()

    {

        this.tasks.removeTask(this.aiAttackOnCollide);

        this.tasks.removeTask(this.aiArrowAttack);

        ItemStack itemstack = this.getHeldItem();

 

        if (itemstack != null && itemstack.getItem() == ItemRegistry.tobie_gun_1)

        {

            this.tasks.addTask(0, this.aiArrowAttack);

        }

        else

        {

            this.tasks.addTask(1, this.aiAttackOnCollide);

        }

    }

 

    /**

    * Attack the specified entity using a ranged attack.

    */

    @Override

    public void attackEntityWithRangedAttack(EntityLivingBase target, float distance)

    {

/*      EntityBlasterBolt entityblasterbolt = new EntityBlasterBolt(this.worldObj, this, target, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));

        int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());

        int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());

        entityblasterbolt.setDamage((double)(distance * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));

 

        if (i > 0)

        {

            entityblasterbolt.setDamage(entityblasterbolt.getDamage() + (double)i * 0.5D + 0.5D);

        }

 

        if (j > 0)

        {

            entityblasterbolt.setKnockbackStrength(j);

        }

 

        if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1)

        {

            entityblasterbolt.setFire(100);

        }*/

    EntityBlasterBolt entityblasterbolt = new EntityBlasterBolt(this.worldObj, this, target, 500F, (float)(100));

        double d0 = target.posX - this.posX;

        double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.posY + (double)(this.height / 2.0F));

 

//      double d1 = target.posY + (double)target.getEyeHeight() - 1.100000023841858D - entityblasterbolt.posY;

        double d2 = target.posZ - this.posZ;

        float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2) * 0.2F;

        entityblasterbolt.setThrowableHeading(d0, d1 + (double)f1, d2, 0.6F, 12.0F);

 

        this.playSound("glistremod:laser_blaster", 1.2F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));

        this.worldObj.spawnEntityInWorld(entityblasterbolt);

       

 

        }

 

/*    @Override

    public void onLivingUpdate()

    {

      if (this.getHealth() < this.getMaxHealth() && this.ticksExisted % 400 == 0)

      {

      // this.heal(1.0F);

          this.playSound("mob.blaze.hit", 1.2F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));

     

      worldObj.spawnParticle(EnumParticleTypes.PORTAL, posX + (rand.nextDouble() - 0.5D) * (double)width, posY + (rand.nextDouble() * (double)height), posZ + (rand.nextDouble() - 0.5D) * (double)width, 1.0D, 0.0D, 0.0D);

 

      }

      else if (this.getHealth() == 0 ){

          this.playSound("glistremod:sceptre_1", 1.2F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));

          Minecraft.getMinecraft().thePlayer.addChatMessage(

new ChatComponentText(EnumChatFormatting.DARK_RED + "You have AWAKENED TOBIE KING!"));

          worldObj.spawnParticle(EnumParticleTypes.PORTAL, posX + (rand.nextDouble() - 0.5D) * (double)width, posY + (rand.nextDouble() * (double)height), posZ + (rand.nextDouble() - 0.5D) * (double)width, 1.0D, 0.0D, 0.0D);

      }

     

      super.onLivingUpdate();

    }*/

 

  @Override

    public void onUpdate(){

    super.onUpdate();

    if (!(worldObj.isRemote && this.ticksExisted < 400)){

 

List<EntityPlayer> playerList = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.getEntityBoundingBox().expand(45.0D, 35.0D, 45.0D));

Iterator<EntityPlayer> i1 = playerList.iterator();

EntityPlayer entityplayer;

 

              while (i1.hasNext())

              {

                entityplayer = (EntityPlayer)i1.next();

double inRange = this.getDistanceSqToEntity(entityplayer);

 

if ( inRange < 1600.0D & inRange > 1580.0D)

 

if(entityplayer.getHeldItem() !=null &&  entityplayer.getHeldItem().getItem() == ItemRegistry.mighty_sword){

 

        entityplayer.addChatComponentMessage(

                    new ChatComponentText(EnumChatFormatting.DARK_GREEN + "Corrupt Tobie in Range location "

                    + EnumChatFormatting.DARK_RED + " X: " + (int)Math.round(this.posX)

                    + EnumChatFormatting.GOLD + " | Y: " + (int)Math.round(this.posY)

                    + EnumChatFormatting.DARK_AQUA +" | Z: " + (int)Math.round(this.posZ)));

}

 

            }}

    }           

           

   

 

    /**

    * Return this skeleton's type.

    */

    public int getSkeletonType()

    {

        return this.dataWatcher.getWatchableObjectByte(13);

    }

 

    /**

    * Set this skeleton's type.

    */

    public void setSkeletonType(int type)

    {

        this.dataWatcher.updateObject(13, Byte.valueOf((byte)type));

        this.isImmuneToFire = type == 1;

 

        if (type == 1)

        {

            this.setSize(0.72F, 2.34F);

        }

        else

        {

            this.setSize(0.6F, 1.8F);

        }

    }

 

    /**

    * (abstract) Protected helper method to read subclass entity data from NBT.

    */

    public void readEntityFromNBT(NBTTagCompound compound)

    {

        super.readEntityFromNBT(compound);

 

        if (compound.hasKey("SkeletonType", 99))

        {

            byte b0 = compound.getByte("SkeletonType");

            this.setSkeletonType(b0);

        }

 

        this.setCombatTask();

 

    }

    /**

    * (abstract) Protected helper method to write subclass entity data to NBT.

    */

    public void writeEntityToNBT(NBTTagCompound compound)

    {

        super.writeEntityToNBT(compound);

        compound.setByte("SkeletonType", (byte)this.getSkeletonType());

    }

 

    /**

    * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot

    */

    public void setCurrentItemOrArmor(int slot, ItemStack itemstack)

    {

        super.setCurrentItemOrArmor(slot, itemstack);

 

        if (!this.worldObj.isRemote && slot == 0)

        {

            this.setCombatTask();

        }

    }

 

    /**

    * Returns the Y Offset of this entity.

    */

    public double getYOffset()

    {

        return super.getYOffset() - 0.5D;

    }

//  needs to be false or by the time the Player gets to location the Tobie will be gone   

    @Override

    public boolean canDespawn(){

return false;

    }

   

    @Override

    public ItemStack getHeldItem()

    {

        return defaultHeldItem;

    }

/*   

    @Override

public void setPosition(double par1, double par2, double par3) {

AxisAlignedBB b = this.getEntityBoundingBox();

double boxSX = b.maxX - b.minX;

double boxSY = b.maxY - b.minY;

double boxSZ = b.maxZ - b.minZ;

this.getEntityBoundingBox().fromBounds(posX - boxSX/2D, posY, posZ - boxSZ/2D, posX + boxSX/2D, posY + boxSY, posZ + boxSZ/2D);

}*/

}

 

 

I hope 1.8.9 still supported here , I really need to fix several bugs in my mod before updating to 1.10! 

Link to comment
Share on other sites

You are never initializing

boundingBox

, thus returning

null

from

getCollisionBox

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

That seems to have helped a bit

 

I am still very laggy in the custom biome / dimension ...for ex, I hit the entity after the fifth time the game literally freezes ....

 

Is there a way to run a report on my mod to find out what is causing this ...ie,: how much is chunk generation, how much is entity , how much is errors from rendering or something like that  ..?

 

 

 

Link to comment
Share on other sites

Shift F3

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

gameRenderer == 53%

display_update == 34%

 

 

Edit:

Found one problem in Renderer where I did not override    @Override // 1.8 changed func_82422_c() transformHeldFull3DItemLayer()

 

Now it seems to just stalls loading chunks 68% display_update, 28% gameRenderer

 

 

 

 

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Fast Leaf Decay (by olafskiii) Rubidium (by Asek3) Artifacts (by ochotonida) Framework (by MrCrayfish) Max Health Fix (by DarkhaxDev) Embeddium/Rubidium Extras (by Txni) Essential Mod (by SparkUniverse_) Immersive Aircraft [Fabric/Forge] (by Conczin) Cherished Worlds (Fabric/Forge/NeoForge/Quilt) (by TheIllusiveC4) ExpandAbility (by florensie) Sophisticated Core (by P3pp3rF1y) Tinkers' Levelling Addon (by Pyre540) Better Advancements (by way2muchnoise) Immersive Melodies [Fabric/Forge] (by Conczin) Citadel (by sbom_xela) Vampirism - Become a vampire! (by maxanier) FerriteCore ((Neo)Forge) (by malte0811) CoroUtil (by Corosus) Create Big Cannons (by rbasamoyai) Controlling (by Jaredlll08) Cloth Config API (Fabric/Forge/NeoForge) (by shedaniel) Mekanism (by bradyaidanc) BetterF3 (by cominixo) Supplementaries (by MehVahdJukaar) Chest Cavity - Forge Port (by booneldanforever) ConnectedTexturesMod (by tterrag1098) NetherPortalFix (by BlayTheNinth) Spartan Weaponry (by ObliviousSpartan) Charm of Undying (Fabric/Forge/Quilt) (by TheIllusiveC4) Plushie Mod (by Link4real) JourneyMap (by techbrew) Farmer's Delight (by vectorwing) Connectivity[Forge/Fabric] (by someaddon) Create : Misc & Things (by To0pa) Create: Steam 'n' Rails (by IThundxr) Shutup Experimental Settings! (by Corgi_Taco) Alex's Mobs (by sbom_xela) Quark (by Vazkii) Tool Belt (by gigaherz) Just Enough Items (JEI) (by mezz) Bookshelf (by DarkhaxDev) FastWorkbench (by Shadows_of_Fire) Tinkers Construct (by mDiyo) Collective (by Serilum) Inventory HUD+ (by dmitrylovin) Explorer's Compass (by Chaosyr) playerAnimator (by KosmX) Size Devices (by DaFlame_rl) Jade 🔍 (by Snownee) Create Slice & Dice (by possible_triangle) Create Jetpack (by possible_triangle) Carry On (by Tschipp) Moonlight Lib (by MehVahdJukaar) Kotlin for Forge (by thedarkcolour) CraftTweaker (by Jaredlll08) Just Enough Resources (JER) (by way2muchnoise) AI Improvements (by QueenOfMissiles) Patchouli (by Vazkii) Catalogue (by MrCrayfish) Tool Stats (by DarkhaxDev) It Takes a Pillage (by izofar) JEITweaker (by Jaredlll08) Waystones (by BlayTheNinth) Vampires Need Umbrellas (by focamacho) Oculus (by Asek3) Mantle (by mDiyo) Mob Grinding Utils (by vadis365) Chiseled (by freepeopleworking) AutoRegLib (by Vazkii) Mystical Agriculture (by BlakeBr0) Embeddium/Rubidium Dynamic Lights (by Txni) Flywheel (Legacy) (by jozufozu) Builder's Delight (Forge) (by Tynoxs) Apotheosis (by Shadows_of_Fire) What Are They Up To (Watut) (by Corosus) Create: Interiors (by sudolev) FastFurnace (by Shadows_of_Fire) Balm (Forge Edition) (by BlayTheNinth) Clumps (by Jaredlll08) Iris & Oculus Flywheel Compat (by leon_mout) Configured (by MrCrayfish) Tinkers' Expansion (by Insane96) Crafting on a stick (by OfekN_) MrCrayfish's Gun Mod (by MrCrayfish) Create: Crystal Clear (by singularity_cyvack) FTB Library (Forge) (by FTB) AppleSkin (by squeek502) Curios API (Forge/NeoForge) (by TheIllusiveC4) Better Third Person (by Socolio) Caelus API (Forge/NeoForge) (by TheIllusiveC4) Sons Of Sins (by Furti_Two) SwingThroughGrass (by exidex) AttributeFix (by DarkhaxDev) Quests Additions (Forge) (by NaturaSpell) Building Gadgets (by Direwolf20) Enchantment Descriptions (by DarkhaxDev) Skin Layers 3D (Fabric/Forge) (by tr7zw) Bad Wither No Cookie - Reloaded (by Kreezxil) Placebo (by Shadows_of_Fire) FTB Teams (Forge) (by FTB) Mod Name Tooltip (by mezz) Enigmatic Graves (by Quarris) Sophisticated Backpacks (by P3pp3rF1y) GeckoLib (by Gecko) Builders Crafts & Additions (by MRHminer) Immersive Portals (for Forge) (by qouteall) Architectury API (Fabric/Forge/NeoForge) (by shedaniel) Lazy DataFixerUpper(LazyDFU) [FORGE] (by Corgi_Taco) Create Ore Excavation (by tom54541) Tinkers' Rapier (by sz0999312) Mowzie's Mobs (by bobmowzie) Better Combat [Fabric & Forge] (by daedelus_dev) Create Stuff & Additions (by Furti_Two) Cucumber Library (by BlakeBr0) FPS Reducer (by bre2el) Item Filters (by LatvianModder) FTB Quests (Forge) (by FTB) L_Ender 's Cataclysm (by mcl_ender) Starter Kit (by Serilum) Feature NBT Deadlock Be Gone (by telepathicgrunt) Materialis (by RCXcrafter) KleeSlabs (by BlayTheNinth) Pehkui (by Virtuoel) Grappling Hook Mod (by yyonne) Security Craft (by Geforce132) Ars Nouveau (by baileyholl2) Mouse Tweaks (by YaLTeR) Werewolves - Become a Beast! (by Cheaterpaul) Elytra Slot (Fabric/Forge/Quilt) (by TheIllusiveC4) Create (by simibubi) Budschie's Morph Mod (by budschie_) Ore Excavation (by Funwayguy) Create Confectionery (by Furti_Two)
    • Hello, im kind of a newbie on creating mods, and i been trying to make simples mods so far, Right now, i'm creating a mod which detect an specific type of mob and kill it if reach a certain number, by far the mod is detecting the mob and counting them but at the time it reach the limit number, it don't do anything. The Game don't tweak, don't crash, just i't don't run the method i call, which is kill().   public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) { final var TotalCows = pLevel.getNearbyEntities(Cow.class, TargetingConditions.forNonCombat(), pPlayer, pPlayer.getBoundingBox().inflate(5)); if(pLevel.isClientSide){ if(pPlayer.getItemInHand(InteractionHand.MAIN_HAND).getItem() == this.asItem()){ if(!TotalCows.isEmpty()){ if(TotalCows.get(0).isAlive()){ TotalCows.get(0).kill(); } }else{ pPlayer.sendSystemMessage(Component.literal("No hay vacas")); } } } The sendSystemMessage is get triggered, and when i change the method .kill() by any other like send a message it got called, can i get some tips, and a clue of what i'm missing
    • UPD: I DID IT   @Override public void applyEffectTick(LivingEntity livingEntity, int pAmplifier) { Level level = livingEntity.level(); if (!level.isClientSide()) { Holder<DamageType> entropyHolder = level .registryAccess() .registryOrThrow(Registries.DAMAGE_TYPE) .getHolderOrThrow(GTDamageTypes.ENTROPY_KEY); livingEntity.hurt(new DamageSource(entropyHolder), 1); } super.applyEffectTick(livingEntity, pAmplifier); }  
    • So I came to this public class ModDamageTypes{ public static void bootstrap(BootstapContext<DamageType> context) { context.register(GTDamageTypes.ENTROPY_KEY, new DamageType(GrimTales.MOD_ID + "_entropy", 0.1f)); } } public class GTDamageTypes implements DamageTypes { public static final ResourceKey<DamageType> ENTROPY_KEY = register("entropy"); private static ResourceKey<DamageType> register(String name) { return ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(GrimTales.MOD_ID, name)); } } public class ModWorldGenProvider extends DatapackBuiltinEntriesProvider { public static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() .add(Registries.DAMAGE_TYPE, ModDamageTypes::bootstrap); public ModWorldGenProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) { super(output, registries, BUILDER, Set.of(GrimTales.MOD_ID)); } But! I still have an issue that, I cannot just use Holder.direct, due to it will create error that "Required type:  Holder<DamageType>  Provided : Holder<ResourceKey<DamageType>>" And I still have no clue how to fix it
    • Yea, unless someone else sees this and has a solution in the next 4 or 5 hours, I’m just gonna reinstall the modpack. Thanks for trying to help me out.
  • Topics

×
×
  • Create New...

Important Information

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