Here is the Parent Class
ublic class ParentEntity extends Monster {
private final ParentEntityCopy[] copyarr = new ParentEntityCopy[1];
private int tostart = 0;
public ParentEntity(EntityType<? extends Monster> type, Level level) {
super(type, level);
this.noCulling = true;
for (int i = 0; i < copyarr.length; i++) {
copyarr[i] = new ParentEntityCopy(this);
}
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, false));
}
public static AttributeSupplier.Builder registerAttributes() {
return Monster.createMobAttributes()
.add(Attributes.MAX_HEALTH, 10.0D)
.add(Attributes.ARMOR, 10.0D)
.add(Attributes.ATTACK_DAMAGE, 10.0D)
.add(Attributes.MOVEMENT_SPEED, 1D)
.add(Attributes.FOLLOW_RANGE, 64.0D);
}
@Override
public void tick() {
super.tick();
for (int i = 0; i < copyarr.length; i++) {
ParentEntityCopy copy = copyarr[i];
copy.tick();
if (tostart == 0){
copy.setPos(getX(),getY(),getZ());
}
}
tostart = 1;
}
@Override
public boolean hurt(DamageSource pSource, float pAmount) {
return super.hurt(pSource, pAmount);
}
@Override
public void remove(RemovalReason reason) {
super.remove(reason);
if (this.level instanceof ServerLevel) {
for (ParentEntityCopy part : copyarr) {
part.remove(RemovalReason.KILLED);
}
}
}
@Nullable
@Override
public PartEntity<?>[] getParts() {
return copyarr;
}
@Override
public boolean isMultipartEntity() {
return true;
}
}