Jump to content

[1.9.4] How do I stop errors that are only present when the mod is complied?


TheCallunxz

Recommended Posts

Hello.

I keep getting errors when I compile my mod despite the mod working fine within the workspace.

 

How do I know when errors such as this will happen:

java.lang.AbstractMethodError: com.thecallunxz.realmsofascencia.entities.mobs.bosses.EntityBossElgra.getHealth()F
at com.thecallunxz.realmsofascencia.entities.mobs.bosses.BossCustomStatus.setBossStatus(BossCustomStatus.java:11)
at com.thecallunxz.realmsofascencia.entities.mobs.bosses.EntityBossElgra.func_70071_h_(EntityBossElgra.java:156)
at net.minecraft.world.World.func_72866_a(World.java:1951)
at net.minecraft.world.World.func_72870_g(World.java:1920)
at net.minecraft.world.World.func_72939_s(World.java:1743)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1788)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1056)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:369)
at net.minecraft.client.main.Main.main(SourceFile:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

Kind of annoying.

Link to comment
Share on other sites

It looks like you may be running a deobfuscated build of the mod in the obfuscated client. Make sure you build your mod with the

build

Gradle task, which reobfuscates the mod after building it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

EntityBossElgra --> Just modified slime code:

 

package com.thecallunxz.realmsofascencia.entities.mobs.bosses;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import com.thecallunxz.realmsofascencia.Main;
import com.thecallunxz.realmsofascencia.WorldDataRoa;
import com.thecallunxz.realmsofascencia.audio.BossMusic;
import com.thecallunxz.realmsofascencia.init.AscenciaItems;
import com.thecallunxz.realmsofascencia.utils.CommonUtils;

import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAIFindEntityNearest;
import net.minecraft.entity.ai.EntityAIFindEntityNearestPlayer;
import net.minecraft.entity.ai.EntityMoveHelper;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.pathfinding.PathNavigateGround;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.Event;

public class EntityBossElgra extends EntityLiving implements IMob, IBossCustom {

    private static final DataParameter<Integer> SLIME_SIZE = EntityDataManager.<Integer> createKey(EntitySlime.class, DataSerializers.VARINT);
    public float squishAmount;
    public float squishFactor;
    public float prevSquishFactor;
    private boolean field_175452_bi;
    private boolean onSpawn = false;
    WorldDataRoa data = WorldDataRoa.get(worldObj);

    int randVal = 5;

    public EntityBossElgra(World worldIn) {
        super(worldIn);
        this.moveHelper = new EntityBossElgra.ElgraMoveHelper();
        this.tasks.addTask(1, new EntityBossElgra.AIElgraFloat());
        this.tasks.addTask(2, new EntityBossElgra.AIElgraAttack());
        this.tasks.addTask(3, new EntityBossElgra.AIElgraFaceRandom());
        this.tasks.addTask(5, new EntityBossElgra.AIElgraHop());
        this.targetTasks.addTask(1, new EntityAIFindEntityNearestPlayer(this));
        this.targetTasks.addTask(3, new EntityAIFindEntityNearest(this, EntityIronGolem.class));
    }

    @Override
    protected void entityInit() {
        super.entityInit();
        this.dataManager.register(SLIME_SIZE, Integer.valueOf(1));
    }

    @Override
    protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(400);
        this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(100.0D);

    }

    public void setElgraSize(int p_70799_1_) {
        this.dataManager.set(SLIME_SIZE, Integer.valueOf(p_70799_1_));
        this.setSize(0.51000005F * p_70799_1_, 0.51000005F * p_70799_1_);
        this.setPosition(this.posX, this.posY, this.posZ);
        this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue((double) (0.2F + 0.1F * p_70799_1_));
        if (p_70799_1_ < 3) {
            this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(1D);
        }
        this.experienceValue = 100;
    }

    /**
     * Returns the size of the elgra.
     */
    public int getElgraSize() {
        return ((Integer) this.dataManager.get(SLIME_SIZE)).intValue();
    }

    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    @Override
    public void writeEntityToNBT(NBTTagCompound tagCompound) {
        super.writeEntityToNBT(tagCompound);
        tagCompound.setInteger("Size", this.getElgraSize() - 1);
        tagCompound.setBoolean("wasOnGround", this.field_175452_bi);
    }

    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    @Override
    public void readEntityFromNBT(NBTTagCompound tagCompund) {
        super.readEntityFromNBT(tagCompund);
        int i = tagCompund.getInteger("Size");

        if (i < 0) {
            i = 0;
        }

        this.setElgraSize(i + 1);
        this.field_175452_bi = tagCompund.getBoolean("wasOnGround");
    }

    protected EnumParticleTypes func_180487_n() {
        return EnumParticleTypes.SLIME;
    }

    /**
     * Returns the name of the sound played when the elgra jumps.
     */
    protected SoundEvent getJumpSound() {
        return SoundEvents.ENTITY_SLIME_JUMP;
    }

    /**
     * Called to update the entity's position/logic.
     */
    @Override
    public void onUpdate() {
        if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL && this.getElgraSize() > 0) {
            this.isDead = true;
        }
        
        //******TODO BOSS SETTINGS******\\
        if(worldObj.isRemote){
            BossCustomStatus.setBossStatus(this, true);
        }
        data.setBossFight(true);
        //*********BOSS END*********\\
        
        this.setElgraSize((int) (this.getHealth() / 50) + 1);

        this.squishFactor += (this.squishAmount - this.squishFactor) * 0.5F;
        this.prevSquishFactor = this.squishFactor;
        super.onUpdate();

        if (this.onGround && !this.field_175452_bi) {
            randVal--;
            if (randVal <= 0) {
                this.jumpHigh();
                randVal = 5;

                if (this.getElgraSize() > 2) {
                    List<EntityElgraMinion> e = this.worldObj.getEntitiesWithinAABB(EntityElgraMinion.class, new AxisAlignedBB(this.posX - 100, this.posY - 100, this.posZ - 100, this.posX + 100, this.posY + 100, this.posZ + 100));

                    if (e.size() < 2) {
                        if (!worldObj.isRemote) {
                            int random = this.rand.nextInt(4) + 1;
                            for (int i = 0; i < random; ++i) {
                                EntityElgraMinion minion = new EntityElgraMinion(worldObj);
                                minion.setLocationAndAngles(this.posX + this.rand.nextInt(10) - 5, this.posY + 3, this.posZ + this.rand.nextInt(10) - 5, this.rand.nextFloat() * 360.0F, 0.0F);
                                minion.setElgraSize(2);
                                worldObj.spawnEntityInWorld(minion);
                            }
                        }

                    }
                }
            }
        }

        if (this.onGround && !this.field_175452_bi) {
            int i = this.getElgraSize();

            for (int j = 0; j < i * 8; ++j) {
                float f = this.rand.nextFloat() * (float) Math.PI * 2.0F;
                float f1 = this.rand.nextFloat() * 0.5F + 0.5F;
                float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
                float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
                World world = this.worldObj;
                EnumParticleTypes enumparticletypes = this.func_180487_n();
                double d0 = this.posX + f2;
                double d1 = this.posZ + f3;
                world.spawnParticle(enumparticletypes, d0, this.getEntityBoundingBox().minY, d1, 0.0D, 0.0D, 0.0D, new int[0]);
            }

            if (this.makesSoundOnLand()) {
                this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F);
            }

            this.squishAmount = -0.5F;
        } else if (!this.onGround && this.field_175452_bi) {
            this.squishAmount = 1.0F;
        }

        this.field_175452_bi = this.onGround;
        this.alterSquishAmount();
    }

    protected void alterSquishAmount() {
        this.squishAmount *= 0.6F;
    }

    /**
     * Gets the amount of time the elgra needs to wait between jumps.
     */
    protected int getJumpDelay() {
        if (this.getElgraSize() < 3) {
            return 10;
        } else {
            return this.rand.nextInt(20) + 10;
        }
    }

    protected EntityBossElgra createInstance() {
        return new EntityBossElgra(this.worldObj);
    }

    public void notifyDataManagerChange(DataParameter<?> key) {
        if (SLIME_SIZE.equals(key)) {
            int i = this.getElgraSize();
            this.setSize(0.51000005F * (float) i, 0.51000005F * (float) i);
            this.rotationYaw = this.rotationYawHead;
            this.renderYawOffset = this.rotationYawHead;

            if (this.isInWater() && this.rand.nextInt(20) == 0) {
                this.resetHeight();
            }
        }

        super.notifyDataManagerChange(key);
    }

    /**
     * Will get destroyed next tick.
     */
    @Override
    public void setDead() {
        List<EntityElgraMinion> minions = worldObj.getEntitiesWithinAABB(EntityElgraMinion.class, new AxisAlignedBB(posX - 100, posY - 100, posZ - 100, posX + 100, posY + 100, posZ + 100));
        for (int l = 0; l < minions.size(); l++) {
            minions.get(l).setDead();
        }
        
      //******TODO BOSS SETTINGS******\\
        data.setBossFight(false);
      //*********BOSS END*********\\

        super.setDead();

    }

    /**
     * Applies a velocity to each of the entities pushing them away from each
     * other. Args: entity
     */
    @Override
    public void applyEntityCollision(Entity entityIn) {
        super.applyEntityCollision(entityIn);

        if (entityIn instanceof EntityIronGolem && this.canDamagePlayer()) {
            this.dealDamage((EntityLivingBase) entityIn);
        }
    }

    /**
     * Called by a player entity when they collide with an entity
     */
    @Override
    public void onCollideWithPlayer(EntityPlayer entityIn) {
        if (this.canDamagePlayer()) {
            this.dealDamage(entityIn);
        }
    }

    protected void dealDamage(EntityLivingBase entityIn) {
        int i = this.getElgraSize();

        if (this.canEntityBeSeen(entityIn) && this.getDistanceSqToEntity(entityIn) < 0.6D * (double) i * 0.6D * (double) i && entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float) this.getAttackStrength())) {
            this.playSound(SoundEvents.ENTITY_SLIME_ATTACK, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
            this.applyEnchantments(this, entityIn);
        }
    }

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

    /**
     * Indicates weather the elgra is able to damage the player (based upon the
     * elgra's size)
     */
    protected boolean canDamagePlayer() {
        return true;
    }

    /**
     * Gets the amount of damage dealt to the player when "attacked" by the
     * elgra.
     */
    protected int getAttackStrength() {
        return 5;
    }

    /**
     * Returns the sound this mob makes when it is hurt.
     */
    protected SoundEvent getHurtSound() {
        return SoundEvents.ENTITY_SLIME_HURT;
    }

    protected SoundEvent getDeathSound() {
        return SoundEvents.ENTITY_SLIME_DEATH;
    }

    @Override
    protected Item getDropItem() {
        return AscenciaItems.elgra_gel;
    }

    @Override
    protected void dropFewItems(boolean b, int i) {
        int j = this.rand.nextInt(25) + 25;

        for (int k = 0; k < j; ++k) {
            this.entityDropItem(new ItemStack(AscenciaItems.elgra_gel), 1F);
        }
    }

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

    /**
     * The speed it takes to move the entityliving's rotationPitch through the
     * faceEntity method. This is only currently use in wolves.
     */
    @Override
    public int getVerticalFaceSpeed() {
        return 0;
    }

    /**
     * Returns true if the elgra makes a sound when it jumps (based upon the
     * elgra's size)
     */
    protected boolean makesSoundOnJump() {
        return this.getElgraSize() > 0;
    }

    /**
     * Returns true if the elgra makes a sound when it lands after a jump (based
     * upon the elgra's size)
     */
    protected boolean makesSoundOnLand() {
        return true;
    }

    /**
     * Causes this entity to do an upwards motion (jumping).
     */
    @Override
    protected void jump() {
        if (this.getElgraSize() > 2) {
            this.motionY = 0.41999998688697815D;
        } else {
            this.motionY = 0.5D;
        }
        this.isAirBorne = true;
    }

    protected void jumpHigh() {
        this.motionY = 2D;
        this.isAirBorne = true;
    }

    public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) {

        this.setElgraSize(;
        return super.onInitialSpawn(p_180482_1_, p_180482_2_);
    }

    class AIElgraAttack extends EntityAIBase {
        private EntityBossElgra field_179466_a = EntityBossElgra.this;
        private int field_179465_b;

        public AIElgraAttack() {
            this.setMutexBits(2);
        }

        /**
         * Returns whether the EntityAIBase should begin execution.
         */
        @Override
        public boolean shouldExecute() {
            EntityLivingBase entitylivingbase = this.field_179466_a.getAttackTarget();
            return entitylivingbase == null ? false : entitylivingbase.isEntityAlive();
        }

        /**
         * Execute a one shot task or start executing a continuous task
         */
        @Override
        public void startExecuting() {
            this.field_179465_b = 300;
            super.startExecuting();
        }

        /**
         * Returns whether an in-progress EntityAIBase should continue executing
         */
        @Override
        public boolean continueExecuting() {
            EntityLivingBase entitylivingbase = this.field_179466_a.getAttackTarget();
            return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : --this.field_179465_b > 0);
        }

        /**
         * Updates the task
         */
        @Override
        public void updateTask() {
            this.field_179466_a.faceEntity(this.field_179466_a.getAttackTarget(), 10.0F, 10.0F);
            ((EntityBossElgra.ElgraMoveHelper) this.field_179466_a.getMoveHelper()).func_179920_a(this.field_179466_a.rotationYaw, this.field_179466_a.canDamagePlayer());
        }
    }

    class AIElgraFaceRandom extends EntityAIBase {
        private EntityBossElgra field_179461_a = EntityBossElgra.this;
        private float field_179459_b;
        private int field_179460_c;

        public AIElgraFaceRandom() {
            this.setMutexBits(2);
        }

        /**
         * Returns whether the EntityAIBase should begin execution.
         */
        @Override
        public boolean shouldExecute() {
            return this.field_179461_a.getAttackTarget() == null && (this.field_179461_a.onGround || this.field_179461_a.isInWater() || this.field_179461_a.isInLava());
        }

        /**
         * Updates the task
         */
        @Override
        public void updateTask() {
            if (--this.field_179460_c <= 0) {
                this.field_179460_c = 40 + this.field_179461_a.getRNG().nextInt(60);
                this.field_179459_b = this.field_179461_a.getRNG().nextInt(360);
            }

            ((EntityBossElgra.ElgraMoveHelper) this.field_179461_a.getMoveHelper()).func_179920_a(this.field_179459_b, false);
        }
    }

    class AIElgraFloat extends EntityAIBase {
        private EntityBossElgra field_179457_a = EntityBossElgra.this;

        public AIElgraFloat() {
            this.setMutexBits(5);
            ((PathNavigateGround) EntityBossElgra.this.getNavigator()).setCanSwim(true);
        }

        /**
         * Returns whether the EntityAIBase should begin execution.
         */
        @Override
        public boolean shouldExecute() {
            return this.field_179457_a.isInWater() || this.field_179457_a.isInLava();
        }

        /**
         * Updates the task
         */
        @Override
        public void updateTask() {
            if (this.field_179457_a.getRNG().nextFloat() < 0.8F) {
                this.field_179457_a.getJumpHelper().setJumping();
            }

            ((EntityBossElgra.ElgraMoveHelper) this.field_179457_a.getMoveHelper()).func_179921_a(1.2D);
        }
    }

    class AIElgraHop extends EntityAIBase {
        private EntityBossElgra field_179458_a = EntityBossElgra.this;

        public AIElgraHop() {
            this.setMutexBits(5);
        }

        /**
         * Returns whether the EntityAIBase should begin execution.
         */
        @Override
        public boolean shouldExecute() {
            return true;
        }

        /**
         * Updates the task
         */
        @Override
        public void updateTask() {
            ((EntityBossElgra.ElgraMoveHelper) this.field_179458_a.getMoveHelper()).func_179921_a(1.0D);
        }
    }

    class ElgraMoveHelper extends EntityMoveHelper {
        private float field_179922_g;
        private int field_179924_h;
        private EntityBossElgra field_179925_i = EntityBossElgra.this;
        private boolean field_179923_j;

        public ElgraMoveHelper() {
            super(EntityBossElgra.this);
        }

        public void func_179920_a(float p_179920_1_, boolean p_179920_2_) {
            this.field_179922_g = p_179920_1_;
            this.field_179923_j = p_179920_2_;
        }

        public void func_179921_a(double p_179921_1_) {
            this.speed = p_179921_1_;
            this.action = EntityMoveHelper.Action.MOVE_TO;
        }

        @Override
        public void onUpdateMoveHelper() {
            this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw, this.field_179922_g, 30.0F);
            this.entity.rotationYawHead = this.entity.rotationYaw;
            this.entity.renderYawOffset = this.entity.rotationYaw;

            if (this.action != EntityMoveHelper.Action.MOVE_TO) {
                this.entity.setMoveForward(0.0F);
            } else {
                this.action = EntityMoveHelper.Action.WAIT;

                if (this.entity.onGround) {
                    this.entity.setAIMoveSpeed((float) (this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue()));

                    if (this.field_179924_h-- <= 0) {
                        this.field_179924_h = this.field_179925_i.getJumpDelay();

                        if (this.field_179923_j) {
                            this.field_179924_h /= 3;
                        }

                        this.field_179925_i.getJumpHelper().setJumping();

                        if (this.field_179925_i.makesSoundOnJump()) {
                            this.field_179925_i.playSound(this.field_179925_i.getJumpSound(), this.field_179925_i.getSoundVolume(), ((this.field_179925_i.getRNG().nextFloat() - this.field_179925_i.getRNG().nextFloat()) * 0.2F + 1.0F) * 0.8F);
                        }
                    } else {
                        this.field_179925_i.moveStrafing = this.field_179925_i.moveForward = 0.0F;
                        this.entity.setAIMoveSpeed(0.0F);
                    }
                } else {
                    this.entity.setAIMoveSpeed((float) (this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue()));
                }
            }
        }
    }

}

 

 

BossCustomStatus:

 

package com.thecallunxz.realmsofascencia.entities.mobs.bosses;

public class BossCustomStatus {

    public static float healthScale;
    public static int statusBarTime;
    public static String bossName;
    public static boolean hasColorModifier;

    public static void setBossStatus(IBossCustom boss, boolean bool) {
        healthScale = boss.getHealth() / boss.getMaxHealth();
        statusBarTime = 100;
        bossName = boss.getDisplayName().getFormattedText();
        hasColorModifier = bool;
    }
}

 

Link to comment
Share on other sites

Ah, I see what's happening now.

 

In the deobfuscated environment,

IBossCustom#getHealth

is implemented by

EntityLivingBase#getHealth

in

EntityBossElgra

; but in the obfuscated environment,

EntityLivingBase#getHealth

has an SRG name like

func_0001_a

so there's no longer a

getHealth

method to implement

IBossCustom#getHealth

.

 

If you want a completely custom boss overlay, either rename the

IBossCustom

methods so they're not implemented by vanilla methods or replace your current boss system with a copy of vanilla's

BossInfo

system, modify it to your needs and use it like

EntityWither

does.

 

If you want to use the vanilla overlay, just use

BossInfo

like

EntityWither

does.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



×
×
  • Create New...

Important Information

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