#pass an instance

1 messages · Page 1 of 1 (latest)

covert goblet
#

how can i pass an instance of this class into the main class ```public class PetGoal implements Goal<Mob>, Listener {

private final GoalKey<Mob> key = GoalKey.of(Mob.class, new NamespacedKey("firstplugin", "key"));
private final Mob mob;
private final LivingEntity owner;

private LivingEntity target;
private boolean attackPlayers = true;
private boolean attackMobs = true;

private double moveDistance = 3.5D;
private double maxDistance = 16D;
private double maxForgetTargetDistance = 40D;

private boolean active = true;

public PetGoal(Mob mob, LivingEntity owner){
    this.mob = mob;
    this.owner = owner;

}

public PetGoal(Mob mob, LivingEntity owner, boolean attackMobs, boolean attackPlayers ){
    this.mob = mob;
    this.owner = owner;
    this.attackMobs = attackMobs;
    this.attackPlayers = attackPlayers;


}```
lime swallowBOT
#

<@&987246652869971988> please have a look, thanks.

mild token
#

? You just create an instance and pass that to your Main?

#

I don't know Minecraft btw

#

Are you talking about how to create an instance? Just call its constructor

minor dirge
#

Let's rephrase this, what do you want to do? Your main class serves as the starting point, so do you instead not want to create an instance there?