Skip to content

Commit

Permalink
Merge branch 'remapping'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakllp committed Aug 24, 2021
2 parents 920cb10 + 5fd1478 commit c5cb6ac
Show file tree
Hide file tree
Showing 210 changed files with 4,441 additions and 4,260 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@

package de.Keyle.MyPet.api.entity;

import de.Keyle.MyPet.api.entity.ai.AIGoalSelector;
import de.Keyle.MyPet.api.entity.ai.navigation.AbstractNavigation;
import de.Keyle.MyPet.api.entity.ai.target.TargetPriority;
import de.Keyle.MyPet.api.player.MyPetPlayer;
import java.util.UUID;

import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;

import java.util.UUID;
import de.Keyle.MyPet.api.entity.ai.AIGoalSelector;
import de.Keyle.MyPet.api.entity.ai.navigation.AbstractNavigation;
import de.Keyle.MyPet.api.entity.ai.target.TargetPriority;
import de.Keyle.MyPet.api.player.MyPetPlayer;

public interface MyPetMinecraftEntity {
boolean isMyPet();
Expand Down Expand Up @@ -57,12 +58,8 @@ public interface MyPetMinecraftEntity {

void updateVisuals();

LivingEntity getTarget();

TargetPriority getTargetPriority();

void setTarget(LivingEntity entity, TargetPriority priority);

void forgetTarget();

boolean hasTarget();
Expand All @@ -78,4 +75,8 @@ public interface MyPetMinecraftEntity {
boolean isSitting();

UUID getUniqueID();

LivingEntity getMyPetTarget();

void setMyPetTarget(LivingEntity entity, TargetPriority priority);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import org.bukkit.inventory.ItemStack;

public interface CustomInventory {
int getSize();

void setSize(int size);

String getName();
Expand Down
2 changes: 1 addition & 1 deletion modules/MyPet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>de.keyle</groupId>
<artifactId>mypet</artifactId>
<version>3.12-dev4</version>
<version>3.12-dev5</version>
<packaging>jar</packaging>
<name>MyPet</name>
<url>https://www.spigotmc.org/resources/mypet.12725/</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public void onMyPet(final EntityDeathEvent event) {
if (deadBehaviorSkill.getBehavior() == BehaviorMode.Duel && killerBehaviorSkill.getBehavior() == BehaviorMode.Duel) {
MyPetMinecraftEntity myPetEntity = ((MyPetBukkitEntity) deadEntity).getHandle();

if (e.getDamager().equals(myPetEntity.getTarget())) {
if (e.getDamager().equals(myPetEntity.getMyPetTarget())) {
myPet.setRespawnTime(10);
killerMyPet.setHealth(Double.MAX_VALUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void forgetTarget() {
}

public void setTarget(LivingEntity target, TargetPriority priority) {
getHandle().setTarget(target, priority);
getHandle().setMyPetTarget(target, priority);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ public boolean hasTarget() {
public TargetPriority getTargetPriority() {
return targetPriority;
}

public LivingEntity getTarget() {

@Override
public LivingEntity getMyPetTarget() {
if (target != null) {
if (target.isAlive()) {
return (LivingEntity) target.getBukkitEntity();
Expand All @@ -208,8 +209,9 @@ public LivingEntity getTarget() {
}
return null;
}

public void setTarget(LivingEntity entity, TargetPriority priority) {

@Override
public void setMyPetTarget(LivingEntity entity, TargetPriority priority) {
if (entity == null || entity.isDead() || entity instanceof ArmorStand || !(entity instanceof CraftLivingEntity)) {
forgetTarget();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public boolean shouldStart() {
if (!this.petEntity.hasTarget()) {
return false;
}
EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

if (targetEntity instanceof EntityArmorStand) {
return false;
Expand Down Expand Up @@ -92,7 +92,7 @@ public boolean shouldStart() {
public boolean shouldFinish() {
if (!this.petEntity.hasTarget() || !this.petEntity.canMove()) {
return true;
} else if (this.targetEntity.getBukkitEntity() != this.petEntity.getTarget()) {
} else if (this.targetEntity.getBukkitEntity() != this.petEntity.getMyPetTarget()) {
return true;
}
if (petEntity.getMyPet().getRangedDamage() > 0 && this.petEntity.e(targetEntity.locX, targetEntity.getBoundingBox().b, targetEntity.locZ) >= 20) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public boolean shouldStart() {
return false;
}

EntityLiving target = ((CraftLivingEntity) this.entityMyPet.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) this.entityMyPet.getMyPetTarget()).getHandle();

if (target instanceof EntityArmorStand) {
return false;
Expand Down Expand Up @@ -102,7 +102,7 @@ public boolean shouldFinish() {
if (!entityMyPet.hasTarget() || myPet.getRangedDamage() <= 0 || !entityMyPet.canMove()) {
return true;
}
if (this.target.getBukkitEntity() != entityMyPet.getTarget()) {
if (this.target.getBukkitEntity() != entityMyPet.getMyPetTarget()) {
return true;
}
double meleeDamage = myPet.getDamage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public boolean shouldStart() {
return false;
} else if (entityMySheep.getRandom().nextInt(1000) != 0) {
return false;
} else if (this.entityMySheep.getTarget() != null && !this.entityMySheep.getTarget().isDead()) {
} else if (this.entityMySheep.getMyPetTarget() != null && !this.entityMySheep.getMyPetTarget().isDead()) {
return false;
}
int blockLocX = MathHelper.floor(this.entityMySheep.locX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public boolean shouldStart() {
}
if (!this.petEntity.canMove()) {
return false;
} else if (this.petEntity.getTarget() != null && !this.petEntity.getTarget().isDead()) {
} else if (this.petEntity.getMyPetTarget() != null && !this.petEntity.getMyPetTarget().isDead()) {
return false;
} else if (this.petEntity.getOwner() == null) {
return false;
Expand All @@ -81,7 +81,7 @@ public boolean shouldFinish() {
return true;
} else if (!this.petEntity.canMove()) {
return true;
} else if (this.petEntity.getTarget() != null && !this.petEntity.getTarget().isDead()) {
} else if (this.petEntity.getMyPetTarget() != null && !this.petEntity.getMyPetTarget().isDead()) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public boolean shouldStart() {
if (this.petEntity.getRandom().nextFloat() >= this.lookAtPlayerChance) {
return false;
}
if (this.petEntity.getTarget() != null && !this.petEntity.getTarget().isDead()) {
if (this.petEntity.getMyPetTarget() != null && !this.petEntity.getMyPetTarget().isDead()) {
return false;
}
if (this.petEntity.isVehicle()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public RandomLookaround(EntityMyPet petEntity) {

@Override
public boolean shouldStart() {
if (this.petEntity.getTarget() != null && !this.petEntity.getTarget().isDead()) {
if (this.petEntity.getMyPetTarget() != null && !this.petEntity.getMyPetTarget().isDead()) {
return false;
}
if (this.petEntity.isVehicle()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public boolean shouldStart() {
return false;
}

EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

if (!targetEntity.isAlive()) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ public boolean shouldStart() {
public boolean shouldFinish() {
if (!petEntity.canMove()) {
return true;
} else if (petEntity.getTarget() == null) {
} else if (petEntity.getMyPetTarget() == null) {
return true;
}

EntityLiving target = ((CraftLivingEntity) petEntity.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) petEntity.getMyPetTarget()).getHandle();

if (!target.isAlive()) {
return true;
Expand All @@ -133,7 +133,7 @@ public boolean shouldFinish() {

@Override
public void start() {
petEntity.setTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.Aggressive);
petEntity.setMyPetTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.Aggressive);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public boolean shouldFinish() {
return true;
}

EntityLiving target = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
if (behaviorSkill.getBehavior() != BehaviorMode.Duel) {
Expand All @@ -118,7 +118,7 @@ public boolean shouldFinish() {

@Override
public void start() {
petEntity.setTarget(this.target.getBukkitEntity(), TargetPriority.Duel);
petEntity.setMyPetTarget(this.target.getBukkitEntity(), TargetPriority.Duel);
setDuelOpponent(this.target);
if (target.getTargetSelector().hasGoal("DuelTarget")) {
BehaviorDuelTarget duelGoal = (BehaviorDuelTarget) target.getTargetSelector().getGoal("DuelTarget");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public boolean shouldFinish() {
if (!this.petEntity.hasTarget()) {
return true;
}
EntityLiving target = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

if (!target.isAlive()) {
return true;
Expand All @@ -109,7 +109,7 @@ public boolean shouldFinish() {

@Override
public void start() {
petEntity.setTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.Farm);
petEntity.setMyPetTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.Farm);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public boolean shouldFinish() {
return true;
}

EntityLiving target = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

if (target.world != petEntity.world) {
return true;
Expand All @@ -143,7 +143,7 @@ public boolean shouldFinish() {

@Override
public void start() {
petEntity.setTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.Control);
petEntity.setMyPetTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.Control);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public boolean shouldFinish() {
return true;
}

EntityLiving target = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

if (target.world != petEntity.world) {
return true;
Expand All @@ -112,7 +112,7 @@ public boolean shouldFinish() {

@Override
public void start() {
petEntity.setTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.GetHurt);
petEntity.setMyPetTarget((LivingEntity) this.target.getBukkitEntity(), TargetPriority.GetHurt);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public boolean shouldFinish() {
return true;
}

EntityLiving target = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

if (target.world != petEntity.world) {
return true;
Expand All @@ -139,7 +139,7 @@ public boolean shouldFinish() {

@Override
public void start() {
petEntity.setTarget((LivingEntity) this.lastDamager.getBukkitEntity(), TargetPriority.OwnerGetsHurt);
petEntity.setMyPetTarget((LivingEntity) this.lastDamager.getBukkitEntity(), TargetPriority.OwnerGetsHurt);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void onLivingUpdate() {
if (this.onGround && getNavigation().l() != null && jumpDelay-- <= 0) {
getControllerJump().a();
jumpDelay = (this.random.nextInt(10) + 10);
if (getTarget() != null) {
if (getMyPetTarget() != null) {
jumpDelay /= 3;
}
this.world.broadcastEntityEffect(this, (byte) 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void forgetTarget() {

@Override
public void setTarget(LivingEntity target, TargetPriority priority) {
getHandle().setTarget(target, priority);
getHandle().setMyPetTarget(target, priority);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public TargetPriority getTargetPriority() {
}

@Override
public LivingEntity getTarget() {
public LivingEntity getMyPetTarget() {
if (target != null) {
if (target.isAlive()) {
return (LivingEntity) target.getBukkitEntity();
Expand All @@ -239,7 +239,7 @@ public LivingEntity getTarget() {
}

@Override
public void setTarget(LivingEntity entity, TargetPriority priority) {
public void setMyPetTarget(LivingEntity entity, TargetPriority priority) {
if (entity == null || entity.isDead() || entity instanceof ArmorStand || !(entity instanceof CraftLivingEntity)) {
forgetTarget();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public boolean shouldStart() {
if (!this.petEntity.hasTarget()) {
return false;
}
EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();

if (targetEntity instanceof EntityArmorStand) {
return false;
Expand Down Expand Up @@ -93,7 +93,7 @@ public boolean shouldStart() {
public boolean shouldFinish() {
if (!this.petEntity.hasTarget() || !this.petEntity.canMove()) {
return true;
} else if (this.targetEntity.getBukkitEntity() != this.petEntity.getTarget()) {
} else if (this.targetEntity.getBukkitEntity() != this.petEntity.getMyPetTarget()) {
return true;
}
if (petEntity.getMyPet().getRangedDamage() > 0 && this.petEntity.g(targetEntity.locX(), targetEntity.getBoundingBox().minY, targetEntity.locZ()) >= 20) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public boolean shouldStart() {
return false;
}

EntityLiving target = ((CraftLivingEntity) this.entityMyPet.getTarget()).getHandle();
EntityLiving target = ((CraftLivingEntity) this.entityMyPet.getMyPetTarget()).getHandle();

if (target instanceof EntityArmorStand) {
return false;
Expand Down Expand Up @@ -102,7 +102,7 @@ public boolean shouldFinish() {
if (!entityMyPet.hasTarget() || myPet.getRangedDamage() <= 0 || !entityMyPet.canMove()) {
return true;
}
if (this.target.getBukkitEntity() != entityMyPet.getTarget()) {
if (this.target.getBukkitEntity() != entityMyPet.getMyPetTarget()) {
return true;
}
double meleeDamage = myPet.getDamage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public boolean shouldStart() {
return false;
} else if (entityMySheep.getRandom().nextInt(1000) != 0) {
return false;
} else if (this.entityMySheep.getTarget() != null && !this.entityMySheep.getTarget().isDead()) {
} else if (this.entityMySheep.getMyPetTarget() != null && !this.entityMySheep.getMyPetTarget().isDead()) {
return false;
}
int blockLocX = MathHelper.floor(this.entityMySheep.locX());
Expand Down
Loading

0 comments on commit c5cb6ac

Please sign in to comment.