diff --git a/pom.xml b/pom.xml
index a6644ff68..5e063194c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,13 +6,13 @@
net.citizensnpcs
citizens
- 2.0.13-SNAPSHOT
+ 2.0.14-SNAPSHOT
Citizens
UTF-8
- 1.7.10-R0.1-SNAPSHOT
- 2.0.13-SNAPSHOT
+ 1.8-R0.1-SNAPSHOT
+ 2.0.14-SNAPSHOT
1.4.1
1.4.12
Unknown
diff --git a/src/main/java/net/citizensnpcs/Citizens.java b/src/main/java/net/citizensnpcs/Citizens.java
index 6f03db631..b83ac3718 100644
--- a/src/main/java/net/citizensnpcs/Citizens.java
+++ b/src/main/java/net/citizensnpcs/Citizens.java
@@ -454,5 +454,5 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
return false;
}
- private static final String COMPATIBLE_MC_VERSION = "1.7.10";
+ private static final String COMPATIBLE_MC_VERSION = "1.8";
}
diff --git a/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/src/main/java/net/citizensnpcs/commands/NPCCommands.java
index aaa6c4d01..08a6f66fc 100644
--- a/src/main/java/net/citizensnpcs/commands/NPCCommands.java
+++ b/src/main/java/net/citizensnpcs/commands/NPCCommands.java
@@ -268,7 +268,7 @@ public class NPCCommands {
}
CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, copy)
- : new CommandSenderCreateNPCEvent(sender, copy);
+ : new CommandSenderCreateNPCEvent(sender, copy);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
event.getNPC().destroy();
@@ -344,7 +344,7 @@ public class NPCCommands {
spawnLoc = args.getSenderLocation();
}
CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, npc)
- : new CommandSenderCreateNPCEvent(sender, npc);
+ : new CommandSenderCreateNPCEvent(sender, npc);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
npc.destroy();
@@ -1021,7 +1021,7 @@ public class NPCCommands {
@Requirements(selected = true, ownership = true, types = { EntityType.CREEPER })
public void power(CommandContext args, CommandSender sender, NPC npc) {
Messaging
- .sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED);
+ .sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED);
}
@Command(
@@ -1044,7 +1044,7 @@ public class NPCCommands {
}
@Command(aliases = { "npc" }, usage = "remove|rem (all|id|name)", desc = "Remove a NPC", modifiers = { "remove",
- "rem" }, min = 1, max = 2)
+ "rem" }, min = 1, max = 2)
@Requirements
public void remove(final CommandContext args, final CommandSender sender, NPC npc) throws CommandException {
if (args.argsLength() == 2) {
diff --git a/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/src/main/java/net/citizensnpcs/npc/CitizensNPC.java
index fe80fafed..9d8782055 100644
--- a/src/main/java/net/citizensnpcs/npc/CitizensNPC.java
+++ b/src/main/java/net/citizensnpcs/npc/CitizensNPC.java
@@ -23,12 +23,12 @@ import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
+import net.minecraft.server.v1_8_R1.PacketPlayOutEntityTeleport;
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftLivingEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@@ -169,7 +169,7 @@ public class CitizensNPC extends AbstractNPC {
at = at.clone();
getTrait(CurrentLocation.class).setLocation(at);
entityController.spawn(at, this);
- net.minecraft.server.v1_7_R4.Entity mcEntity = ((CraftEntity) getEntity()).getHandle();
+ net.minecraft.server.v1_8_R1.Entity mcEntity = ((CraftEntity) getEntity()).getHandle();
boolean couldSpawn = !Util.isLoaded(at) ? false : mcEntity.world.addEntity(mcEntity, SpawnReason.CUSTOM);
mcEntity.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
if (!couldSpawn) {
diff --git a/src/main/java/net/citizensnpcs/npc/EntityControllers.java b/src/main/java/net/citizensnpcs/npc/EntityControllers.java
index fa23a642a..500d649fe 100644
--- a/src/main/java/net/citizensnpcs/npc/EntityControllers.java
+++ b/src/main/java/net/citizensnpcs/npc/EntityControllers.java
@@ -10,8 +10,10 @@ import net.citizensnpcs.npc.entity.CowController;
import net.citizensnpcs.npc.entity.CreeperController;
import net.citizensnpcs.npc.entity.EnderDragonController;
import net.citizensnpcs.npc.entity.EndermanController;
+import net.citizensnpcs.npc.entity.EndermiteController;
import net.citizensnpcs.npc.entity.GhastController;
import net.citizensnpcs.npc.entity.GiantController;
+import net.citizensnpcs.npc.entity.GuardianController;
import net.citizensnpcs.npc.entity.HorseController;
import net.citizensnpcs.npc.entity.HumanController;
import net.citizensnpcs.npc.entity.IronGolemController;
@@ -20,6 +22,7 @@ import net.citizensnpcs.npc.entity.MushroomCowController;
import net.citizensnpcs.npc.entity.OcelotController;
import net.citizensnpcs.npc.entity.PigController;
import net.citizensnpcs.npc.entity.PigZombieController;
+import net.citizensnpcs.npc.entity.RabbitController;
import net.citizensnpcs.npc.entity.SheepController;
import net.citizensnpcs.npc.entity.SilverfishController;
import net.citizensnpcs.npc.entity.SkeletonController;
@@ -32,6 +35,7 @@ import net.citizensnpcs.npc.entity.WitchController;
import net.citizensnpcs.npc.entity.WitherController;
import net.citizensnpcs.npc.entity.WolfController;
import net.citizensnpcs.npc.entity.ZombieController;
+import net.citizensnpcs.npc.entity.nonliving.ArmorStandController;
import net.citizensnpcs.npc.entity.nonliving.ArrowController;
import net.citizensnpcs.npc.entity.nonliving.BoatController;
import net.citizensnpcs.npc.entity.nonliving.EggController;
@@ -89,6 +93,7 @@ public class EntityControllers {
static {
TYPES.put(EntityType.ARROW, ArrowController.class);
+ TYPES.put(EntityType.ARMOR_STAND, ArmorStandController.class);
TYPES.put(EntityType.BAT, BatController.class);
TYPES.put(EntityType.BLAZE, BlazeController.class);
TYPES.put(EntityType.BOAT, BoatController.class);
@@ -103,12 +108,14 @@ public class EntityControllers {
TYPES.put(EntityType.ENDER_PEARL, EnderPearlController.class);
TYPES.put(EntityType.ENDER_SIGNAL, EnderSignalController.class);
TYPES.put(EntityType.ENDERMAN, EndermanController.class);
+ TYPES.put(EntityType.ENDERMITE, EndermiteController.class);
TYPES.put(EntityType.FALLING_BLOCK, FallingBlockController.class);
TYPES.put(EntityType.FIREWORK, FireworkController.class);
TYPES.put(EntityType.FIREBALL, LargeFireballController.class);
TYPES.put(EntityType.FISHING_HOOK, FishingHookController.class);
TYPES.put(EntityType.GHAST, GhastController.class);
TYPES.put(EntityType.GIANT, GiantController.class);
+ TYPES.put(EntityType.GUARDIAN, GuardianController.class);
TYPES.put(EntityType.HORSE, HorseController.class);
TYPES.put(EntityType.IRON_GOLEM, IronGolemController.class);
TYPES.put(EntityType.ITEM_FRAME, ItemFrameController.class);
@@ -126,6 +133,7 @@ public class EntityControllers {
TYPES.put(EntityType.PIG, PigController.class);
TYPES.put(EntityType.PIG_ZOMBIE, PigZombieController.class);
TYPES.put(EntityType.PLAYER, HumanController.class);
+ TYPES.put(EntityType.RABBIT, RabbitController.class);
TYPES.put(EntityType.SHEEP, SheepController.class);
TYPES.put(EntityType.SILVERFISH, SilverfishController.class);
TYPES.put(EntityType.SKELETON, SkeletonController.class);
diff --git a/src/main/java/net/citizensnpcs/npc/MobEntityController.java b/src/main/java/net/citizensnpcs/npc/MobEntityController.java
index 43e6fea9a..68d643fa8 100644
--- a/src/main/java/net/citizensnpcs/npc/MobEntityController.java
+++ b/src/main/java/net/citizensnpcs/npc/MobEntityController.java
@@ -4,11 +4,11 @@ import java.lang.reflect.Constructor;
import java.util.Map;
import net.citizensnpcs.api.npc.NPC;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
-import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
+import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
import org.bukkit.entity.Entity;
import com.google.common.collect.Maps;
@@ -23,7 +23,7 @@ public abstract class MobEntityController extends AbstractEntityController {
@Override
protected Entity createEntity(Location at, NPC npc) {
- net.minecraft.server.v1_7_R4.Entity entity = createEntityFromClass(((CraftWorld) at.getWorld()).getHandle(),
+ net.minecraft.server.v1_8_R1.Entity entity = createEntityFromClass(((CraftWorld) at.getWorld()).getHandle(),
npc);
entity.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
@@ -36,9 +36,9 @@ public abstract class MobEntityController extends AbstractEntityController {
return entity.getBukkitEntity();
}
- private net.minecraft.server.v1_7_R4.Entity createEntityFromClass(Object... args) {
+ private net.minecraft.server.v1_8_R1.Entity createEntityFromClass(Object... args) {
try {
- return (net.minecraft.server.v1_7_R4.Entity) constructor.newInstance(args);
+ return (net.minecraft.server.v1_8_R1.Entity) constructor.newInstance(args);
} catch (Exception ex) {
ex.printStackTrace();
return null;
diff --git a/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java b/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java
index cf2b6f930..e1c52619b 100644
--- a/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java
+++ b/src/main/java/net/citizensnpcs/npc/ai/AStarNavigationStrategy.java
@@ -69,7 +69,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
}
vector = plan.getCurrentVector();
}
- net.minecraft.server.v1_7_R4.Entity handle = NMS.getHandle(npc.getEntity());
+ net.minecraft.server.v1_8_R1.Entity handle = NMS.getHandle(npc.getEntity());
double dX = vector.getBlockX() - handle.locX;
double dZ = vector.getBlockZ() - handle.locZ;
double dY = vector.getY() - handle.locY;
diff --git a/src/main/java/net/citizensnpcs/npc/ai/BlockBreaker.java b/src/main/java/net/citizensnpcs/npc/ai/BlockBreaker.java
index 0387fa180..271cf2454 100644
--- a/src/main/java/net/citizensnpcs/npc/ai/BlockBreaker.java
+++ b/src/main/java/net/citizensnpcs/npc/ai/BlockBreaker.java
@@ -5,19 +5,20 @@ import net.citizensnpcs.api.ai.tree.BehaviorStatus;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.PlayerAnimation;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.Block;
-import net.minecraft.server.v1_7_R4.Blocks;
-import net.minecraft.server.v1_7_R4.Enchantment;
-import net.minecraft.server.v1_7_R4.EnchantmentManager;
-import net.minecraft.server.v1_7_R4.EntityLiving;
-import net.minecraft.server.v1_7_R4.EntityPlayer;
-import net.minecraft.server.v1_7_R4.ItemStack;
-import net.minecraft.server.v1_7_R4.Material;
-import net.minecraft.server.v1_7_R4.MobEffectList;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.Blocks;
+import net.minecraft.server.v1_8_R1.Enchantment;
+import net.minecraft.server.v1_8_R1.EnchantmentManager;
+import net.minecraft.server.v1_8_R1.EntityLiving;
+import net.minecraft.server.v1_8_R1.EntityPlayer;
+import net.minecraft.server.v1_8_R1.ItemStack;
+import net.minecraft.server.v1_8_R1.Material;
+import net.minecraft.server.v1_8_R1.MobEffectList;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
-import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -45,12 +46,12 @@ public class BlockBreaker extends BehaviorGoalAdapter {
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
}
- private net.minecraft.server.v1_7_R4.ItemStack getCurrentItem() {
+ private net.minecraft.server.v1_8_R1.ItemStack getCurrentItem() {
return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) : entity.getEquipment(0);
}
private float getStrength(Block block) {
- float base = block.f(null, 0, 0, 0);
+ float base = block.g(null, new BlockPosition(0, 0, 0));
return base < 0.0F ? 0.0F : (!isDestroyable(block) ? 1.0F / base / 100.0F : strengthMod(block) / base / 30.0F);
}
@@ -100,7 +101,7 @@ public class BlockBreaker extends BehaviorGoalAdapter {
if (entity instanceof EntityPlayer) {
PlayerAnimation.ARM_SWING.play((Player) entity.getBukkitEntity());
}
- Block block = entity.world.getType(x, y, z);
+ Block block = entity.world.getType(new BlockPosition(x, y, z)).getBlock();
if (block == null || block == Blocks.AIR) {
return BehaviorStatus.SUCCESS;
} else {
@@ -121,12 +122,12 @@ public class BlockBreaker extends BehaviorGoalAdapter {
}
private void setBlockDamage(int modifiedDamage) {
- entity.world.d(entity.getId(), x, y, z, modifiedDamage);
+ entity.world.c(entity.getId(), new BlockPosition(x, y, z), modifiedDamage);
}
@Override
public boolean shouldExecute() {
- return entity.world.getType(x, y, z) != Blocks.AIR;
+ return entity.world.getType(new BlockPosition(x, y, z)).getBlock() != Blocks.AIR;
}
private float strengthMod(Block block) {
@@ -149,7 +150,7 @@ public class BlockBreaker extends BehaviorGoalAdapter {
if (entity.hasEffect(MobEffectList.SLOWER_DIG)) {
strength *= 1.0F - (entity.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F;
}
- if (entity.a(Material.WATER) && !EnchantmentManager.hasWaterWorkerEnchantment(entity)) {
+ if (entity.a(Material.WATER) && !EnchantmentManager.j(entity)) {
strength /= 5.0F;
}
if (!entity.onGround) {
diff --git a/src/main/java/net/citizensnpcs/npc/ai/FlyingAStarNavigationStrategy.java b/src/main/java/net/citizensnpcs/npc/ai/FlyingAStarNavigationStrategy.java
index bf5fbec41..11ab20c8b 100644
--- a/src/main/java/net/citizensnpcs/npc/ai/FlyingAStarNavigationStrategy.java
+++ b/src/main/java/net/citizensnpcs/npc/ai/FlyingAStarNavigationStrategy.java
@@ -14,7 +14,7 @@ import net.citizensnpcs.api.astar.pathfinder.VectorNode;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.MathHelper;
+import net.minecraft.server.v1_8_R1.MathHelper;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
diff --git a/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java b/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java
index 1e411efcd..bf8c5d181 100644
--- a/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java
+++ b/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java
@@ -5,14 +5,14 @@ import net.citizensnpcs.api.ai.TargetType;
import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
-import net.minecraft.server.v1_7_R4.EntityLiving;
-import net.minecraft.server.v1_7_R4.Navigation;
+import net.minecraft.server.v1_8_R1.EntityLiving;
+import net.minecraft.server.v1_8_R1.NavigationAbstract;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftLivingEntity;
public class MCNavigationStrategy extends AbstractPathStrategy {
- private final Navigation navigation;
+ private final NavigationAbstract navigation;
private final NavigatorParameters parameters;
private final Location target;
@@ -26,7 +26,6 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
// navigation won't execute, and calling entity.move doesn't
// entirely fix the problem.
navigation = NMS.getNavigation(handle);
- navigation.a(parameters.avoidWater());
navigation.a(dest.getX(), dest.getY(), dest.getZ(), parameters.speed());
if (NMS.isNavigationFinished(navigation)) {
setCancelReason(CancelReason.STUCK);
@@ -57,7 +56,6 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
public boolean update() {
if (getCancelReason() != null)
return true;
- navigation.a(parameters.avoidWater());
navigation.a(parameters.speed());
parameters.run();
return NMS.isNavigationFinished(navigation);
diff --git a/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java b/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java
index cc5ea8f12..76ab8d4ec 100644
--- a/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java
+++ b/src/main/java/net/citizensnpcs/npc/ai/MCTargetStrategy.java
@@ -1,7 +1,5 @@
package net.citizensnpcs.npc.ai;
-import java.lang.reflect.Field;
-
import net.citizensnpcs.api.ai.AttackStrategy;
import net.citizensnpcs.api.ai.EntityTarget;
import net.citizensnpcs.api.ai.NavigatorParameters;
@@ -10,16 +8,13 @@ import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.PlayerAnimation;
-import net.citizensnpcs.util.nms.PlayerNavigation;
-import net.minecraft.server.v1_7_R4.AttributeInstance;
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.EntityLiving;
-import net.minecraft.server.v1_7_R4.EntityPlayer;
-import net.minecraft.server.v1_7_R4.Navigation;
-import net.minecraft.server.v1_7_R4.PathEntity;
+import net.minecraft.server.v1_8_R1.Entity;
+import net.minecraft.server.v1_8_R1.EntityLiving;
+import net.minecraft.server.v1_8_R1.EntityPlayer;
+import net.minecraft.server.v1_8_R1.NavigationAbstract;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.LivingEntity;
public class MCTargetStrategy implements PathStrategy, EntityTarget {
@@ -37,7 +32,7 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
this.parameters = params;
this.handle = ((CraftEntity) npc.getEntity()).getHandle();
this.target = ((CraftEntity) target).getHandle();
- Navigation nav = NMS.getNavigation(this.handle);
+ NavigationAbstract nav = NMS.getNavigation(this.handle);
this.targetNavigator = nav != null && !params.useNewPathfinder() ? new NavigationFieldWrapper(nav)
: new AStarTargeter();
this.aggro = aggro;
@@ -45,8 +40,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
private boolean canAttack() {
return attackTicks == 0
- && (handle.boundingBox.e > target.boundingBox.b && handle.boundingBox.b < target.boundingBox.e)
- && closeEnough(distanceSquared()) && hasLineOfSight();
+ && (handle.getBoundingBox().e > target.getBoundingBox().b && handle.getBoundingBox().b < target
+ .getBoundingBox().e) && closeEnough(distanceSquared()) && hasLineOfSight();
}
@Override
@@ -174,43 +169,15 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
}
private class NavigationFieldWrapper implements TargetNavigator {
- boolean j = true, k, l, m;
- private final Navigation navigation;
- float range;
+ private final NavigationAbstract navigation;
- private NavigationFieldWrapper(Navigation navigation) {
+ private NavigationFieldWrapper(NavigationAbstract navigation) {
this.navigation = navigation;
- this.k = navigation.c();
- this.l = navigation.a();
- try {
- if (navigation instanceof PlayerNavigation) {
- if (P_NAV_E != null)
- range = (float) ((AttributeInstance) P_NAV_E.get(navigation)).getValue();
- if (P_NAV_J != null)
- j = P_NAV_J.getBoolean(navigation);
- if (P_NAV_M != null)
- m = P_NAV_M.getBoolean(navigation);
- } else {
- if (E_NAV_E != null)
- range = (float) ((AttributeInstance) E_NAV_E.get(navigation)).getValue();
- if (E_NAV_J != null)
- j = E_NAV_J.getBoolean(navigation);
- if (E_NAV_M != null)
- m = E_NAV_M.getBoolean(navigation);
- }
- } catch (Exception ex) {
- range = parameters.range();
- }
- }
-
- public PathEntity findPath(Entity from, Entity to) {
- return handle.world.findPath(from, to, range, j, k, l, m);
}
@Override
public void setPath() {
- navigation.a(parameters.avoidWater());
- navigation.a(findPath(handle, target), parameters.speed());
+ navigation.a(target, parameters.speed());
}
@Override
@@ -241,17 +208,6 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
return false;
}
};
- private static Field E_NAV_E, E_NAV_J, E_NAV_M;
private static final Location HANDLE_LOCATION = new Location(null, 0, 0, 0);
- private static Field P_NAV_E, P_NAV_J, P_NAV_M;
private static final Location TARGET_LOCATION = new Location(null, 0, 0, 0);
-
- static {
- E_NAV_E = NMS.getField(Navigation.class, "e");
- E_NAV_J = NMS.getField(Navigation.class, "j");
- E_NAV_M = NMS.getField(Navigation.class, "m");
- P_NAV_E = NMS.getField(PlayerNavigation.class, "e");
- P_NAV_J = NMS.getField(PlayerNavigation.class, "j");
- P_NAV_M = NMS.getField(PlayerNavigation.class, "m");
- }
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/BatController.java b/src/main/java/net/citizensnpcs/npc/entity/BatController.java
index b70de4ede..b92406156 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/BatController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/BatController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityBat;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityBat;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftBat;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftBat;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Bat;
import org.bukkit.util.Vector;
@@ -59,43 +59,33 @@ public class BatController extends MobEntityController {
}
@Override
- protected String aT() {
- return npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.aT() : npc.data().get(
- NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bn() : npc.data().get(
+ NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.aU() : npc.data().get(
- NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bo() : npc.data().get(
+ NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- public void bn() {
+ public boolean cb() {
if (npc == null) {
- super.bn();
- } else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
- if (npc == null) {
- return super.bN();
+ return super.cb();
}
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -108,6 +98,21 @@ public class BatController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void E() {
+ super.E();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -142,29 +147,14 @@ public class BatController extends MobEntityController {
return npc;
}
- @Override
- public void h() {
- super.h();
- if (npc != null) {
- npc.update();
- }
- }
-
public void setFlying(boolean flying) {
setAsleep(flying);
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java b/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java
index 91239ba78..a338f0e4c 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityBlaze;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityBlaze;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftBlaze;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftBlaze;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Blaze;
import org.bukkit.util.Vector;
@@ -58,40 +58,30 @@ public class BlazeController extends MobEntityController {
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc != null) {
- NMS.updateAI(this);
- npc.update();
- } else {
- super.bq();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -105,6 +95,20 @@ public class BlazeController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -140,16 +144,9 @@ public class BlazeController extends MobEntityController {
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java b/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java
index a19c929d1..26c616d79 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityCaveSpider;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityCaveSpider;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCaveSpider;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftCaveSpider;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.CaveSpider;
import org.bukkit.util.Vector;
@@ -58,64 +60,39 @@ public class CaveSpiderController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null) {
- return super.bN();
+ return super.cb();
}
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) {
- return super.bN();
+ return super.cb();
}
- if (super.bN()) {
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null) {
- super.bq();
- } else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -129,12 +106,25 @@ public class CaveSpiderController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -160,6 +150,15 @@ public class CaveSpiderController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -173,25 +172,18 @@ public class CaveSpiderController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java b/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java
index ecff1e1b3..655c4c628 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityChicken;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityChicken;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftChicken;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftChicken;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Chicken;
import org.bukkit.util.Vector;
@@ -69,56 +71,43 @@ public class ChickenController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
- if (npc != null)
+ if (npc != null) {
Util.callCollisionEvent(npc, entity.getBukkitEntity());
+ }
}
@Override
@@ -126,12 +115,25 @@ public class ChickenController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -157,6 +159,15 @@ public class ChickenController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -170,25 +181,18 @@ public class ChickenController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/CowController.java b/src/main/java/net/citizensnpcs/npc/entity/CowController.java
index 72329cf50..b79495da2 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/CowController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/CowController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityCow;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityCow;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCow;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftCow;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Cow;
import org.bukkit.util.Vector;
@@ -70,52 +72,37 @@ public class CowController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -129,12 +116,25 @@ public class CowController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -160,6 +160,15 @@ public class CowController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -173,25 +182,18 @@ public class CowController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java b/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java
index 1e39cecb2..4c7d28643 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java
@@ -7,15 +7,17 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityCreeper;
-import net.minecraft.server.v1_7_R4.EntityLightning;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityCreeper;
+import net.minecraft.server.v1_8_R1.EntityLightning;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreeper;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftCreeper;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Creeper;
import org.bukkit.util.Vector;
@@ -60,58 +62,37 @@ public class CreeperController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- public void a(EntityLightning entitylightning) {
- if (npc == null || allowPowered)
- super.a(entitylightning);
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
- }
-
- @Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -124,12 +105,25 @@ public class CreeperController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -155,6 +149,15 @@ public class CreeperController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -168,29 +171,29 @@ public class CreeperController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
+ @Override
+ public void onLightningStrike(EntityLightning entitylightning) {
+ if (npc == null || allowPowered) {
+ super.onLightningStrike(entitylightning);
+ }
+ }
+
public void setAllowPowered(boolean allowPowered) {
this.allowPowered = allowPowered;
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java b/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java
index 6a0ebe162..e06ef620f 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityEnderDragon;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityEnderDragon;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEnderDragon;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.EnderDragon;
import org.bukkit.util.Vector;
@@ -58,37 +58,29 @@ public class EnderDragonController extends MobEntityController {
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
-
@Override
- public void bq() {
- if (npc == null) {
- super.bq();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -102,7 +94,7 @@ public class EnderDragonController extends MobEntityController {
}
@Override
- public void e() {
+ public void m() {
if (npc != null) {
npc.update();
if (motX != 0 || motY != 0 || motZ != 0) {
@@ -113,7 +105,7 @@ public class EnderDragonController extends MobEntityController {
setPosition(locX + motX, locY + motY, locZ + motZ);
}
} else {
- super.e();
+ super.m();
}
}
@@ -161,15 +153,15 @@ public class EnderDragonController extends MobEntityController {
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
@Override
- protected void w() {
+ protected void D() {
if (npc == null) {
- super.w();
+ super.D();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java b/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java
index 75ae536ec..bc02785b4 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityEnderman;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityEnderman;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderman;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEnderman;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Enderman;
import org.bukkit.util.Vector;
@@ -43,7 +45,6 @@ public class EndermanController extends MobEntityController {
}
public static class EntityEndermanNPC extends EntityEnderman implements NPCHolder {
- private int jumpTicks;
private final CitizensNPC npc;
public EntityEndermanNPC(World world) {
@@ -59,61 +60,37 @@ public class EndermanController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null)
- super.bq();
- else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -127,21 +104,23 @@ public class EndermanController extends MobEntityController {
}
@Override
- public void e() {
- if (npc == null)
- super.e();
- else {
- updateAIWithMovement();
- npc.update();
+ protected void D() {
+ if (npc == null) {
+ super.D();
}
}
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -167,6 +146,15 @@ public class EndermanController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -180,9 +168,9 @@ public class EndermanController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
@@ -197,41 +185,9 @@ public class EndermanController extends MobEntityController {
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- private void updateAIWithMovement() {
- NMS.updateAI(this);
- // taken from EntityLiving update method
- if (bc) {
- /* boolean inLiquid = H() || J();
- if (inLiquid) {
- motY += 0.04;
- } else //(handled elsewhere)*/
- if (onGround && jumpTicks == 0) {
- bj();
- jumpTicks = 10;
- }
- } else {
- jumpTicks = 0;
- }
- bd *= 0.98F;
- be *= 0.98F;
- bf *= 0.9F;
- e(bd, be); // movement method
- NMS.setHeadYaw(this, yaw);
- if (jumpTicks > 0) {
- jumpTicks--;
- }
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/EndermiteController.java b/src/main/java/net/citizensnpcs/npc/entity/EndermiteController.java
new file mode 100644
index 000000000..444266fb2
--- /dev/null
+++ b/src/main/java/net/citizensnpcs/npc/entity/EndermiteController.java
@@ -0,0 +1,185 @@
+package net.citizensnpcs.npc.entity;
+
+import net.citizensnpcs.api.event.NPCPushEvent;
+import net.citizensnpcs.api.npc.NPC;
+import net.citizensnpcs.npc.CitizensNPC;
+import net.citizensnpcs.npc.MobEntityController;
+import net.citizensnpcs.npc.ai.NPCHolder;
+import net.citizensnpcs.util.NMS;
+import net.citizensnpcs.util.Util;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityEndermite;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
+
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEndermite;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.entity.Endermite;
+import org.bukkit.util.Vector;
+
+public class EndermiteController extends MobEntityController {
+ public EndermiteController() {
+ super(EntityEndermiteNPC.class);
+ }
+
+ @Override
+ public Endermite getBukkitEntity() {
+ return (Endermite) super.getBukkitEntity();
+ }
+
+ public static class EndermiteNPC extends CraftEndermite implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public EndermiteNPC(EntityEndermiteNPC entity) {
+ super((CraftServer) Bukkit.getServer(), entity);
+ this.npc = entity.npc;
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+ }
+
+ public static class EntityEndermiteNPC extends EntityEndermite implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public EntityEndermiteNPC(World world) {
+ this(world, null);
+ }
+
+ public EntityEndermiteNPC(World world, NPC npc) {
+ super(world);
+ this.npc = (CitizensNPC) npc;
+ if (npc != null) {
+ NMS.clearGoals(goalSelector, targetSelector);
+ }
+ }
+
+ @Override
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
+ if (npc == null || !npc.isFlyable()) {
+ super.a(d0, flag, block, blockposition);
+ }
+ }
+
+ @Override
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
+ }
+
+ @Override
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
+ }
+
+ @Override
+ public boolean cb() {
+ if (npc == null)
+ return super.cb();
+ boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
+ if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
+ return super.cb();
+ if (super.cb()) {
+ unleash(true, false); // clearLeash with client update
+ }
+ return false; // shouldLeash
+ }
+
+ @Override
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
+ // this method is called by both the entities involved - cancelling
+ // it will not stop the NPC from moving.
+ super.collide(entity);
+ if (npc != null)
+ Util.callCollisionEvent(npc, entity.getBukkitEntity());
+ }
+
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
+ @Override
+ public void e(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.e(f, f1);
+ }
+ }
+
+ @Override
+ public void g(double x, double y, double z) {
+ if (npc == null) {
+ super.g(x, y, z);
+ return;
+ }
+ if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
+ if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
+ super.g(x, y, z);
+ return;
+ }
+ Vector vector = new Vector(x, y, z);
+ NPCPushEvent event = Util.callPushEvent(npc, vector);
+ if (!event.isCancelled()) {
+ vector = event.getCollisionVector();
+ super.g(vector.getX(), vector.getY(), vector.getZ());
+ }
+ // when another entity collides, this method is called to push the
+ // NPC so we prevent it from doing anything if the event is
+ // cancelled.
+ }
+
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
+ @Override
+ public CraftEntity getBukkitEntity() {
+ if (bukkitEntity == null && npc != null)
+ bukkitEntity = new EndermiteNPC(this);
+ return super.getBukkitEntity();
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+
+ @Override
+ public boolean j_() {
+ if (npc == null || !npc.isFlyable()) {
+ return super.j_();
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java
index f2a9cded8..d43c64c8d 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java
@@ -1,8 +1,6 @@
package net.citizensnpcs.npc.entity;
import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
import java.net.Socket;
import java.util.List;
@@ -21,32 +19,37 @@ import net.citizensnpcs.util.nms.PlayerControllerJump;
import net.citizensnpcs.util.nms.PlayerControllerLook;
import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.citizensnpcs.util.nms.PlayerNavigation;
-import net.minecraft.server.v1_7_R4.AttributeInstance;
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.EntityPlayer;
-import net.minecraft.server.v1_7_R4.EnumGamemode;
-import net.minecraft.server.v1_7_R4.GenericAttributes;
-import net.minecraft.server.v1_7_R4.MathHelper;
-import net.minecraft.server.v1_7_R4.MinecraftServer;
-import net.minecraft.server.v1_7_R4.Navigation;
-import net.minecraft.server.v1_7_R4.NetworkManager;
-import net.minecraft.server.v1_7_R4.Packet;
-import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
-import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation;
-import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
-import net.minecraft.server.v1_7_R4.PlayerInteractManager;
-import net.minecraft.server.v1_7_R4.WorldServer;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
+import net.minecraft.server.v1_8_R1.AttributeInstance;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.Entity;
+import net.minecraft.server.v1_8_R1.EntityPlayer;
+import net.minecraft.server.v1_8_R1.EnumGamemode;
+import net.minecraft.server.v1_8_R1.EnumPlayerInfoAction;
+import net.minecraft.server.v1_8_R1.EnumProtocolDirection;
+import net.minecraft.server.v1_8_R1.GenericAttributes;
+import net.minecraft.server.v1_8_R1.MathHelper;
+import net.minecraft.server.v1_8_R1.MinecraftServer;
+import net.minecraft.server.v1_8_R1.NavigationAbstract;
+import net.minecraft.server.v1_8_R1.NetworkManager;
+import net.minecraft.server.v1_8_R1.Packet;
+import net.minecraft.server.v1_8_R1.PacketPlayOutEntityEquipment;
+import net.minecraft.server.v1_8_R1.PacketPlayOutEntityHeadRotation;
+import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerInfo;
+import net.minecraft.server.v1_8_R1.PlayerInteractManager;
+import net.minecraft.server.v1_8_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
+import com.mojang.authlib.GameProfile;
+
public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
private PlayerControllerJump controllerJump;
private PlayerControllerLook controllerLook;
@@ -60,30 +63,23 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile,
PlayerInteractManager playerInteractManager, NPC npc) {
super(minecraftServer, world, gameProfile, playerInteractManager);
- playerInteractManager.setGameMode(EnumGamemode.SURVIVAL);
this.npc = (CitizensNPC) npc;
if (npc != null) {
+ playerInteractManager.setGameMode(EnumGamemode.SURVIVAL);
initialise(minecraftServer);
}
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -96,8 +92,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -108,8 +102,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
- if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
+ if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.g(x, y, z);
+ }
return;
}
Vector vector = new Vector(x, y, z);
@@ -123,10 +118,20 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftPlayer getBukkitEntity() {
- if (npc != null && bukkitEntity == null)
+ if (npc != null && bukkitEntity == null) {
bukkitEntity = new PlayerNPC(this);
+ }
return super.getBukkitEntity();
}
@@ -134,25 +139,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
return controllerJump;
}
- private Packet getListPacket(Player player, boolean removeFromPlayerList) {
- if (PLAYER_INFO_CONSTRUCTOR != null) {
- try {
- return PLAYER_INFO_CONSTRUCTOR.newInstance(player.getPlayerListName(), !removeFromPlayerList,
- removeFromPlayerList ? 9999 : ping);
- } catch (Exception e) {
- }
- } else {
- try {
- return (Packet) (removeFromPlayerList ? PLAYER_INFO_REMOVE_METHOD.invoke(null,
- ((CraftPlayer) player).getHandle()) : PLAYER_INFO_ADD_METHOD.invoke(null,
- ((CraftPlayer) player).getHandle()));
- } catch (Exception e) {
- }
- }
- return null;
+ public PlayerControllerMove getControllerMove() {
+ return controllerMove;
}
- public Navigation getNavigation() {
+ private Packet getListPacket(Player player, boolean removeFromPlayerList) {
+ return new PacketPlayOutPlayerInfo(removeFromPlayerList ? EnumPlayerInfoAction.REMOVE_PLAYER
+ : EnumPlayerInfoAction.ADD_PLAYER, ((CraftPlayer) player).getHandle());
+ }
+
+ public NavigationAbstract getNavigation() {
return navigation;
}
@@ -161,9 +157,67 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
return npc;
}
+ private void initialise(MinecraftServer minecraftServer) {
+ Socket socket = new EmptySocket();
+ NetworkManager conn = null;
+ try {
+ conn = new EmptyNetworkManager(EnumProtocolDirection.CLIENTBOUND);
+ playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
+ conn.a(playerConnection);
+ socket.close();
+ } catch (IOException e) {
+ // swallow
+ }
+
+ AttributeInstance range = this.getAttributeInstance(GenericAttributes.b);
+ if (range == null) {
+ range = this.getAttributeMap().b(GenericAttributes.b);
+ }
+ range.setValue(Setting.DEFAULT_PATHFINDING_RANGE.asDouble());
+
+ controllerJump = new PlayerControllerJump(this);
+ controllerLook = new PlayerControllerLook(this);
+ controllerMove = new PlayerControllerMove(this);
+ navigation = new PlayerNavigation(this, world);
+ NMS.setStepHeight(this, 1); // the default (0) breaks step climbing
+ }
+
+ public boolean isNavigating() {
+ return npc.getNavigator().isNavigating();
+ }
+
@Override
- public void h() {
- super.h();
+ public boolean j_() {
+ if (npc == null || !npc.isFlyable()) {
+ return super.j_();
+ } else {
+ return false;
+ }
+ }
+
+ private void moveOnCurrentHeading() {
+ NMS.updateAI(this);
+ if (aW) {
+ if (onGround && jumpTicks == 0) {
+ bE();
+ jumpTicks = 10;
+ }
+ } else {
+ jumpTicks = 0;
+ }
+ aX *= 0.98F;
+ aY *= 0.98F;
+ aZ *= 0.9F;
+ g(aX, aY); // movement method
+ NMS.setHeadYaw(this, yaw);
+ if (jumpTicks > 0) {
+ jumpTicks--;
+ }
+ }
+
+ @Override
+ public void s_() {
+ super.s_();
if (npc == null)
return;
boolean navigating = npc.getNavigator().isNavigating();
@@ -175,15 +229,17 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
// (onGround is normally updated by the client)
}
- if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
+ if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON) {
motX = motY = motZ = 0;
+ }
if (navigating) {
if (!NMS.isNavigationFinished(navigation)) {
NMS.updateNavigation(navigation);
}
moveOnCurrentHeading();
} else if (motX != 0 || motZ != 0 || motY != 0) {
- e(0, 0); // is this necessary? it does controllable but sometimes
+ g(0, 0); // is this necessary? it does controllable but
+ // sometimes
// players sink into the ground
}
@@ -194,69 +250,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
npc.update();
}
- @Override
- public boolean h_() {
- if (npc == null || !npc.isFlyable()) {
- return super.h_();
- } else {
- return false;
- }
- }
-
- private void initialise(MinecraftServer minecraftServer) {
- Socket socket = new EmptySocket();
- NetworkManager conn = null;
- try {
- conn = new EmptyNetworkManager(false);
- playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
- conn.a(playerConnection);
- } catch (IOException e) {
- // swallow
- }
-
- NMS.setStepHeight(this, 1); // the default (0) breaks step climbing
-
- try {
- socket.close();
- } catch (IOException ex) {
- // swallow
- }
-
- AttributeInstance range = this.getAttributeInstance(GenericAttributes.b);
- if (range == null) {
- range = this.getAttributeMap().b(GenericAttributes.b);
- }
- range.setValue(Setting.DEFAULT_PATHFINDING_RANGE.asDouble());
- controllerJump = new PlayerControllerJump(this);
- controllerLook = new PlayerControllerLook(this);
- controllerMove = new PlayerControllerMove(this);
- navigation = new PlayerNavigation(this, world);
- }
-
- public boolean isNavigating() {
- return npc.getNavigator().isNavigating();
- }
-
- private void moveOnCurrentHeading() {
- NMS.updateAI(this);
- if (bc) {
- if (onGround && jumpTicks == 0) {
- bj();
- jumpTicks = 10;
- }
- } else {
- jumpTicks = 0;
- }
- bd *= 0.98F;
- be *= 0.98F;
- bf *= 0.9F;
- e(bd, be); // movement method
- NMS.setHeadYaw(this, yaw);
- if (jumpTicks > 0) {
- jumpTicks--;
- }
- }
-
public void setMoveDestination(double x, double y, double z, double speed) {
controllerMove.a(x, y, z, speed);
}
@@ -366,23 +359,4 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
private static final float EPSILON = 0.005F;
private static final Location LOADED_LOCATION = new Location(null, 0, 0, 0);
- private static Method PLAYER_INFO_ADD_METHOD;
- private static Constructor PLAYER_INFO_CONSTRUCTOR;
- private static Method PLAYER_INFO_REMOVE_METHOD;
-
- static {
- try {
- PLAYER_INFO_CONSTRUCTOR = PacketPlayOutPlayerInfo.class.getConstructor(String.class, boolean.class,
- int.class);
- } catch (Exception e) {
- }
- try {
- PLAYER_INFO_ADD_METHOD = PacketPlayOutPlayerInfo.class.getMethod("addPlayer", EntityPlayer.class);
- PLAYER_INFO_REMOVE_METHOD = PacketPlayOutPlayerInfo.class.getMethod("removePlayer", EntityPlayer.class);
- PLAYER_INFO_ADD_METHOD.setAccessible(true);
- PLAYER_INFO_REMOVE_METHOD.setAccessible(true);
- } catch (Exception e) {
- }
-
- }
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/GhastController.java b/src/main/java/net/citizensnpcs/npc/entity/GhastController.java
index 9cb140a7c..44465d770 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/GhastController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/GhastController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityGhast;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityGhast;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftGhast;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftGhast;
import org.bukkit.entity.Ghast;
import org.bukkit.util.Vector;
@@ -44,38 +44,30 @@ public class GhastController extends MobEntityController {
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc != null) {
- npc.update();
- } else
- super.bq();
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -88,6 +80,13 @@ public class GhastController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -123,16 +122,9 @@ public class GhastController extends MobEntityController {
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/GiantController.java b/src/main/java/net/citizensnpcs/npc/entity/GiantController.java
index 96c8f7bb7..4a629ef74 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/GiantController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/GiantController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityGiantZombie;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityGiantZombie;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftGiant;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftGiant;
import org.bukkit.entity.Giant;
import org.bukkit.util.Vector;
@@ -44,54 +46,37 @@ public class GiantController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null) {
- super.bq();
- } else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -104,12 +89,17 @@ public class GiantController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -135,6 +125,15 @@ public class GiantController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -148,25 +147,18 @@ public class GiantController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/GuardianController.java b/src/main/java/net/citizensnpcs/npc/entity/GuardianController.java
new file mode 100644
index 000000000..62ba4fed1
--- /dev/null
+++ b/src/main/java/net/citizensnpcs/npc/entity/GuardianController.java
@@ -0,0 +1,199 @@
+package net.citizensnpcs.npc.entity;
+
+import net.citizensnpcs.api.event.NPCPushEvent;
+import net.citizensnpcs.api.npc.NPC;
+import net.citizensnpcs.npc.CitizensNPC;
+import net.citizensnpcs.npc.MobEntityController;
+import net.citizensnpcs.npc.ai.NPCHolder;
+import net.citizensnpcs.util.NMS;
+import net.citizensnpcs.util.Util;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityGuardian;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
+
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftGuardian;
+import org.bukkit.entity.Guardian;
+import org.bukkit.util.Vector;
+
+public class GuardianController extends MobEntityController {
+ public GuardianController() {
+ super(EntityGuardianNPC.class);
+ }
+
+ @Override
+ public Guardian getBukkitEntity() {
+ return (Guardian) super.getBukkitEntity();
+ }
+
+ public static class EntityGuardianNPC extends EntityGuardian implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public EntityGuardianNPC(World world) {
+ this(world, null);
+ }
+
+ public EntityGuardianNPC(World world, NPC npc) {
+ super(world);
+ this.npc = (CitizensNPC) npc;
+ if (npc != null) {
+ NMS.clearGoals(goalSelector, targetSelector);
+
+ }
+ }
+
+ @Override
+ public void a(boolean flag) {
+ float oldw = width;
+ float oldl = length;
+ super.a(flag);
+ if (oldw != width || oldl != length) {
+ this.setPosition(locX - 0.01, locY, locZ - 0.01);
+ this.setPosition(locX + 0.01, locY, locZ + 0.01);
+ }
+ }
+
+ @Override
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
+ if (npc == null || !npc.isFlyable()) {
+ super.a(d0, flag, block, blockposition);
+ }
+ }
+
+ @Override
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
+ }
+
+ @Override
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
+ }
+
+ @Override
+ public boolean cb() {
+ if (npc == null)
+ return super.cb();
+ boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
+ if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
+ return super.cb();
+ if (super.cb()) {
+ unleash(true, false); // clearLeash with client update
+ }
+ return false; // shouldLeash
+ }
+
+ @Override
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
+ // this method is called by both the entities involved - cancelling
+ // it will not stop the NPC from moving.
+ super.collide(entity);
+ if (npc != null) {
+ Util.callCollisionEvent(npc, entity.getBukkitEntity());
+ }
+ }
+
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
+ @Override
+ public void e(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.e(f, f1);
+ }
+ }
+
+ @Override
+ public void g(double x, double y, double z) {
+ if (npc == null) {
+ super.g(x, y, z);
+ return;
+ }
+ if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
+ if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
+ super.g(x, y, z);
+ return;
+ }
+ Vector vector = new Vector(x, y, z);
+ NPCPushEvent event = Util.callPushEvent(npc, vector);
+ if (!event.isCancelled()) {
+ vector = event.getCollisionVector();
+ super.g(vector.getX(), vector.getY(), vector.getZ());
+ }
+ // when another entity collides, this method is called to push the
+ // NPC so we prevent it from doing anything if the event is
+ // cancelled.
+ }
+
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
+ @Override
+ public CraftEntity getBukkitEntity() {
+ if (bukkitEntity == null && npc != null)
+ bukkitEntity = new GuardianNPC(this);
+ return super.getBukkitEntity();
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+
+ @Override
+ public boolean j_() {
+ if (npc == null || !npc.isFlyable()) {
+ return super.j_();
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
+ }
+ }
+
+ public static class GuardianNPC extends CraftGuardian implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public GuardianNPC(EntityGuardianNPC entity) {
+ super((CraftServer) Bukkit.getServer(), entity);
+ this.npc = entity.npc;
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/HorseController.java b/src/main/java/net/citizensnpcs/npc/entity/HorseController.java
index 9c55f79a4..cd37066ed 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/HorseController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/HorseController.java
@@ -8,15 +8,17 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityHorse;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityHorse;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHorse;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftHorse;
import org.bukkit.entity.Horse;
import org.bukkit.util.Vector;
@@ -37,7 +39,6 @@ public class HorseController extends MobEntityController {
}
public static class EntityHorseNPC extends EntityHorse implements NPCHolder {
- private int jumpTicks;
private final CitizensNPC npc;
public EntityHorseNPC(World world) {
@@ -65,44 +66,37 @@ public class HorseController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -117,12 +111,18 @@ public class HorseController extends MobEntityController {
}
@Override
- public void e() {
+ protected void D() {
if (npc == null) {
- super.e();
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ if (npc == null) {
+ super.doTick();
} else {
NMS.setStepHeight(this, 1);
- updateAIWithMovement();
npc.update();
}
}
@@ -131,8 +131,6 @@ public class HorseController extends MobEntityController {
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -158,6 +156,15 @@ public class HorseController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -171,51 +178,18 @@ public class HorseController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- private void updateAIWithMovement() {
- NMS.updateAI(this);
- // taken from EntityLiving update method
- if (bc) {
- /* boolean inLiquid = H() || J();
- if (inLiquid) {
- motY += 0.04;
- } else //(handled elsewhere)*/
- if (onGround && jumpTicks == 0) {
- bj();
- jumpTicks = 10;
- }
- } else {
- jumpTicks = 0;
- }
- bd *= 0.98F;
- be *= 0.98F;
- bf *= 0.9F;
-
- e(bd, be); // movement method
- NMS.setHeadYaw(this, yaw);
- if (jumpTicks > 0) {
- jumpTicks--;
- }
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/HumanController.java b/src/main/java/net/citizensnpcs/npc/entity/HumanController.java
index 3ad8d5672..47c12bdf4 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/HumanController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/HumanController.java
@@ -17,30 +17,32 @@ import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.util.NMS;
-import net.minecraft.server.v1_7_R4.PlayerInteractManager;
-import net.minecraft.server.v1_7_R4.WorldServer;
-import net.minecraft.util.com.google.common.collect.Iterables;
-import net.minecraft.util.com.mojang.authlib.Agent;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
-import net.minecraft.util.com.mojang.authlib.GameProfileRepository;
-import net.minecraft.util.com.mojang.authlib.HttpAuthenticationService;
-import net.minecraft.util.com.mojang.authlib.ProfileLookupCallback;
-import net.minecraft.util.com.mojang.authlib.minecraft.MinecraftSessionService;
-import net.minecraft.util.com.mojang.authlib.properties.Property;
-import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
-import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
-import net.minecraft.util.com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
-import net.minecraft.util.com.mojang.util.UUIDTypeAdapter;
+import net.minecraft.server.v1_8_R1.EnumPlayerInfoAction;
+import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerInfo;
+import net.minecraft.server.v1_8_R1.PlayerInteractManager;
+import net.minecraft.server.v1_8_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
+import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
+import com.mojang.authlib.Agent;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.GameProfileRepository;
+import com.mojang.authlib.HttpAuthenticationService;
+import com.mojang.authlib.ProfileLookupCallback;
+import com.mojang.authlib.minecraft.MinecraftSessionService;
+import com.mojang.authlib.properties.Property;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
+import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
+import com.mojang.util.UUIDTypeAdapter;
public class HumanController extends AbstractEntityController {
public HumanController() {
@@ -81,6 +83,7 @@ public class HumanController extends AbstractEntityController {
npc.data().get("removefromplayerlist", removeFromPlayerList));
}
}, 1);
+ NMS.sendToOnline(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle));
handle.getBukkitEntity().setSleepingIgnored(true);
return handle.getBukkitEntity();
}
@@ -105,7 +108,7 @@ public class HumanController extends AbstractEntityController {
if (cached != null) {
profile.getProperties().put("textures", cached);
} else {
- SKIN_THREAD.addRunnable(new SkinFetcher(new UUIDFetcher(skinUUID, npc), nmsWorld.getMinecraftServer().av(),
+ SKIN_THREAD.addRunnable(new SkinFetcher(new UUIDFetcher(skinUUID, npc), nmsWorld.getMinecraftServer().aB(),
npc));
}
}
@@ -127,8 +130,8 @@ public class HumanController extends AbstractEntityController {
private GameProfile fillProfileProperties(YggdrasilAuthenticationService auth, GameProfile profile,
boolean requireSecure) throws Exception {
URL url = HttpAuthenticationService.constantURL(new StringBuilder()
- .append("https://sessionserver.mojang.com/session/minecraft/profile/")
- .append(UUIDTypeAdapter.fromUUID(profile.getId())).toString());
+ .append("https://sessionserver.mojang.com/session/minecraft/profile/")
+ .append(UUIDTypeAdapter.fromUUID(profile.getId())).toString());
url = HttpAuthenticationService.concatenateURL(url,
new StringBuilder().append("unsigned=").append(!requireSecure).toString());
MinecraftProfilePropertiesResponse response = (MinecraftProfilePropertiesResponse) MAKE_REQUEST.invoke(
@@ -155,7 +158,7 @@ public class HumanController extends AbstractEntityController {
if (cached != null) {
if (Messaging.isDebugging()) {
Messaging
- .debug("Using cached skin texture for NPC " + npc.getName() + " UUID " + npc.getUniqueId());
+ .debug("Using cached skin texture for NPC " + npc.getName() + " UUID " + npc.getUniqueId());
}
skinProfile = new GameProfile(UUID.fromString(realUUID), "");
skinProfile.getProperties().put("textures", cached);
@@ -167,7 +170,7 @@ public class HumanController extends AbstractEntityController {
} catch (Exception e) {
if ((e.getMessage() != null && e.getMessage().contains("too many requests"))
|| (e.getCause() != null && e.getCause().getMessage() != null && e.getCause().getMessage()
- .contains("too many requests"))) {
+ .contains("too many requests"))) {
SKIN_THREAD.delay();
SKIN_THREAD.addRunnable(this);
}
@@ -257,21 +260,21 @@ public class HumanController extends AbstractEntityController {
.getGameProfileRepository();
repo.findProfilesByNames(new String[] { ChatColor.stripColor(reportedUUID) }, Agent.MINECRAFT,
new ProfileLookupCallback() {
- @Override
- public void onProfileLookupFailed(GameProfile arg0, Exception arg1) {
- }
+ @Override
+ public void onProfileLookupFailed(GameProfile arg0, Exception arg1) {
+ }
- @Override
- public void onProfileLookupSucceeded(final GameProfile profile) {
- UUID_CACHE.put(reportedUUID, profile.getId().toString());
- if (Messaging.isDebugging()) {
- Messaging.debug("Fetched UUID " + profile.getId() + " for NPC " + npc.getName()
- + " UUID " + npc.getUniqueId());
- }
- npc.data().setPersistent(CACHED_SKIN_UUID_METADATA, profile.getId().toString());
- npc.data().setPersistent(CACHED_SKIN_UUID_NAME_METADATA, profile.getName());
- }
- });
+ @Override
+ public void onProfileLookupSucceeded(final GameProfile profile) {
+ UUID_CACHE.put(reportedUUID, profile.getId().toString());
+ if (Messaging.isDebugging()) {
+ Messaging.debug("Fetched UUID " + profile.getId() + " for NPC " + npc.getName()
+ + " UUID " + npc.getUniqueId());
+ }
+ npc.data().setPersistent(CACHED_SKIN_UUID_METADATA, profile.getId().toString());
+ npc.data().setPersistent(CACHED_SKIN_UUID_NAME_METADATA, profile.getName());
+ }
+ });
return npc.data().get(CACHED_SKIN_UUID_METADATA, reportedUUID);
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java b/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java
index b17b28a99..1f6ad8558 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityIronGolem;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityIronGolem;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftIronGolem;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftIronGolem;
import org.bukkit.entity.IronGolem;
import org.bukkit.util.Vector;
@@ -44,51 +46,37 @@ public class IronGolemController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -101,12 +89,17 @@ public class IronGolemController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -132,6 +125,15 @@ public class IronGolemController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -145,24 +147,24 @@ public class IronGolemController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
@Override
- protected void w() {
+ protected void D() {
if (npc == null) {
- super.w();
+ super.D();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java b/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java
index 973017edd..a8fb6a7c8 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMagmaCube;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityMagmaCube;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMagmaCube;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftMagmaCube;
import org.bukkit.entity.MagmaCube;
import org.bukkit.util.Vector;
@@ -45,61 +47,37 @@ public class MagmaCubeController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null)
- super.bq();
- else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -112,12 +90,24 @@ public class MagmaCubeController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -143,6 +133,15 @@ public class MagmaCubeController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -156,25 +155,18 @@ public class MagmaCubeController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java b/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java
index beadf30f3..fecc1cb5e 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMushroomCow;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityMushroomCow;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMushroomCow;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftMushroomCow;
import org.bukkit.entity.MushroomCow;
import org.bukkit.util.Vector;
@@ -56,51 +58,37 @@ public class MushroomCowController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -113,12 +101,24 @@ public class MushroomCowController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -144,6 +144,15 @@ public class MushroomCowController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -157,25 +166,18 @@ public class MushroomCowController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java b/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java
index 7b4ac5b44..2e102ca7d 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityOcelot;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityOcelot;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftOcelot;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftOcelot;
import org.bukkit.entity.Ocelot;
import org.bukkit.util.Vector;
@@ -55,51 +57,37 @@ public class OcelotController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -112,12 +100,24 @@ public class OcelotController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -143,6 +143,15 @@ public class OcelotController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -156,25 +165,18 @@ public class OcelotController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/PigController.java b/src/main/java/net/citizensnpcs/npc/entity/PigController.java
index 977418592..766e5ac78 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/PigController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/PigController.java
@@ -7,15 +7,17 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityLightning;
-import net.minecraft.server.v1_7_R4.EntityPig;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityLightning;
+import net.minecraft.server.v1_8_R1.EntityPig;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPig;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPig;
import org.bukkit.entity.Pig;
import org.bukkit.util.Vector;
@@ -56,58 +58,37 @@ public class PigController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- public void a(EntityLightning entitylightning) {
- if (npc == null) {
- super.a(entitylightning);
- }
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
- }
-
- @Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -121,12 +102,24 @@ public class PigController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -152,6 +145,15 @@ public class PigController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -165,25 +167,25 @@ public class PigController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
+ public void onLightningStrike(EntityLightning entitylightning) {
+ if (npc == null) {
+ super.onLightningStrike(entitylightning);
+ }
}
@Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java b/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java
index 7101d1b00..b9c5c605a 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityPigZombie;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityPigZombie;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPigZombie;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPigZombie;
import org.bukkit.entity.PigZombie;
import org.bukkit.util.Vector;
@@ -45,61 +47,37 @@ public class PigZombieController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null) {
- super.bq();
- } else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -112,12 +90,24 @@ public class PigZombieController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -143,6 +133,15 @@ public class PigZombieController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -156,25 +155,18 @@ public class PigZombieController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/RabbitController.java b/src/main/java/net/citizensnpcs/npc/entity/RabbitController.java
new file mode 100644
index 000000000..95e788eed
--- /dev/null
+++ b/src/main/java/net/citizensnpcs/npc/entity/RabbitController.java
@@ -0,0 +1,199 @@
+package net.citizensnpcs.npc.entity;
+
+import net.citizensnpcs.api.event.NPCPushEvent;
+import net.citizensnpcs.api.npc.NPC;
+import net.citizensnpcs.npc.CitizensNPC;
+import net.citizensnpcs.npc.MobEntityController;
+import net.citizensnpcs.npc.ai.NPCHolder;
+import net.citizensnpcs.util.NMS;
+import net.citizensnpcs.util.Util;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityRabbit;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
+
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftRabbit;
+import org.bukkit.entity.Rabbit;
+import org.bukkit.util.Vector;
+
+public class RabbitController extends MobEntityController {
+ public RabbitController() {
+ super(EntityRabbitNPC.class);
+ }
+
+ @Override
+ public Rabbit getBukkitEntity() {
+ return (Rabbit) super.getBukkitEntity();
+ }
+
+ public static class EntityRabbitNPC extends EntityRabbit implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public EntityRabbitNPC(World world) {
+ this(world, null);
+ }
+
+ public EntityRabbitNPC(World world, NPC npc) {
+ super(world);
+ this.npc = (CitizensNPC) npc;
+ if (npc != null) {
+ NMS.clearGoals(goalSelector, targetSelector);
+
+ }
+ }
+
+ @Override
+ public void a(boolean flag) {
+ float oldw = width;
+ float oldl = length;
+ super.a(flag);
+ if (oldw != width || oldl != length) {
+ this.setPosition(locX - 0.01, locY, locZ - 0.01);
+ this.setPosition(locX + 0.01, locY, locZ + 0.01);
+ }
+ }
+
+ @Override
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
+ if (npc == null || !npc.isFlyable()) {
+ super.a(d0, flag, block, blockposition);
+ }
+ }
+
+ @Override
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
+ }
+
+ @Override
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
+ }
+
+ @Override
+ public boolean cb() {
+ if (npc == null)
+ return super.cb();
+ boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
+ if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
+ return super.cb();
+ if (super.cb()) {
+ unleash(true, false); // clearLeash with client update
+ }
+ return false; // shouldLeash
+ }
+
+ @Override
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
+ // this method is called by both the entities involved - cancelling
+ // it will not stop the NPC from moving.
+ super.collide(entity);
+ if (npc != null) {
+ Util.callCollisionEvent(npc, entity.getBukkitEntity());
+ }
+ }
+
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
+ @Override
+ public void e(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.e(f, f1);
+ }
+ }
+
+ @Override
+ public void g(double x, double y, double z) {
+ if (npc == null) {
+ super.g(x, y, z);
+ return;
+ }
+ if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
+ if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
+ super.g(x, y, z);
+ return;
+ }
+ Vector vector = new Vector(x, y, z);
+ NPCPushEvent event = Util.callPushEvent(npc, vector);
+ if (!event.isCancelled()) {
+ vector = event.getCollisionVector();
+ super.g(vector.getX(), vector.getY(), vector.getZ());
+ }
+ // when another entity collides, this method is called to push the
+ // NPC so we prevent it from doing anything if the event is
+ // cancelled.
+ }
+
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
+ @Override
+ public CraftEntity getBukkitEntity() {
+ if (bukkitEntity == null && npc != null)
+ bukkitEntity = new RabbitNPC(this);
+ return super.getBukkitEntity();
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+
+ @Override
+ public boolean j_() {
+ if (npc == null || !npc.isFlyable()) {
+ return super.j_();
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
+ }
+ }
+
+ public static class RabbitNPC extends CraftRabbit implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public RabbitNPC(EntityRabbitNPC entity) {
+ super((CraftServer) Bukkit.getServer(), entity);
+ this.npc = entity.npc;
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/SheepController.java b/src/main/java/net/citizensnpcs/npc/entity/SheepController.java
index 2fb0372f2..d269acc71 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/SheepController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/SheepController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySheep;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntitySheep;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSheep;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSheep;
import org.bukkit.entity.Sheep;
import org.bukkit.util.Vector;
@@ -55,51 +57,37 @@ public class SheepController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -112,12 +100,24 @@ public class SheepController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -143,6 +143,15 @@ public class SheepController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -156,25 +165,18 @@ public class SheepController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java b/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java
index 91968f7ba..f08db8b29 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySilverfish;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntitySilverfish;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSilverfish;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSilverfish;
import org.bukkit.entity.Silverfish;
import org.bukkit.util.Vector;
@@ -44,61 +46,37 @@ public class SilverfishController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null) {
- super.bq();
- } else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -111,12 +89,24 @@ public class SilverfishController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -142,6 +132,15 @@ public class SilverfishController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -155,25 +154,18 @@ public class SilverfishController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java b/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java
index 61a46cc0d..528f1d93d 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySkeleton;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntitySkeleton;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSkeleton;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSkeleton;
import org.bukkit.entity.Skeleton;
import org.bukkit.util.Vector;
@@ -44,52 +46,37 @@ public class SkeletonController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -102,12 +89,25 @@ public class SkeletonController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -133,6 +133,15 @@ public class SkeletonController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -146,25 +155,18 @@ public class SkeletonController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java b/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java
index b20b7644d..783a6cd78 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySlime;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntitySlime;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSlime;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSlime;
import org.bukkit.entity.Slime;
import org.bukkit.util.Vector;
@@ -46,61 +48,37 @@ public class SlimeController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null) {
- super.bq();
- } else {
- npc.update();
- NMS.updateAI(this);
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -113,12 +91,24 @@ public class SlimeController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -144,6 +134,15 @@ public class SlimeController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -157,25 +156,18 @@ public class SlimeController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java b/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java
index 2efbc22a3..4dec8d116 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySnowman;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntitySnowman;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSnowman;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSnowman;
import org.bukkit.entity.Snowman;
import org.bukkit.util.Vector;
@@ -44,51 +46,37 @@ public class SnowmanController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -101,12 +89,24 @@ public class SnowmanController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -132,6 +132,15 @@ public class SnowmanController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -145,25 +154,18 @@ public class SnowmanController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java b/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java
index a896870ce..8c719f66e 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySpider;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntitySpider;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSpider;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSpider;
import org.bukkit.entity.Spider;
import org.bukkit.util.Vector;
@@ -44,61 +46,37 @@ public class SpiderController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc == null)
- super.bq();
- else {
- NMS.updateAI(this);
- npc.update();
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -111,12 +89,24 @@ public class SpiderController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -142,6 +132,15 @@ public class SpiderController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -155,25 +154,18 @@ public class SpiderController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/SquidController.java b/src/main/java/net/citizensnpcs/npc/entity/SquidController.java
index 14a290cae..aea80f70b 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/SquidController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/SquidController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySquid;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntitySquid;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSquid;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSquid;
import org.bukkit.entity.Squid;
import org.bukkit.util.Vector;
@@ -44,52 +46,37 @@ public class SquidController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void bq() {
- if (npc != null) {
- npc.update();
- } else
- super.bq();
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -102,12 +89,17 @@ public class SquidController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -133,6 +125,15 @@ public class SquidController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -146,25 +147,18 @@ public class SquidController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java b/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java
index 07a3d11d5..9101ec1c3 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java
@@ -7,15 +7,17 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityHuman;
-import net.minecraft.server.v1_7_R4.EntityVillager;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityHuman;
+import net.minecraft.server.v1_8_R1.EntityVillager;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftVillager;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftVillager;
import org.bukkit.entity.Villager;
import org.bukkit.util.Vector;
@@ -57,9 +59,9 @@ public class VillagerController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@@ -70,45 +72,30 @@ public class VillagerController extends MobEntityController {
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -122,12 +109,25 @@ public class VillagerController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -153,6 +153,15 @@ public class VillagerController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -165,34 +174,27 @@ public class VillagerController extends MobEntityController {
return npc;
}
+ public boolean isBlockingTrades() {
+ return blockTrades;
+ }
+
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
- public boolean isBlockingTrades() {
- return blockTrades;
- }
-
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/WitchController.java b/src/main/java/net/citizensnpcs/npc/entity/WitchController.java
index 7902e1bc7..8c9d69aac 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/WitchController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/WitchController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityWitch;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityWitch;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWitch;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftWitch;
import org.bukkit.entity.Witch;
import org.bukkit.util.Vector;
@@ -44,51 +46,37 @@ public class WitchController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null)
- npc.update();
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -101,12 +89,24 @@ public class WitchController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null)
+ npc.update();
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -132,6 +132,15 @@ public class WitchController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -145,25 +154,18 @@ public class WitchController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/WitherController.java b/src/main/java/net/citizensnpcs/npc/entity/WitherController.java
index 52af885e7..9561f497f 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/WitherController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/WitherController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityWither;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityWither;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWither;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftWither;
import org.bukkit.entity.Wither;
import org.bukkit.util.Vector;
@@ -29,7 +29,6 @@ public class WitherController extends MobEntityController {
}
public static class EntityWitherNPC extends EntityWither implements NPCHolder {
- private int jumpTicks;
private final CitizensNPC npc;
public EntityWitherNPC(World world) {
@@ -45,38 +44,30 @@ public class WitherController extends MobEntityController {
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +81,17 @@ public class WitherController extends MobEntityController {
}
@Override
- public void e() {
+ protected void D() {
if (npc == null) {
- super.e();
- } else {
- updateAIWithMovement();
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
}
}
@@ -133,42 +130,9 @@ public class WitherController extends MobEntityController {
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- private void updateAIWithMovement() {
- NMS.updateAI(this);
- // taken from EntityLiving update method
- if (bc) {
- /* boolean inLiquid = H() || J();
- if (inLiquid) {
- motY += 0.04;
- } else //(handled elsewhere)*/
- if (onGround && jumpTicks == 0) {
- bj();
- jumpTicks = 10;
- }
- } else {
- jumpTicks = 0;
- }
- bd *= 0.98F;
- be *= 0.98F;
- bf *= 0.9F;
-
- e(bd, be); // movement method
- NMS.setHeadYaw(this, yaw);
- if (jumpTicks > 0) {
- jumpTicks--;
- }
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/WolfController.java b/src/main/java/net/citizensnpcs/npc/entity/WolfController.java
index 82f03dcd4..f9c94995a 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/WolfController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/WolfController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityWolf;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityWolf;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWolf;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftWolf;
import org.bukkit.entity.Wolf;
import org.bukkit.util.Vector;
@@ -55,52 +57,37 @@ public class WolfController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -114,12 +101,25 @@ public class WolfController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -145,6 +145,15 @@ public class WolfController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -158,25 +167,18 @@ public class WolfController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java b/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java
index 2eb11dccb..57c79a02e 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java
@@ -7,14 +7,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityZombie;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityZombie;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftZombie;
import org.bukkit.entity.Zombie;
import org.bukkit.util.Vector;
@@ -44,52 +46,37 @@ public class ZombieController extends MobEntityController {
}
@Override
- protected void a(double d0, boolean flag) {
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) {
- super.a(d0, flag);
+ super.a(d0, flag, block, blockposition);
}
}
@Override
- protected String aT() {
- return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT());
+ protected String bn() {
+ return npc == null ? super.bn() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bn());
}
@Override
- protected String aU() {
- return npc == null ? super.aU() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU());
+ protected String bo() {
+ return npc == null ? super.bo() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bo());
}
@Override
- protected void b(float f) {
- if (npc == null || !npc.isFlyable()) {
- super.b(f);
- }
- }
-
- @Override
- public void bn() {
- super.bn();
- if (npc != null) {
- npc.update();
- }
- }
-
- @Override
- public boolean bN() {
+ public boolean cb() {
if (npc == null)
- return super.bN();
+ return super.cb();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
- return super.bN();
- if (super.bN()) {
+ return super.cb();
+ if (super.cb()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -102,12 +89,25 @@ public class ZombieController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
+ @Override
+ protected void D() {
+ if (npc == null) {
+ super.D();
+ }
+ }
+
+ @Override
+ public void doTick() {
+ super.doTick();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
super.e(f, f1);
- } else {
- NMS.flyingMoveLogic(this, f, f1);
}
}
@@ -133,6 +133,15 @@ public class ZombieController extends MobEntityController {
// cancelled.
}
+ @Override
+ public void g(float f, float f1) {
+ if (npc == null || !npc.isFlyable()) {
+ super.g(f, f1);
+ } else {
+ NMS.flyingMoveLogic(this, f, f1);
+ }
+ }
+
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@@ -146,25 +155,18 @@ public class ZombieController extends MobEntityController {
}
@Override
- public boolean h_() {
+ public boolean j_() {
if (npc == null || !npc.isFlyable()) {
- return super.h_();
+ return super.j_();
} else {
return false;
}
}
@Override
- protected String t() {
- return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(
- NPC.AMBIENT_SOUND_METADATA, super.t());
- }
-
- @Override
- protected void w() {
- if (npc == null) {
- super.w();
- }
+ protected String z() {
+ return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
+ NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArmorStandController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArmorStandController.java
new file mode 100644
index 000000000..9d0ad3f52
--- /dev/null
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArmorStandController.java
@@ -0,0 +1,121 @@
+package net.citizensnpcs.npc.entity.nonliving;
+
+import net.citizensnpcs.api.event.NPCPushEvent;
+import net.citizensnpcs.api.npc.NPC;
+import net.citizensnpcs.npc.CitizensNPC;
+import net.citizensnpcs.npc.MobEntityController;
+import net.citizensnpcs.npc.ai.NPCHolder;
+import net.citizensnpcs.util.Util;
+import net.minecraft.server.v1_8_R1.EntityArmorStand;
+import net.minecraft.server.v1_8_R1.EntityHuman;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.Vec3D;
+import net.minecraft.server.v1_8_R1.World;
+
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftArmorStand;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.util.Vector;
+
+public class ArmorStandController extends MobEntityController {
+ public ArmorStandController() {
+ super(EntityArmorStandNPC.class);
+ }
+
+ @Override
+ public ArmorStand getBukkitEntity() {
+ return (ArmorStand) super.getBukkitEntity();
+ }
+
+ public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public ArmorStandNPC(EntityArmorStandNPC entity) {
+ super((CraftServer) Bukkit.getServer(), entity);
+ this.npc = entity.npc;
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+ }
+
+ public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder {
+ private final CitizensNPC npc;
+
+ public EntityArmorStandNPC(World world) {
+ this(world, null);
+ }
+
+ public EntityArmorStandNPC(World world, NPC npc) {
+ super(world);
+ this.npc = (CitizensNPC) npc;
+ }
+
+ @Override
+ public boolean a(EntityHuman paramEntityHuman, Vec3D paramVec3D) {
+ return true;
+ }
+
+ @Override
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
+ // this method is called by both the entities involved - cancelling
+ // it will not stop the NPC from moving.
+ super.collide(entity);
+ if (npc != null) {
+ Util.callCollisionEvent(npc, entity.getBukkitEntity());
+ }
+ }
+
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
+ @Override
+ public void g(double x, double y, double z) {
+ if (npc == null) {
+ super.g(x, y, z);
+ return;
+ }
+ if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
+ if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
+ super.g(x, y, z);
+ return;
+ }
+ Vector vector = new Vector(x, y, z);
+ NPCPushEvent event = Util.callPushEvent(npc, vector);
+ if (!event.isCancelled()) {
+ vector = event.getCollisionVector();
+ super.g(vector.getX(), vector.getY(), vector.getZ());
+ }
+ // when another entity collides, this method is called to push the
+ // NPC so we prevent it from doing anything if the event is
+ // cancelled.
+ }
+
+ @Override
+ public CraftEntity getBukkitEntity() {
+ if (bukkitEntity == null && npc != null) {
+ bukkitEntity = new ArmorStandNPC(this);
+ }
+ return super.getBukkitEntity();
+ }
+
+ @Override
+ public NPC getNPC() {
+ return npc;
+ }
+
+ @Override
+ public void s_() {
+ super.s_();
+ if (npc != null) {
+ npc.update();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArrowController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArrowController.java
index 80db88658..7e919ddac 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArrowController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArrowController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityArrow;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityArrow;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftArrow;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Arrow;
import org.bukkit.util.Vector;
@@ -59,7 +59,7 @@ public class ArrowController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -104,11 +104,11 @@ public class ArrowController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java
index 60ae2574a..aae6bc92f 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityBoat;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityBoat;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftBoat;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftBoat;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Boat;
import org.bukkit.util.Vector;
@@ -59,7 +59,7 @@ public class BoatController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -104,11 +104,11 @@ public class BoatController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EggController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EggController.java
index 9197c76c2..18e164ee8 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EggController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EggController.java
@@ -6,17 +6,17 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityEgg;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
-import net.minecraft.server.v1_7_R4.WorldServer;
+import net.minecraft.server.v1_8_R1.EntityEgg;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
+import net.minecraft.server.v1_8_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEgg;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEgg;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@@ -75,7 +75,7 @@ public class EggController extends AbstractEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -120,11 +120,11 @@ public class EggController extends AbstractEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderCrystalController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderCrystalController.java
index c915ec6a6..c6c7dfc32 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderCrystalController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderCrystalController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityEnderCrystal;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityEnderCrystal;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderCrystal;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEnderCrystal;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.util.Vector;
@@ -59,7 +59,7 @@ public class EnderCrystalController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -104,11 +104,11 @@ public class EnderCrystalController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderPearlController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderPearlController.java
index 870e16cb9..ad3f9cc42 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderPearlController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderPearlController.java
@@ -6,14 +6,15 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityEnderPearl;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityEnderPearl;
+import net.minecraft.server.v1_8_R1.EntityLiving;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderPearl;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEnderPearl;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.EnderPearl;
import org.bukkit.util.Vector;
@@ -45,21 +46,20 @@ public class EnderPearlController extends MobEntityController {
private final CitizensNPC npc;
public EntityEnderPearlNPC(World world) {
- this(world, null);
+ this(world, null, null);
}
- @Override
- public boolean d(NBTTagCompound save) {
- return npc == null ? super.d(save) : false;
+ public EntityEnderPearlNPC(World world, EntityLiving living) {
+ this(world, living, null);
}
- public EntityEnderPearlNPC(World world, NPC npc) {
- super(world);
+ public EntityEnderPearlNPC(World world, EntityLiving living, NPC npc) {
+ super(world, null);
this.npc = (CitizensNPC) npc;
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -68,6 +68,11 @@ public class EnderPearlController extends MobEntityController {
}
}
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -104,11 +109,11 @@ public class EnderPearlController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderSignalController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderSignalController.java
index 5c75b9186..52a7ac308 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderSignalController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/EnderSignalController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityEnderSignal;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityEnderSignal;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderSignal;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEnderSignal;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.EnderSignal;
import org.bukkit.util.Vector;
@@ -59,7 +59,7 @@ public class EnderSignalController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -104,11 +104,11 @@ public class EnderSignalController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ExperienceOrbController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ExperienceOrbController.java
index 0650e172c..4d68bf2cf 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ExperienceOrbController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ExperienceOrbController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityExperienceOrb;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityExperienceOrb;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftExperienceOrb;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftExperienceOrb;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.util.Vector;
@@ -40,7 +40,7 @@ public class ExperienceOrbController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class ExperienceOrbController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java
index 7b50979b6..71504b330 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java
@@ -6,21 +6,22 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.Block;
-import net.minecraft.server.v1_7_R4.Blocks;
-import net.minecraft.server.v1_7_R4.EntityFallingBlock;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
-import net.minecraft.server.v1_7_R4.WorldServer;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.Blocks;
+import net.minecraft.server.v1_8_R1.EntityFallingBlock;
+import net.minecraft.server.v1_8_R1.IBlockData;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
+import net.minecraft.server.v1_8_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
-import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftFallingSand;
+import org.bukkit.craftbukkit.v1_8_R1.util.CraftMagicNumbers;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.util.Vector;
@@ -39,8 +40,8 @@ public class FallingBlockController extends AbstractEntityController {
id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data(). get(NPC.ITEM_ID_METADATA,
npc.data(). get("falling-block-id"))));
}
- final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id,
- data);
+ final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(),
+ id.fromLegacyData(data));
return handle.getBukkitEntity();
}
@@ -61,18 +62,13 @@ public class FallingBlockController extends AbstractEntityController {
this.npc = (CitizensNPC) npc;
}
- public EntityFallingBlockNPC(World world, NPC npc, double d0, double d1, double d2, Block block, int data) {
- super(world, d0, d1, d2, block, data);
+ public EntityFallingBlockNPC(World world, NPC npc, double d0, double d1, double d2, IBlockData data) {
+ super(world, d0, d1, d2, data);
this.npc = (CitizensNPC) npc;
}
@Override
- public boolean d(NBTTagCompound save) {
- return npc == null ? super.d(save) : false;
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -81,6 +77,11 @@ public class FallingBlockController extends AbstractEntityController {
}
}
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -117,7 +118,7 @@ public class FallingBlockController extends AbstractEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
if (Math.abs(motX) > EPSILON || Math.abs(motY) > EPSILON || Math.abs(motZ) > EPSILON) {
@@ -127,7 +128,7 @@ public class FallingBlockController extends AbstractEntityController {
move(motX, motY, motZ);
}
} else {
- super.h();
+ super.s_();
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FireworkController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FireworkController.java
index ba7e96f6d..ef31fa1d6 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FireworkController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FireworkController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityFireworks;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityFireworks;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftFirework;
import org.bukkit.entity.Firework;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class FireworkController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class FireworkController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FishingHookController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FishingHookController.java
index 0f18999ab..00a326339 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FishingHookController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FishingHookController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityFishingHook;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityFishingHook;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFish;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftFish;
import org.bukkit.entity.Fish;
import org.bukkit.util.Vector;
@@ -40,12 +40,7 @@ public class FishingHookController extends MobEntityController {
}
@Override
- public boolean d(NBTTagCompound save) {
- return npc == null ? super.d(save) : false;
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -54,6 +49,11 @@ public class FishingHookController extends MobEntityController {
}
}
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -90,11 +90,11 @@ public class FishingHookController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemController.java
index c70431d16..88f57d5ae 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemController.java
@@ -6,21 +6,21 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityHuman;
-import net.minecraft.server.v1_7_R4.EntityItem;
-import net.minecraft.server.v1_7_R4.ItemStack;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
-import net.minecraft.server.v1_7_R4.WorldServer;
+import net.minecraft.server.v1_8_R1.EntityHuman;
+import net.minecraft.server.v1_8_R1.EntityItem;
+import net.minecraft.server.v1_8_R1.ItemStack;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
+import net.minecraft.server.v1_8_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftItem;
-import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftItem;
+import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.util.Vector;
@@ -51,11 +51,6 @@ public class ItemController extends AbstractEntityController {
public static class EntityItemNPC extends EntityItem implements NPCHolder {
private final CitizensNPC npc;
- @Override
- public boolean d(NBTTagCompound save) {
- return npc == null ? super.d(save) : false;
- }
-
public EntityItemNPC(World world) {
super(world);
this.npc = null;
@@ -67,14 +62,7 @@ public class ItemController extends AbstractEntityController {
}
@Override
- public void b_(EntityHuman entityhuman) {
- if (npc == null) {
- super.b_(entityhuman);
- }
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -83,6 +71,18 @@ public class ItemController extends AbstractEntityController {
}
}
+ @Override
+ public void d(EntityHuman entityhuman) {
+ if (npc == null) {
+ super.d(entityhuman);
+ }
+ }
+
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -119,11 +119,11 @@ public class ItemController extends AbstractEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemFrameController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemFrameController.java
index 0c03732a3..d4e89ecae 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemFrameController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ItemFrameController.java
@@ -6,15 +6,15 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityItemFrame;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityItemFrame;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftItemFrame;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftItemFrame;
import org.bukkit.entity.ItemFrame;
import org.bukkit.util.Vector;
@@ -38,18 +38,10 @@ public class ItemFrameController extends MobEntityController {
public EntityItemFrameNPC(World world, NPC npc) {
super(world);
this.npc = (CitizensNPC) npc;
- if (npc != null) {
- setDirection(0);
- }
}
@Override
- public boolean d(NBTTagCompound save) {
- return npc == null ? super.d(save) : false;
- }
-
- @Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -58,6 +50,11 @@ public class ItemFrameController extends MobEntityController {
}
}
+ @Override
+ public boolean d(NBTTagCompound save) {
+ return npc == null ? super.d(save) : false;
+ }
+
@Override
public void g(double x, double y, double z) {
if (npc == null) {
@@ -94,11 +91,11 @@ public class ItemFrameController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java
index e115f4d39..e00adc61b 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityLargeFireball;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityLargeFireball;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLargeFireball;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftLargeFireball;
import org.bukkit.entity.LargeFireball;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class LargeFireballController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class LargeFireballController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/LeashController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/LeashController.java
index da3ce798a..7ca3bb6d8 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/LeashController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/LeashController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityLeash;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityLeash;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLeash;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftLeash;
import org.bukkit.entity.LeashHitch;
import org.bukkit.util.Vector;
@@ -40,7 +40,7 @@ public class LeashController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class LeashController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartChestController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartChestController.java
index 09743068a..eb61688a3 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartChestController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartChestController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMinecartChest;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityMinecartChest;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecartChest;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftMinecartChest;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@@ -41,7 +41,7 @@ public class MinecartChestController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -91,12 +91,12 @@ public class MinecartChestController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartCommandController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartCommandController.java
index 876833b2f..d6c5743f9 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartCommandController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartCommandController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMinecartCommandBlock;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityMinecartCommandBlock;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecartCommand;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftMinecartCommand;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@@ -46,7 +46,7 @@ public class MinecartCommandController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -91,12 +91,12 @@ public class MinecartCommandController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartFurnaceController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartFurnaceController.java
index 602b5557c..83503b2b4 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartFurnaceController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartFurnaceController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMinecartFurnace;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityMinecartFurnace;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecartFurnace;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftMinecartFurnace;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@@ -46,7 +46,7 @@ public class MinecartFurnaceController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -91,12 +91,12 @@ public class MinecartFurnaceController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartHopperController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartHopperController.java
index bff33a007..0bab90bc5 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartHopperController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartHopperController.java
@@ -7,9 +7,9 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMinecartHopper;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityMinecartHopper;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@@ -42,7 +42,7 @@ public class MinecartHopperController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -79,12 +79,12 @@ public class MinecartHopperController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartRideableController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartRideableController.java
index 06463f196..92a9095a6 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartRideableController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartRideableController.java
@@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMinecartRideable;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityMinecartRideable;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecartRideable;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftMinecartRideable;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@@ -46,7 +46,7 @@ public class MinecartRideableController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -91,12 +91,12 @@ public class MinecartRideableController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartSpawnerController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartSpawnerController.java
index f7de50a3a..2a3c20855 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartSpawnerController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartSpawnerController.java
@@ -7,9 +7,9 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMinecartMobSpawner;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityMinecartMobSpawner;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@@ -42,7 +42,7 @@ public class MinecartSpawnerController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -79,12 +79,12 @@ public class MinecartSpawnerController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartTNTController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartTNTController.java
index 4ab8250e4..2ce2b2347 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartTNTController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/MinecartTNTController.java
@@ -7,9 +7,9 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityMinecartTNT;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityMinecartTNT;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@@ -42,7 +42,7 @@ public class MinecartTNTController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -79,12 +79,12 @@ public class MinecartTNTController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/PaintingController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/PaintingController.java
index 1d9d282e2..3c239bfdf 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/PaintingController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/PaintingController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityPainting;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityPainting;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPainting;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPainting;
import org.bukkit.entity.Painting;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class PaintingController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class PaintingController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/SmallFireballController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/SmallFireballController.java
index 31fd9345d..9cdb87895 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/SmallFireballController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/SmallFireballController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySmallFireball;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntitySmallFireball;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSmallFireball;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSmallFireball;
import org.bukkit.entity.SmallFireball;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class SmallFireballController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class SmallFireballController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/SnowballController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/SnowballController.java
index beb2fbf74..88bea189d 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/SnowballController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/SnowballController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntitySnowball;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntitySnowball;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSnowball;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftSnowball;
import org.bukkit.entity.Snowball;
import org.bukkit.util.Vector;
@@ -59,7 +59,7 @@ public class SnowballController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -104,11 +104,11 @@ public class SnowballController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/TNTPrimedController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/TNTPrimedController.java
index 76b402c05..d1ddaac7f 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/TNTPrimedController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/TNTPrimedController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityTNTPrimed;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityTNTPrimed;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftTNTPrimed;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftTNTPrimed;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class TNTPrimedController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class TNTPrimedController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownExpBottleController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownExpBottleController.java
index e633ce450..9c5d17705 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownExpBottleController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownExpBottleController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityThrownExpBottle;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityThrownExpBottle;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftThrownExpBottle;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftThrownExpBottle;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class ThrownExpBottleController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class ThrownExpBottleController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownPotionController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownPotionController.java
index 9c385b8fd..ceb8acfda 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownPotionController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ThrownPotionController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityPotion;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityPotion;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftThrownPotion;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftThrownPotion;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class ThrownPotionController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class ThrownPotionController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/WitherSkullController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/WitherSkullController.java
index 9b0353823..28c436d0e 100644
--- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/WitherSkullController.java
+++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/WitherSkullController.java
@@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityWitherSkull;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.EntityWitherSkull;
+import net.minecraft.server.v1_8_R1.NBTTagCompound;
+import net.minecraft.server.v1_8_R1.World;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWitherSkull;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftWitherSkull;
import org.bukkit.entity.WitherSkull;
import org.bukkit.util.Vector;
@@ -45,7 +45,7 @@ public class WitherSkullController extends MobEntityController {
}
@Override
- public void collide(net.minecraft.server.v1_7_R4.Entity entity) {
+ public void collide(net.minecraft.server.v1_8_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@@ -90,11 +90,11 @@ public class WitherSkullController extends MobEntityController {
}
@Override
- public void h() {
+ public void s_() {
if (npc != null) {
npc.update();
} else {
- super.h();
+ super.s_();
}
}
}
diff --git a/src/main/java/net/citizensnpcs/npc/network/EmptyChannel.java b/src/main/java/net/citizensnpcs/npc/network/EmptyChannel.java
index e89a267b3..9abf72d51 100644
--- a/src/main/java/net/citizensnpcs/npc/network/EmptyChannel.java
+++ b/src/main/java/net/citizensnpcs/npc/network/EmptyChannel.java
@@ -1,14 +1,14 @@
package net.citizensnpcs.npc.network;
-import java.net.SocketAddress;
+import io.netty.channel.AbstractChannel;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelConfig;
+import io.netty.channel.ChannelMetadata;
+import io.netty.channel.ChannelOutboundBuffer;
+import io.netty.channel.DefaultChannelConfig;
+import io.netty.channel.EventLoop;
-import net.minecraft.util.io.netty.channel.AbstractChannel;
-import net.minecraft.util.io.netty.channel.Channel;
-import net.minecraft.util.io.netty.channel.ChannelConfig;
-import net.minecraft.util.io.netty.channel.ChannelMetadata;
-import net.minecraft.util.io.netty.channel.ChannelOutboundBuffer;
-import net.minecraft.util.io.netty.channel.DefaultChannelConfig;
-import net.minecraft.util.io.netty.channel.EventLoop;
+import java.net.SocketAddress;
public class EmptyChannel extends AbstractChannel {
private final ChannelConfig config = new DefaultChannelConfig(this);
diff --git a/src/main/java/net/citizensnpcs/npc/network/EmptyNetHandler.java b/src/main/java/net/citizensnpcs/npc/network/EmptyNetHandler.java
index 3527e9e8c..5a5f6ab53 100644
--- a/src/main/java/net/citizensnpcs/npc/network/EmptyNetHandler.java
+++ b/src/main/java/net/citizensnpcs/npc/network/EmptyNetHandler.java
@@ -1,10 +1,10 @@
package net.citizensnpcs.npc.network;
-import net.minecraft.server.v1_7_R4.EntityPlayer;
-import net.minecraft.server.v1_7_R4.MinecraftServer;
-import net.minecraft.server.v1_7_R4.NetworkManager;
-import net.minecraft.server.v1_7_R4.Packet;
-import net.minecraft.server.v1_7_R4.PlayerConnection;
+import net.minecraft.server.v1_8_R1.EntityPlayer;
+import net.minecraft.server.v1_8_R1.MinecraftServer;
+import net.minecraft.server.v1_8_R1.NetworkManager;
+import net.minecraft.server.v1_8_R1.Packet;
+import net.minecraft.server.v1_8_R1.PlayerConnection;
public class EmptyNetHandler extends PlayerConnection {
public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer) {
diff --git a/src/main/java/net/citizensnpcs/npc/network/EmptyNetworkManager.java b/src/main/java/net/citizensnpcs/npc/network/EmptyNetworkManager.java
index 0e48f670a..68df8f472 100644
--- a/src/main/java/net/citizensnpcs/npc/network/EmptyNetworkManager.java
+++ b/src/main/java/net/citizensnpcs/npc/network/EmptyNetworkManager.java
@@ -3,10 +3,11 @@ package net.citizensnpcs.npc.network;
import java.io.IOException;
import net.citizensnpcs.util.NMS;
-import net.minecraft.server.v1_7_R4.NetworkManager;
+import net.minecraft.server.v1_8_R1.EnumProtocolDirection;
+import net.minecraft.server.v1_8_R1.NetworkManager;
public class EmptyNetworkManager extends NetworkManager {
- public EmptyNetworkManager(boolean flag) throws IOException {
+ public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException {
super(flag);
NMS.initNetworkManager(this);
}
diff --git a/src/main/java/net/citizensnpcs/trait/Controllable.java b/src/main/java/net/citizensnpcs/trait/Controllable.java
index de8ca2140..76fd26ff9 100644
--- a/src/main/java/net/citizensnpcs/trait/Controllable.java
+++ b/src/main/java/net/citizensnpcs/trait/Controllable.java
@@ -14,11 +14,11 @@ import net.citizensnpcs.api.trait.trait.Owner;
import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
-import net.minecraft.server.v1_7_R4.EntityEnderDragon;
-import net.minecraft.server.v1_7_R4.EntityLiving;
-import net.minecraft.server.v1_7_R4.EntityPlayer;
+import net.minecraft.server.v1_8_R1.EntityEnderDragon;
+import net.minecraft.server.v1_8_R1.EntityLiving;
+import net.minecraft.server.v1_8_R1.EntityPlayer;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@@ -79,7 +79,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
handle.setPassengerOf(getHandle());
}
- private net.minecraft.server.v1_7_R4.Entity getHandle() {
+ private net.minecraft.server.v1_8_R1.Entity getHandle() {
return NMS.getHandle(npc.getEntity());
}
@@ -186,7 +186,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
return enabled;
}
- private void setMountedYaw(net.minecraft.server.v1_7_R4.Entity handle) {
+ private void setMountedYaw(net.minecraft.server.v1_8_R1.Entity handle) {
if (handle instanceof EntityEnderDragon || !Setting.USE_BOAT_CONTROLS.asBoolean())
return; // EnderDragon handles this separately
double tX = handle.locX + handle.motX;
@@ -212,9 +212,9 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
return enabled;
}
- private double updateHorizontalSpeed(net.minecraft.server.v1_7_R4.Entity handle, double speed, float speedMod) {
+ private double updateHorizontalSpeed(net.minecraft.server.v1_8_R1.Entity handle, double speed, float speedMod) {
double oldSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
- double horizontal = ((EntityLiving) handle.passenger).be;
+ double horizontal = ((EntityLiving) handle.passenger).aY;
if (horizontal > 0.0D) {
double dXcos = -Math.sin(handle.passenger.yaw * Math.PI / 180.0F);
double dXsin = Math.cos(handle.passenger.yaw * Math.PI / 180.0F);
@@ -258,7 +258,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
@Override
public void run(Player rider) {
- net.minecraft.server.v1_7_R4.Entity handle = getHandle();
+ net.minecraft.server.v1_8_R1.Entity handle = getHandle();
boolean onGround = handle.onGround;
float speedMod = npc.getNavigator().getDefaultParameters()
.modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED));
@@ -309,7 +309,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
}
Vector dir = rider.getEyeLocation().getDirection();
dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier());
- net.minecraft.server.v1_7_R4.Entity handle = getHandle();
+ net.minecraft.server.v1_8_R1.Entity handle = getHandle();
handle.motX = dir.getX();
handle.motY = dir.getY();
handle.motZ = dir.getZ();
@@ -352,7 +352,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
getHandle().motY = 0.001;
return;
}
- net.minecraft.server.v1_7_R4.Entity handle = getHandle();
+ net.minecraft.server.v1_8_R1.Entity handle = getHandle();
this.speed = updateHorizontalSpeed(handle, this.speed, 1F);
boolean shouldJump = NMS.shouldJump(handle.passenger);
if (shouldJump) {
diff --git a/src/main/java/net/citizensnpcs/trait/waypoint/EntityEnderSignalMarker.java b/src/main/java/net/citizensnpcs/trait/waypoint/EntityEnderSignalMarker.java
index eeb884bbe..523a1f356 100644
--- a/src/main/java/net/citizensnpcs/trait/waypoint/EntityEnderSignalMarker.java
+++ b/src/main/java/net/citizensnpcs/trait/waypoint/EntityEnderSignalMarker.java
@@ -1,8 +1,8 @@
package net.citizensnpcs.trait.waypoint;
-import net.minecraft.server.v1_7_R4.DamageSource;
-import net.minecraft.server.v1_7_R4.EntityEnderSignal;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.DamageSource;
+import net.minecraft.server.v1_8_R1.EntityEnderSignal;
+import net.minecraft.server.v1_8_R1.World;
public class EntityEnderSignalMarker extends EntityEnderSignal {
public EntityEnderSignalMarker(World world) {
diff --git a/src/main/java/net/citizensnpcs/util/NMS.java b/src/main/java/net/citizensnpcs/util/NMS.java
index 908fcb9c3..9b02c8638 100644
--- a/src/main/java/net/citizensnpcs/util/NMS.java
+++ b/src/main/java/net/citizensnpcs/util/NMS.java
@@ -16,36 +16,37 @@ import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.citizensnpcs.npc.network.EmptyChannel;
-import net.minecraft.server.v1_7_R4.AttributeInstance;
-import net.minecraft.server.v1_7_R4.ControllerJump;
-import net.minecraft.server.v1_7_R4.DamageSource;
-import net.minecraft.server.v1_7_R4.EnchantmentManager;
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.EntityHorse;
-import net.minecraft.server.v1_7_R4.EntityHuman;
-import net.minecraft.server.v1_7_R4.EntityInsentient;
-import net.minecraft.server.v1_7_R4.EntityLiving;
-import net.minecraft.server.v1_7_R4.EntityMinecartAbstract;
-import net.minecraft.server.v1_7_R4.EntityPlayer;
-import net.minecraft.server.v1_7_R4.EntityTypes;
-import net.minecraft.server.v1_7_R4.GenericAttributes;
-import net.minecraft.server.v1_7_R4.MathHelper;
-import net.minecraft.server.v1_7_R4.MobEffectList;
-import net.minecraft.server.v1_7_R4.Navigation;
-import net.minecraft.server.v1_7_R4.NetworkManager;
-import net.minecraft.server.v1_7_R4.Packet;
-import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.AttributeInstance;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.ControllerJump;
+import net.minecraft.server.v1_8_R1.DamageSource;
+import net.minecraft.server.v1_8_R1.EnchantmentManager;
+import net.minecraft.server.v1_8_R1.Entity;
+import net.minecraft.server.v1_8_R1.EntityHorse;
+import net.minecraft.server.v1_8_R1.EntityHuman;
+import net.minecraft.server.v1_8_R1.EntityInsentient;
+import net.minecraft.server.v1_8_R1.EntityLiving;
+import net.minecraft.server.v1_8_R1.EntityMinecartAbstract;
+import net.minecraft.server.v1_8_R1.EntityPlayer;
+import net.minecraft.server.v1_8_R1.EntityTypes;
+import net.minecraft.server.v1_8_R1.GenericAttributes;
+import net.minecraft.server.v1_8_R1.MathHelper;
+import net.minecraft.server.v1_8_R1.NavigationAbstract;
+import net.minecraft.server.v1_8_R1.NetworkManager;
+import net.minecraft.server.v1_8_R1.Packet;
+import net.minecraft.server.v1_8_R1.PathfinderGoalSelector;
+import net.minecraft.server.v1_8_R1.World;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
-import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
-import org.bukkit.craftbukkit.v1_7_R4.CraftSound;
-import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_8_R1.CraftSound;
+import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
@@ -72,31 +73,21 @@ public class NMS {
}
public static void attack(EntityLiving handle, Entity target) {
- AttributeInstance attribute = handle.getAttributeInstance(GenericAttributes.e);
- float damage = (float) (attribute == null ? 1D : attribute.getValue());
-
- if (handle.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
- damage += 3 << handle.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
- }
-
- if (handle.hasEffect(MobEffectList.WEAKNESS)) {
- damage -= 2 << handle.getEffect(MobEffectList.WEAKNESS).getAmplifier();
- }
-
- int knockbackLevel = 0;
+ float f = (float) handle.getAttributeInstance(GenericAttributes.e).getValue();
+ int i = 0;
if (target instanceof EntityLiving) {
- damage += EnchantmentManager.a(handle, (EntityLiving) target);
- knockbackLevel += EnchantmentManager.getKnockbackEnchantmentLevel(handle, (EntityLiving) target);
+ f += EnchantmentManager.a(handle.bz(), ((EntityLiving) target).getMonsterType());
+ i += EnchantmentManager.a(handle);
}
- boolean success = target.damageEntity(DamageSource.mobAttack(handle), damage);
- if (!success)
- return;
+ boolean flag = target.damageEntity(DamageSource.mobAttack(handle), f);
- if (knockbackLevel > 0) {
- target.g(-Math.sin(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F, 0.1D,
- Math.cos(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F);
+ if (!flag)
+ return;
+ if (i > 0) {
+ target.g(-Math.sin(handle.yaw * Math.PI / 180.0F) * i * 0.5F, 0.1D, Math.cos(handle.yaw * Math.PI / 180.0F)
+ * i * 0.5F);
handle.motX *= 0.6D;
handle.motZ *= 0.6D;
}
@@ -126,52 +117,54 @@ public class NMS {
}
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
- if (entity.L()) {
+ if (entity.V()) {
entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ);
+
entity.motX *= 0.800000011920929D;
entity.motY *= 0.800000011920929D;
entity.motZ *= 0.800000011920929D;
- } else if (entity.P()) {
+ } else if (entity.ab()) {
entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ);
entity.motX *= 0.5D;
entity.motY *= 0.5D;
entity.motZ *= 0.5D;
} else {
- float f2 = 0.91F;
-
+ float c1 = 0.91F;
if (entity.onGround) {
- f2 = entity.world.getType(MathHelper.floor(entity.locX), MathHelper.floor(entity.boundingBox.b) - 1,
- MathHelper.floor(entity.locZ)).frictionFactor * 0.91F;
+ c1 = entity.world.getType(
+ new BlockPosition(MathHelper.floor(entity.locX),
+ MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ)))
+ .getBlock().frictionFactor * 0.91F;
}
- float f3 = 0.16277136F / (f2 * f2 * f2);
+ float f2 = 0.1627714F / (c1 * c1 * c1);
+ entity.a(f, f1, entity.onGround ? 0.1F * f2 : 0.02F);
- entity.a(f, f1, entity.onGround ? 0.1F * f3 : 0.02F);
- f2 = 0.91F;
+ c1 = 0.91F;
if (entity.onGround) {
- f2 = entity.world.getType(MathHelper.floor(entity.locX), MathHelper.floor(entity.boundingBox.b) - 1,
- MathHelper.floor(entity.locZ)).frictionFactor * 0.91F;
+ c1 = entity.world.getType(
+ new BlockPosition(MathHelper.floor(entity.locX),
+ MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ)))
+ .getBlock().frictionFactor * 0.91F;
}
entity.move(entity.motX, entity.motY, entity.motZ);
- entity.motX *= f2;
- entity.motY *= f2;
- entity.motZ *= f2;
+
+ entity.motX *= c1;
+ entity.motY *= c1;
+ entity.motZ *= c1;
}
-
- entity.aE = entity.aF;
- double d0 = entity.locX - entity.lastX;
- double d1 = entity.locZ - entity.lastZ;
- float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
-
- if (f4 > 1.0F) {
- f4 = 1.0F;
+ entity.ay = entity.az;
+ double d1 = entity.locX - entity.lastX;
+ double d2 = entity.locZ - entity.lastZ;
+ float f3 = MathHelper.sqrt(d1 * d1 + d2 * d2) * 4.0F;
+ if (f3 > 1.0F) {
+ f3 = 1.0F;
}
-
- entity.aF += (f4 - entity.aF) * 0.4F;
- entity.aG += entity.aF;
+ entity.az += (f3 - entity.az) * 0.4F;
+ entity.aA += entity.az;
}
@SuppressWarnings("deprecation")
@@ -211,10 +204,10 @@ public class NMS {
}
public static float getHeadYaw(EntityLiving handle) {
- return handle.aO;
+ return handle.aI;
}
- public static Navigation getNavigation(Entity handle) {
+ public static NavigationAbstract getNavigation(Entity handle) {
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
}
@@ -242,7 +235,7 @@ public class NMS {
}
public static float getStepHeight(LivingEntity entity) {
- return NMS.getHandle(entity).W;
+ return NMS.getHandle(entity).S;
}
public static void initNetworkManager(NetworkManager network) {
@@ -264,11 +257,11 @@ public class NMS {
Entity mcEntity = getHandle(entity);
if (mcEntity == null)
return false;
- return mcEntity.M() || mcEntity.P();
+ return mcEntity.W() || mcEntity.ab();
}
- public static boolean isNavigationFinished(Navigation navigation) {
- return navigation.g();
+ public static boolean isNavigationFinished(NavigationAbstract navigation) {
+ return navigation.m();
}
public static void loadPlugins() {
@@ -277,7 +270,7 @@ public class NMS {
public static void look(Entity handle, Entity target) {
if (handle instanceof EntityInsentient) {
- ((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).x());
+ ((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).bP());
} else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setTargetLook(target, 10F, 40F);
}
@@ -300,14 +293,11 @@ public class NMS {
Material mat = Material.getMaterial(npc.data().get(NPC.MINECART_ITEM_METADATA, ""));
int data = npc.data().get(NPC.MINECART_ITEM_DATA_METADATA, 0);
int offset = npc.data().get(NPC.MINECART_OFFSET_METADATA, 0);
- if (mat == null) {
- minecart.a(false);
- } else {
- minecart.a(true);
- minecart.k(mat.getId());
+ minecart.a(mat != null);
+ if (mat != null) {
+ minecart.a(Block.getById(mat.getId()).fromLegacyData(data));
}
- minecart.l(data);
- minecart.m(offset);
+ minecart.l(offset);
}
public static float modifiedSpeed(float baseSpeed, NPC npc) {
@@ -423,10 +413,10 @@ public class NMS {
while (yaw >= 180.0F) {
yaw -= 360.0F;
}
- handle.aO = yaw;
+ handle.aI = yaw;
if (!(handle instanceof EntityHuman))
- handle.aM = yaw;
- handle.aP = yaw;
+ handle.aG = yaw;
+ handle.aJ = yaw;
}
public static void setShouldJump(org.bukkit.entity.Entity entity) {
@@ -442,17 +432,17 @@ public class NMS {
}
public static void setStepHeight(EntityLiving entity, float height) {
- entity.W = height;
+ entity.S = height;
}
public static void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
if (!bukkitEntity.getType().isAlive())
return;
EntityLiving handle = NMS.getHandle((LivingEntity) bukkitEntity);
- handle.be = (float) d;
+ handle.aY = (float) d;
}
- public static boolean shouldJump(net.minecraft.server.v1_7_R4.Entity entity) {
+ public static boolean shouldJump(net.minecraft.server.v1_8_R1.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof EntityLiving))
return false;
try {
@@ -482,8 +472,8 @@ public class NMS {
return entity.getBukkitEntity();
}
- public static void stopNavigation(Navigation navigation) {
- navigation.h();
+ public static void stopNavigation(NavigationAbstract navigation) {
+ navigation.n();
}
public static void trySwim(org.bukkit.entity.Entity entity) {
@@ -510,8 +500,8 @@ public class NMS {
}
}
- public static void updateNavigation(Navigation navigation) {
- navigation.f();
+ public static void updateNavigation(NavigationAbstract navigation) {
+ navigation.k();
}
public static void updateNavigationWorld(org.bukkit.entity.Entity entity, org.bukkit.World world) {
@@ -542,7 +532,7 @@ public class NMS {
if (PATHFINDING_RANGE == null)
return;
EntityInsentient handle = (EntityInsentient) en;
- Navigation navigation = handle.getNavigation();
+ NavigationAbstract navigation = handle.getNavigation();
try {
AttributeInstance inst = (AttributeInstance) PATHFINDING_RANGE.get(navigation);
inst.setValue(pathfindingRange);
@@ -559,14 +549,14 @@ public class NMS {
private static final Map, Constructor>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap, Constructor>>();
private static Map> ENTITY_INT_TO_CLASS;
private static Field GOAL_FIELD = getField(PathfinderGoalSelector.class, "b");
- private static final Field JUMP_FIELD = getField(EntityLiving.class, "bc");
+ private static final Field JUMP_FIELD = getField(EntityLiving.class, "aW");
private static Map, Integer> MC_ENTITY_CLASS_TO_INT = null;
private static Map> MC_ENTITY_INT_TO_CLASS = null;
- private static Field NAVIGATION_WORLD_FIELD = getField(Navigation.class, "b");
- private static Field NETWORK_ADDRESS = getField(NetworkManager.class, "n");
- private static Field NETWORK_CHANNEL = getField(NetworkManager.class, "m");
+ private static Field NAVIGATION_WORLD_FIELD = getField(NavigationAbstract.class, "c");
+ private static Field NETWORK_ADDRESS = getField(NetworkManager.class, "j");
+ private static Field NETWORK_CHANNEL = getField(NetworkManager.class, "i");
private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
- private static Field PATHFINDING_RANGE = getField(Navigation.class, "e");
+ private static Field PATHFINDING_RANGE = getField(NavigationAbstract.class, "a");
private static final Random RANDOM = Util.getFastRandom();
static {
@@ -575,7 +565,7 @@ public class NMS {
ENTITY_INT_TO_CLASS = (Map>) field.get(null);
field = getField(EntityTypes.class, "f");
ENTITY_CLASS_TO_INT = (Map, Integer>) field.get(null);
- field = getField(EntityTypes.class, "d");
+ field = getField(EntityTypes.class, "c");
ENTITY_CLASS_TO_NAME = (Map, String>) field.get(null);
} catch (Exception e) {
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
diff --git a/src/main/java/net/citizensnpcs/util/PlayerAnimation.java b/src/main/java/net/citizensnpcs/util/PlayerAnimation.java
index 0261866ec..a671529a6 100644
--- a/src/main/java/net/citizensnpcs/util/PlayerAnimation.java
+++ b/src/main/java/net/citizensnpcs/util/PlayerAnimation.java
@@ -4,14 +4,14 @@ import java.util.Arrays;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.npc.ai.NPCHolder;
-import net.minecraft.server.v1_7_R4.EntityPlayer;
-import net.minecraft.server.v1_7_R4.Packet;
-import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
-import net.minecraft.server.v1_7_R4.PacketPlayOutBed;
-import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.EntityPlayer;
+import net.minecraft.server.v1_8_R1.Packet;
+import net.minecraft.server.v1_8_R1.PacketPlayOutAnimation;
+import net.minecraft.server.v1_8_R1.PacketPlayOutBed;
+import net.minecraft.server.v1_8_R1.PacketPlayOutEntityMetadata;
-import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
@@ -55,8 +55,8 @@ public enum PlayerAnimation {
new BukkitRunnable() {
@Override
public void run() {
- if (player.dead || !player.valid ||
- !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
+ if (player.dead || !player.valid
+ || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel();
return;
}
@@ -74,8 +74,8 @@ public enum PlayerAnimation {
SLEEP {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
- PacketPlayOutBed packet = new PacketPlayOutBed(player, (int) player.locX, (int) player.locY,
- (int) player.locZ);
+ PacketPlayOutBed packet = new PacketPlayOutBed(player, new BlockPosition((int) player.locX,
+ (int) player.locY, (int) player.locZ));
sendPacketNearby(packet, player, radius);
}
},
@@ -90,7 +90,7 @@ public enum PlayerAnimation {
START_USE_ITEM {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
- player.e(true);
+ player.f(true);
sendPacketNearby(new PacketPlayOutEntityMetadata(player.getId(), player.getDataWatcher(), true), player,
radius);
}
@@ -120,7 +120,7 @@ public enum PlayerAnimation {
STOP_USE_ITEM {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
- player.e(false);
+ player.f(false);
sendPacketNearby(new PacketPlayOutEntityMetadata(player.getId(), player.getDataWatcher(), true), player,
radius);
}
diff --git a/src/main/java/net/citizensnpcs/util/Util.java b/src/main/java/net/citizensnpcs/util/Util.java
index 7777e7163..b59b875ab 100644
--- a/src/main/java/net/citizensnpcs/util/Util.java
+++ b/src/main/java/net/citizensnpcs/util/Util.java
@@ -123,8 +123,8 @@ public class Util {
public static > T matchEnum(T[] values, String toMatch) {
toMatch = toMatch.toLowerCase().replace('-', '_').replace(' ', '_');
for (T check : values) {
- if (toMatch.equals(check.name().toLowerCase()) || toMatch.equals("item")
- && check == EntityType.DROPPED_ITEM) {
+ if (toMatch.equals(check.name().toLowerCase())
+ || (toMatch.equals("item") && check == EntityType.DROPPED_ITEM)) {
return check; // check for an exact match first
}
}
diff --git a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerJump.java b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerJump.java
index 7b11dcbb4..c57e4811f 100644
--- a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerJump.java
+++ b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerJump.java
@@ -15,7 +15,7 @@ public class PlayerControllerJump {
}
public void b() {
- this.a.f(this.b);
+ this.a.i(this.b);
this.b = false;
}
}
diff --git a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerLook.java b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerLook.java
index 77538f591..f7639c159 100644
--- a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerLook.java
+++ b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerLook.java
@@ -1,9 +1,11 @@
package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.EntityLiving;
-import net.minecraft.server.v1_7_R4.MathHelper;
+import net.minecraft.server.v1_8_R1.Entity;
+import net.minecraft.server.v1_8_R1.EntityLiving;
+import net.minecraft.server.v1_8_R1.MathHelper;
+
+import org.bukkit.craftbukkit.v1_8_R1.TrigMath;
public class PlayerControllerLook {
private final EntityHumanNPC a;
@@ -26,25 +28,25 @@ public class PlayerControllerLook {
double d1 = this.f - (this.a.locY + this.a.getHeadHeight());
double d2 = this.g - this.a.locZ;
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
- float f = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
- float f1 = (float) (-(Math.atan2(d1, d3) * 180.0D / 3.1415927410125732D));
- this.a.pitch = this.a(this.a.pitch, f1, this.c);
- this.a.aP = this.a(this.a.aP, f, this.b);
+ float f = (float) (TrigMath.atan2(d2, d0) * 180.0D / 3.141592741012573D) - 90.0F;
+ float f1 = (float) (-(TrigMath.atan2(d1, d3) * 180.0D / 3.141592741012573D));
+
+ this.a.pitch = a(this.a.pitch, f1, this.c);
+ this.a.aI = a(this.a.aI, f, this.b);
} else {
- this.a.aP = this.a(this.a.aP, this.a.aN, 10.0F);
+ this.a.aI = a(this.a.aI, this.a.aG, 10.0F);
}
- float f2 = MathHelper.g(this.a.aP - this.a.aN);
+ float f2 = MathHelper.g(this.a.aI - this.a.aG);
- if (!this.a.isNavigating()) {
+ if (!this.a.getNavigation().m()) {
if (f2 < -75.0F) {
- this.a.aP = this.a.aN - 75.0F;
+ this.a.aI = (this.a.aG - 75.0F);
}
- if (f2 > 75.0F) {
- this.a.aP = this.a.aN + 75.0F;
- }
+ if (f2 > 75.0F)
+ this.a.aI = (this.a.aG + 75.0F);
}
}
@@ -59,10 +61,10 @@ public class PlayerControllerLook {
public void a(Entity entity, float f, float f1) {
this.e = entity.locX;
- if (entity instanceof EntityLiving) {
- this.f = entity.locY + entity.getHeadHeight();
- } else {
- this.f = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D;
+ if ((entity instanceof EntityLiving))
+ this.f = (entity.locY + entity.getHeadHeight());
+ else {
+ this.f = ((entity.getBoundingBox().b + entity.getBoundingBox().e) / 2.0D);
}
this.g = entity.locZ;
@@ -84,4 +86,20 @@ public class PlayerControllerLook {
return f + f3;
}
-}
+
+ public boolean b() {
+ return this.d;
+ }
+
+ public double e() {
+ return this.e;
+ }
+
+ public double f() {
+ return this.f;
+ }
+
+ public double g() {
+ return this.g;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java
index 5df6772df..07b40bd11 100644
--- a/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java
+++ b/src/main/java/net/citizensnpcs/util/nms/PlayerControllerMove.java
@@ -2,17 +2,19 @@ package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
-import net.minecraft.server.v1_7_R4.AttributeInstance;
-import net.minecraft.server.v1_7_R4.GenericAttributes;
-import net.minecraft.server.v1_7_R4.MathHelper;
+import net.minecraft.server.v1_8_R1.AttributeInstance;
+import net.minecraft.server.v1_8_R1.GenericAttributes;
+import net.minecraft.server.v1_8_R1.MathHelper;
+
+import org.bukkit.craftbukkit.v1_8_R1.TrigMath;
public class PlayerControllerMove {
- private final EntityHumanNPC a;
- private double b;
- private double c;
- private double d;
- private double e;
- private boolean f;
+ protected EntityHumanNPC a;
+ protected double b;
+ protected double c;
+ protected double d;
+ protected double e;
+ protected boolean f;
public PlayerControllerMove(EntityHumanNPC entityinsentient) {
this.a = entityinsentient;
@@ -33,7 +35,7 @@ public class PlayerControllerMove {
this.f = true;
}
- private float a(float f, float f1, float f2) {
+ protected float a(float f, float f1, float f2) {
float f3 = MathHelper.g(f1 - f);
if (f3 > f2) {
@@ -44,7 +46,15 @@ public class PlayerControllerMove {
f3 = -f2;
}
- return f + f3;
+ float f4 = f + f3;
+
+ if (f4 < 0.0F)
+ f4 += 360.0F;
+ else if (f4 > 360.0F) {
+ f4 -= 360.0F;
+ }
+
+ return f4;
}
public double b() {
@@ -52,28 +62,40 @@ public class PlayerControllerMove {
}
public void c() {
- this.a.be = 0;
+ this.a.aY = 0F;
if (this.f) {
this.f = false;
- int i = MathHelper.floor(this.a.boundingBox.b + 0.5D);
+ int i = MathHelper.floor(this.a.getBoundingBox().b + 0.5D);
double d0 = this.b - this.a.locX;
double d1 = this.d - this.a.locZ;
double d2 = this.c - i;
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
- if (d3 >= 2.500000277905201E-7D) {
- float f = (float) (Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
- this.a.yaw = this.a(this.a.yaw, f, 30.0F);
+ if (d3 >= 2.500000277905201E-007D) {
+ float f = (float) (TrigMath.atan2(d1, d0) * 180.0D / 3.141592741012573D) - 90.0F;
+
+ this.a.yaw = a(this.a.yaw, f, 30.0F);
NMS.setHeadYaw(a, this.a.yaw);
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.d);
speed.setValue(0.1D * this.e);
float movement = (float) (this.e * speed.getValue()) * 10;
- this.a.i(movement);
- this.a.be = movement;
- if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) {
+ this.a.j(movement);
+ this.a.aY = movement;
+ if ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))
this.a.getControllerJump().a();
- }
}
}
}
-}
+
+ public double d() {
+ return this.b;
+ }
+
+ public double e() {
+ return this.c;
+ }
+
+ public double f() {
+ return this.d;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java b/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java
index 93a746459..bb5f8fc8a 100644
--- a/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java
+++ b/src/main/java/net/citizensnpcs/util/nms/PlayerNavigation.java
@@ -1,232 +1,147 @@
package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
-import net.minecraft.server.v1_7_R4.AttributeInstance;
-import net.minecraft.server.v1_7_R4.Block;
-import net.minecraft.server.v1_7_R4.Blocks;
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.EntityChicken;
-import net.minecraft.server.v1_7_R4.EntityInsentient;
-import net.minecraft.server.v1_7_R4.GenericAttributes;
-import net.minecraft.server.v1_7_R4.Material;
-import net.minecraft.server.v1_7_R4.MathHelper;
-import net.minecraft.server.v1_7_R4.Navigation;
-import net.minecraft.server.v1_7_R4.PathEntity;
-import net.minecraft.server.v1_7_R4.PathPoint;
-import net.minecraft.server.v1_7_R4.Vec3D;
-import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_8_R1.AttributeInstance;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.Blocks;
+import net.minecraft.server.v1_8_R1.ChunkCache;
+import net.minecraft.server.v1_8_R1.Entity;
+import net.minecraft.server.v1_8_R1.EntityChicken;
+import net.minecraft.server.v1_8_R1.EntityInsentient;
+import net.minecraft.server.v1_8_R1.GenericAttributes;
+import net.minecraft.server.v1_8_R1.Material;
+import net.minecraft.server.v1_8_R1.MathHelper;
+import net.minecraft.server.v1_8_R1.NavigationAbstract;
+import net.minecraft.server.v1_8_R1.PathEntity;
+import net.minecraft.server.v1_8_R1.PathPoint;
+import net.minecraft.server.v1_8_R1.Pathfinder;
+import net.minecraft.server.v1_8_R1.PathfinderNormal;
+import net.minecraft.server.v1_8_R1.Vec3D;
+import net.minecraft.server.v1_8_R1.World;
-public class PlayerNavigation extends Navigation {
-
- private final EntityHumanNPC a;
- private final World b;
- private PathEntity c;
- private double d;
- private final AttributeInstance e;
- private boolean f;
+public class PlayerNavigation extends NavigationAbstract {
+ private final AttributeInstance a;
+ private PathfinderNormal aa;
+ protected EntityHumanNPC b;
+ protected World c;
+ protected PathEntity d;
+ protected double e;
+ private int f;
+ private boolean ff;
private int g;
- private int h;
- private final Vec3D i = Vec3D.a(0.0D, 0.0D, 0.0D);
- private boolean j = true;
- private boolean k;
- private boolean l;
- private boolean m;
+ private Vec3D h = new Vec3D(0.0D, 0.0D, 0.0D);
+ private float i = 1.0F;
+ private final Pathfinder j;
public PlayerNavigation(EntityHumanNPC entityinsentient, World world) {
super(getDummyInsentient(entityinsentient), world);
- this.a = entityinsentient;
- this.b = world;
- this.e = entityinsentient.getAttributeInstance(GenericAttributes.b);
- this.e.setValue(24);
+ this.b = entityinsentient;
+ this.c = world;
+ this.a = entityinsentient.getAttributeInstance(GenericAttributes.b);
+ this.a.setValue(24);
+ this.j = a();
}
@Override
- public boolean a() {
- return this.l;
+ protected Pathfinder a() {
+ this.aa = new PathfinderNormal();
+ this.aa.a(true);
+ return new Pathfinder(this.aa);
}
@Override
- public void a(boolean flag) {
- this.l = flag;
- }
-
- @Override
- public void a(double d0) {
- this.d = d0;
- }
-
- @Override
- public PathEntity a(double d0, double d1, double d2) {
- return !this.l() ? null : this.b.a(this.a, MathHelper.floor(d0), (int) d1, MathHelper.floor(d2), this.d(),
- this.j, this.k, this.l, this.m);
- }
-
- @Override
- public boolean a(double d0, double d1, double d2, double d3) {
- PathEntity pathentity = this.a(MathHelper.floor(d0), ((int) d1), MathHelper.floor(d2));
-
- return this.a(pathentity, d3);
- }
-
- @Override
- public PathEntity a(Entity entity) {
- return !this.l() ? null : this.b.findPath(this.a, entity, this.d(), this.j, this.k, this.l, this.m);
- }
-
- @Override
- public boolean a(Entity entity, double d0) {
- PathEntity pathentity = this.a(entity);
-
- return pathentity != null ? this.a(pathentity, d0) : false;
- }
-
- private boolean a(int i, int j, int k, int l, int i1, int j1, Vec3D vec3d, double d0, double d1) {
- int k1 = i - l / 2;
- int l1 = k - j1 / 2;
-
- if (!this.b(k1, j, l1, l, i1, j1, vec3d, d0, d1)) {
- return false;
- } else {
- for (int i2 = k1; i2 < k1 + l; ++i2) {
- for (int j2 = l1; j2 < l1 + j1; ++j2) {
- double d2 = i2 + 0.5D - vec3d.a;
- double d3 = j2 + 0.5D - vec3d.c;
-
- if (d2 * d0 + d3 * d1 >= 0.0D) {
- Block block = this.b.getType(i2, j - 1, j2);
- Material material = block.getMaterial();
-
- if (material == Material.AIR) {
- return false;
- }
-
- if (material == Material.WATER && !this.a.M()) {
- return false;
- }
-
- if (material == Material.LAVA) {
- return false;
- }
- }
- }
- }
-
- return true;
+ public PathEntity a(BlockPosition paramBlockPosition) {
+ if (!b()) {
+ return null;
}
+
+ float f1 = i();
+ this.c.methodProfiler.a("pathfind");
+ BlockPosition localBlockPosition = new BlockPosition(this.b);
+ int k = (int) (f1 + 8.0F);
+
+ ChunkCache localChunkCache = new ChunkCache(this.c, localBlockPosition.a(-k, -k, -k), localBlockPosition.a(k,
+ k, k), 0);
+ PathEntity localPathEntity = this.j.a(localChunkCache, this.b, paramBlockPosition, f1);
+ this.c.methodProfiler.b();
+ return localPathEntity;
+ }
+
+ public void a(boolean paramBoolean) {
+ this.aa.c(paramBoolean);
}
@Override
- public boolean a(PathEntity pathentity, double d0) {
- if (pathentity == null) {
- this.c = null;
- return false;
- } else {
- if (!pathentity.a(this.c)) {
- this.c = pathentity;
- }
-
- if (this.f) {
- this.n();
- }
-
- if (this.c.d() == 0) {
- return false;
- } else {
- this.d = d0;
- Vec3D vec3d = this.j();
-
- this.h = this.g;
- this.i.a = vec3d.a;
- this.i.b = vec3d.b;
- this.i.c = vec3d.c;
- return true;
- }
- }
- }
-
- private boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k) {
- int l = MathHelper.floor(vec3d.a);
- int i1 = MathHelper.floor(vec3d.c);
- double d0 = vec3d1.a - vec3d.a;
- double d1 = vec3d1.c - vec3d.c;
- double d2 = d0 * d0 + d1 * d1;
-
- if (d2 < 1.0E-8D) {
- return false;
- } else {
- double d3 = 1.0D / Math.sqrt(d2);
-
- d0 *= d3;
- d1 *= d3;
- i += 2;
- k += 2;
- if (!this.a(l, (int) vec3d.b, i1, i, j, k, vec3d, d0, d1)) {
- return false;
- } else {
- i -= 2;
- k -= 2;
- double d4 = 1.0D / Math.abs(d0);
- double d5 = 1.0D / Math.abs(d1);
- double d6 = l * 1 - vec3d.a;
- double d7 = i1 * 1 - vec3d.c;
-
- if (d0 >= 0.0D) {
- ++d6;
- }
-
- if (d1 >= 0.0D) {
- ++d7;
- }
-
- d6 /= d0;
- d7 /= d1;
- int j1 = d0 < 0.0D ? -1 : 1;
- int k1 = d1 < 0.0D ? -1 : 1;
- int l1 = MathHelper.floor(vec3d1.a);
- int i2 = MathHelper.floor(vec3d1.c);
- int j2 = l1 - l;
- int k2 = i2 - i1;
-
- do {
- if (j2 * j1 <= 0 && k2 * k1 <= 0) {
- return true;
- }
-
- if (d6 < d7) {
- d6 += d4;
- l += j1;
- j2 = l1 - l;
- } else {
- d7 += d5;
- i1 += k1;
- k2 = i2 - i1;
- }
- } while (this.a(l, (int) vec3d.b, i1, i, j, k, vec3d, d0, d1));
-
- return false;
- }
- }
+ public void a(double paramDouble) {
+ this.e = paramDouble;
}
@Override
- public void b(boolean flag) {
- this.k = flag;
+ public boolean a(double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4) {
+ PathEntity localPathEntity = a(MathHelper.floor(paramDouble1), (int) paramDouble2,
+ MathHelper.floor(paramDouble3));
+ return a(localPathEntity, paramDouble4);
}
- private boolean b(int i, int j, int k, int l, int i1, int j1, Vec3D vec3d, double d0, double d1) {
- for (int k1 = i; k1 < i + l; ++k1) {
- for (int l1 = j; l1 < j + i1; ++l1) {
- for (int i2 = k; i2 < k + j1; ++i2) {
- double d2 = k1 + 0.5D - vec3d.a;
- double d3 = i2 + 0.5D - vec3d.c;
+ @Override
+ public PathEntity a(Entity paramEntity) {
+ if (!b()) {
+ return null;
+ }
- if (d2 * d0 + d3 * d1 >= 0.0D) {
- Block block = this.b.getType(k1, l1, i2);
+ float f1 = i();
+ this.c.methodProfiler.a("pathfind");
+ BlockPosition localBlockPosition = new BlockPosition(this.b).up();
+ int k = (int) (f1 + 16.0F);
- if (!block.b(this.b, k1, l1, i2)) {
- return false;
- }
- }
+ ChunkCache localChunkCache = new ChunkCache(this.c, localBlockPosition.a(-k, -k, -k), localBlockPosition.a(k,
+ k, k), 0);
+ PathEntity localPathEntity = this.j.a(localChunkCache, this.b, paramEntity, f1);
+ this.c.methodProfiler.b();
+ return localPathEntity;
+ }
+
+ @Override
+ public boolean a(Entity paramEntity, double paramDouble) {
+ PathEntity localPathEntity = a(paramEntity);
+ if (localPathEntity != null) {
+ return a(localPathEntity, paramDouble);
+ }
+ return false;
+ }
+
+ @Override
+ public void a(float paramFloat) {
+ this.i = paramFloat;
+ }
+
+ private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6,
+ Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
+ int i = paramInt1 - paramInt4 / 2;
+ int j = paramInt3 - paramInt6 / 2;
+
+ if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
+ return false;
+ }
+
+ for (int k = i; k < i + paramInt4; k++) {
+ for (int m = j; m < j + paramInt6; m++) {
+ double d1 = k + 0.5D - paramVec3D.a;
+ double d2 = m + 0.5D - paramVec3D.c;
+ if (d1 * paramDouble1 + d2 * paramDouble2 < 0.0D) {
+ continue;
+ }
+ Block localBlock = this.c.getType(new BlockPosition(k, paramInt2 - 1, m)).getBlock();
+ Material localMaterial = localBlock.getMaterial();
+ if (localMaterial == Material.AIR) {
+ return false;
+ }
+ if ((localMaterial == Material.WATER) && (!this.b.V())) {
+ return false;
+ }
+ if (localMaterial == Material.LAVA) {
+ return false;
}
}
}
@@ -235,162 +150,290 @@ public class PlayerNavigation extends Navigation {
}
@Override
- public boolean c() {
- return this.k;
+ public boolean a(PathEntity paramPathEntity, double paramDouble) {
+ if (paramPathEntity == null) {
+ this.d = null;
+ return false;
+ }
+ if (!paramPathEntity.a(this.d)) {
+ this.d = paramPathEntity;
+ }
+ d();
+ if (this.d.d() == 0) {
+ return false;
+ }
+
+ this.e = paramDouble;
+ Vec3D localVec3D = c();
+ this.g = this.f;
+ this.h = localVec3D;
+ return true;
}
@Override
- public void c(boolean flag) {
- this.j = flag;
- }
-
- @Override
- public float d() {
- return (float) this.e.getValue();
- }
-
- @Override
- public void d(boolean flag) {
- this.f = flag;
- }
-
- @Override
- public PathEntity e() {
- return this.c;
- }
-
- @Override
- public void e(boolean flag) {
- this.m = flag;
- }
-
- @Override
- public void f() {
- ++this.g;
- if (!this.g()) {
- if (this.l()) {
- this.i();
- }
-
- if (!this.g()) {
- Vec3D vec3d = this.c.a(this.a);
-
- if (vec3d != null) {
- this.a.setMoveDestination(vec3d.a, vec3d.b, vec3d.c, this.d);
- }
+ protected void a(Vec3D paramVec3D) {
+ if (this.f - this.g > 100) {
+ if (paramVec3D.distanceSquared(this.h) < 2.25D) {
+ n();
}
+ this.g = this.f;
+ this.h = paramVec3D;
}
}
@Override
- public boolean g() {
- return this.c == null || this.c.b();
+ protected boolean a(Vec3D paramVec3D1, Vec3D paramVec3D2, int paramInt1, int paramInt2, int paramInt3) {
+ int i = MathHelper.floor(paramVec3D1.a);
+ int j = MathHelper.floor(paramVec3D1.c);
+
+ double d1 = paramVec3D2.a - paramVec3D1.a;
+ double d2 = paramVec3D2.c - paramVec3D1.c;
+ double d3 = d1 * d1 + d2 * d2;
+ if (d3 < 1.0E-008D) {
+ return false;
+ }
+
+ double d4 = 1.0D / Math.sqrt(d3);
+ d1 *= d4;
+ d2 *= d4;
+
+ paramInt1 += 2;
+ paramInt3 += 2;
+ if (!a(i, (int) paramVec3D1.b, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
+ return false;
+ }
+ paramInt1 -= 2;
+ paramInt3 -= 2;
+
+ double d5 = 1.0D / Math.abs(d1);
+ double d6 = 1.0D / Math.abs(d2);
+
+ double d7 = i * 1 - paramVec3D1.a;
+ double d8 = j * 1 - paramVec3D1.c;
+ if (d1 >= 0.0D) {
+ d7 += 1.0D;
+ }
+ if (d2 >= 0.0D) {
+ d8 += 1.0D;
+ }
+ d7 /= d1;
+ d8 /= d2;
+
+ int k = d1 < 0.0D ? -1 : 1;
+ int m = d2 < 0.0D ? -1 : 1;
+ int n = MathHelper.floor(paramVec3D2.a);
+ int i1 = MathHelper.floor(paramVec3D2.c);
+ int i2 = n - i;
+ int i3 = i1 - j;
+ while ((i2 * k > 0) || (i3 * m > 0)) {
+ if (d7 < d8) {
+ d7 += d5;
+ i += k;
+ i2 = n - i;
+ } else {
+ d8 += d6;
+ j += m;
+ i3 = i1 - j;
+ }
+
+ if (!a(i, (int) paramVec3D1.b, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
+ return false;
+ }
+ }
+ return true;
}
@Override
- public void h() {
- this.c = null;
+ protected boolean b() {
+ return (this.b.onGround) || ((h()) && (o())) || ((this.b.av()) && ((this.b.vehicle instanceof EntityChicken)));
}
- private void i() {
- Vec3D vec3d = this.j();
- int i = this.c.d();
+ public void b(boolean paramBoolean) {
+ this.aa.b(paramBoolean);
+ }
- for (int j = this.c.e(); j < this.c.d(); ++j) {
- if (this.c.a(j).b != (int) vec3d.b) {
- i = j;
- break;
+ @SuppressWarnings("unchecked")
+ private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6,
+ Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
+ for (BlockPosition localBlockPosition : (Iterable) BlockPosition.a(new BlockPosition(paramInt1,
+ paramInt2, paramInt3), new BlockPosition(paramInt1 + paramInt4 - 1, paramInt2 + paramInt5 - 1,
+ paramInt3 + paramInt6 - 1))) {
+ double d1 = localBlockPosition.getX() + 0.5D - paramVec3D.a;
+ double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.c;
+ if (d1 * paramDouble1 + d2 * paramDouble2 < 0.0D) {
+ continue;
+ }
+ Block localBlock = this.c.getType(localBlockPosition).getBlock();
+ if (!localBlock.b(this.c, localBlockPosition)) {
+ return false;
}
}
+ return true;
+ }
- float f = this.a.width * this.a.width;
+ @Override
+ protected Vec3D c() {
+ return new Vec3D(this.b.locX, p(), this.b.locZ);
+ }
- int k;
+ public void c(boolean paramBoolean) {
+ this.aa.a(paramBoolean);
+ }
- for (k = this.c.e(); k < i; ++k) {
- if (vec3d.distanceSquared(this.c.a(this.a, k)) < f) {
- this.c.c(k + 1);
- }
- }
-
- k = MathHelper.f(this.a.width);
- int l = (int) this.a.length + 1;
- int i1 = k;
-
- for (int j1 = i - 1; j1 >= this.c.e(); --j1) {
- if (this.a(vec3d, this.c.a(this.a, j1), k, l, i1)) {
- this.c.c(j1);
- break;
- }
- }
-
- if (this.g - this.h > 100) {
- if (vec3d.distanceSquared(this.i) < 2.25D) {
- this.h();
+ @Override
+ protected void d() {
+ super.d();
+ if (this.ff) {
+ if (this.c.i(new BlockPosition(MathHelper.floor(this.b.locX), (int) (this.b.getBoundingBox().b + 0.5D),
+ MathHelper.floor(this.b.locZ)))) {
+ return;
}
- this.h = this.g;
- this.i.a = vec3d.a;
- this.i.b = vec3d.b;
- this.i.c = vec3d.c;
- }
- }
-
- private Vec3D j() {
- return Vec3D.a(this.a.locX, this.k(), this.a.locZ);
- }
-
- private int k() {
- if (this.a.M() && this.m) {
- int i = (int) this.a.boundingBox.b;
- Block block = this.b.getType(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ));
- int j = 0;
-
- do {
- if (block != Blocks.WATER && block != Blocks.STATIONARY_WATER) {
- return i;
- }
-
- ++i;
- block = this.b.getType(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ));
- ++j;
- } while (j <= 16);
-
- return (int) this.a.boundingBox.b;
- } else {
- return (int) (this.a.boundingBox.b + 0.5D);
- }
- }
-
- private boolean l() {
- return this.a.onGround || this.m && this.m() || this.a.am() && this.a.vehicle instanceof EntityChicken;
- }
-
- private boolean m() {
- return this.a.M() || this.a.P();
- }
-
- private void n() {
- if (!this.b
- .i(MathHelper.floor(this.a.locX), (int) (this.a.boundingBox.b + 0.5D), MathHelper.floor(this.a.locZ))) {
- for (int i = 0; i < this.c.d(); ++i) {
- PathPoint pathpoint = this.c.a(i);
-
- if (this.b.i(pathpoint.a, pathpoint.b, pathpoint.c)) {
- this.c.b(i - 1);
+ for (int i = 0; i < this.d.d(); i++) {
+ PathPoint localPathPoint = this.d.a(i);
+ if (this.c.i(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
+ this.d.b(i - 1);
return;
}
}
}
}
+ public void d(boolean paramBoolean) {
+ this.aa.d(paramBoolean);
+ }
+
+ public boolean e() {
+ return this.aa.e();
+ }
+
+ public void e(boolean paramBoolean) {
+ this.ff = paramBoolean;
+ }
+
+ public boolean g() {
+ return this.aa.b();
+ }
+
+ public boolean h() {
+ return this.aa.d();
+ }
+
+ @Override
+ public float i() {
+ return (float) this.a.getValue();
+ }
+
+ @Override
+ public PathEntity j() {
+ return this.d;
+ }
+
+ @Override
+ public void k() {
+ this.f += 1;
+ if (m()) {
+ return;
+ }
+
+ if (b()) {
+ l();
+ } else if ((this.d != null) && (this.d.e() < this.d.d())) {
+ Vec3D localVec3D1 = c();
+ Vec3D localVec3D2 = this.d.a(this.b, this.d.e());
+ if ((localVec3D1.b > localVec3D2.b) && (!this.b.onGround)
+ && (MathHelper.floor(localVec3D1.a) == MathHelper.floor(localVec3D2.a))
+ && (MathHelper.floor(localVec3D1.c) == MathHelper.floor(localVec3D2.c))) {
+ this.d.c(this.d.e() + 1);
+ }
+
+ }
+
+ if (m()) {
+ return;
+ }
+ Vec3D localVec3D1 = this.d.a(this.b);
+ if (localVec3D1 == null) {
+ return;
+ }
+ this.b.getControllerMove().a(localVec3D1.a, localVec3D1.b, localVec3D1.c, this.e);
+ }
+
+ @Override
+ protected void l() {
+ Vec3D localVec3D1 = c();
+
+ int k = this.d.d();
+ for (int m = this.d.e(); m < this.d.d(); m++) {
+ if (this.d.a(m).b != (int) localVec3D1.b) {
+ k = m;
+ break;
+ }
+
+ }
+
+ float f1 = this.b.width * this.b.width * this.i;
+ for (int n = this.d.e(); n < k; n++) {
+ Vec3D localVec3D2 = this.d.a(this.b, n);
+ if (localVec3D1.distanceSquared(localVec3D2) < f1) {
+ this.d.c(n + 1);
+ }
+
+ }
+ int n = MathHelper.f(this.b.width);
+ int i1 = (int) this.b.length + 1;
+ for (int i3 = k - 1; i3 >= this.d.e(); i3--) {
+ if (a(localVec3D1, this.d.a(this.b, i3), n, i1, n)) {
+ this.d.c(i3);
+ break;
+ }
+ }
+
+ a(localVec3D1);
+ }
+
+ @Override
+ public boolean m() {
+ return (this.d == null) || (this.d.b());
+ }
+
+ @Override
+ public void n() {
+ this.d = null;
+ }
+
+ @Override
+ protected boolean o() {
+ return (this.b.V()) || (this.b.ab());
+ }
+
+ private int p() {
+ if ((!this.b.V()) || (!h())) {
+ return (int) (this.b.getBoundingBox().b + 0.5D);
+ }
+
+ int i = (int) this.b.getBoundingBox().b;
+ Block localBlock = this.c.getType(
+ new BlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ))).getBlock();
+ int j = 0;
+ while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
+ i++;
+ localBlock = this.c.getType(
+ new BlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ))).getBlock();
+ j++;
+ if (j > 16) {
+ return (int) this.b.getBoundingBox().b;
+ }
+ }
+ return i;
+ }
+
public void setRange(float pathfindingRange) {
- this.e.setValue(pathfindingRange);
+ this.a.setValue(pathfindingRange);
}
private static EntityInsentient getDummyInsentient(EntityHumanNPC from) {
return new EntityInsentient(null) {
};
}
-
}
\ No newline at end of file