Started by
thebebist
on
Topic category: Help with Minecraft modding (Java Edition)
i am trying to make my mob do the vex charged attack with this code: this.tasks.addTask(1, new EntityVex.AIChargeAttack());
but i can´t figure out what imports i need to use to get it to work
here is the error log i get:
C:\Pylo\MCreator181\forge\build\sources\main\java\mod\mcreator\mcreator_killagerboss.java:88: error: EntityVex.AIChargeAttack is not public in EntityVex; cannot be accessed from outside package
this.tasks.addTask(1, new EntityVex.AIChargeAttack());
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Pylo\MCreator181\forge\build\sources\main\java\mod\mcreator\mcreator_killagerboss.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
You can't import "EntityVex.AIChargeAttack". The "EntityVex" at the start is saying that the AI is in the Entity's Code. It searches for a class named "AIChargeAttack" in "EntityVex". You can only import the requirements to create the A.I. This is the AI:
class AIChargeAttack extends EntityAIBase
{
public AIChargeAttack()
{
this.setMutexBits(1);
}
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
if (EntityVex.this.getAttackTarget() != null && !EntityVex.this.getMoveHelper().isUpdating() && EntityVex.this.rand.nextInt(7) == 0)
{
return EntityVex.this.getDistanceSq(EntityVex.this.getAttackTarget()) > 4.0D;
}
else
{
return false;
}
}
/**
* Returns whether an in-progress EntityAIBase should continue executing
*/
public boolean shouldContinueExecuting()
{
return EntityVex.this.getMoveHelper().isUpdating() && EntityVex.this.isCharging() && EntityVex.this.getAttackTarget() != null && EntityVex.this.getAttackTarget().isEntityAlive();
}
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting()
{
EntityLivingBase entitylivingbase = EntityVex.this.getAttackTarget();
Vec3d vec3d = entitylivingbase.getPositionEyes(1.0F);
EntityVex.this.moveHelper.setMoveTo(vec3d.x, vec3d.y, vec3d.z, 1.0D);
EntityVex.this.setCharging(true);
EntityVex.this.playSound(SoundEvents.ENTITY_VEX_CHARGE, 1.0F, 1.0F);
}
/**
* Reset the task's internal state. Called when this task is interrupted by another one
*/
public void resetTask()
{
EntityVex.this.setCharging(false);
}
/**
* Keep ticking a continuous task that has already been started
*/
public void updateTask()
{
EntityLivingBase entitylivingbase = EntityVex.this.getAttackTarget();
if (EntityVex.this.getEntityBoundingBox().intersects(entitylivingbase.getEntityBoundingBox()))
{
EntityVex.this.attackEntityAsMob(entitylivingbase);
EntityVex.this.setCharging(false);
}
else
{
double d0 = EntityVex.this.getDistanceSq(entitylivingbase);
if (d0 < 9.0D)
{
Vec3d vec3d = entitylivingbase.getPositionEyes(1.0F);
EntityVex.this.moveHelper.setMoveTo(vec3d.x, vec3d.y, vec3d.z, 1.0D);
}
}
}
}
But now when I think about it, it should also work, if you import EntityVex