Almost complete initial pass at 1.9

This commit is contained in:
fullwall 2016-03-01 11:12:13 +08:00
parent 589c58ae36
commit a34a3c0850
85 changed files with 2686 additions and 2457 deletions

View File

@ -92,7 +92,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
saves = new NBTStorage(new File(folder + File.separator + Setting.STORAGE_FILE.asString()), saves = new NBTStorage(new File(folder + File.separator + Setting.STORAGE_FILE.asString()),
"Citizens NPC Storage"); "Citizens NPC Storage");
} }
if (saves == null){ if (saves == null) {
saves = new YamlStorage(new File(folder, Setting.STORAGE_FILE.asString()), "Citizens NPC Storage"); saves = new YamlStorage(new File(folder, Setting.STORAGE_FILE.asString()), "Citizens NPC Storage");
} }
if (!saves.load()) if (!saves.load())
@ -457,8 +457,5 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
return false; return false;
} }
public static void main(String[] args) { private static final String COMPATIBLE_MC_REVISION = "1_9_R1";
}
private static final String COMPATIBLE_MC_REVISION = "1_8_R3";
} }

View File

@ -7,9 +7,8 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -45,7 +44,7 @@ import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.util.Messages; import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_9_R1.PacketPlayOutEntityTeleport;
public class CitizensNPC extends AbstractNPC { public class CitizensNPC extends AbstractNPC {
private EntityController entityController; private EntityController entityController;
@ -192,7 +191,7 @@ public class CitizensNPC extends AbstractNPC {
entityController.spawn(at, this); entityController.spawn(at, this);
net.minecraft.server.v1_8_R3.Entity mcEntity = ((CraftEntity) getEntity()).getHandle(); net.minecraft.server.v1_9_R1.Entity mcEntity = ((CraftEntity) getEntity()).getHandle();
boolean couldSpawn = !Util.isLoaded(at) ? false : mcEntity.world.addEntity(mcEntity, SpawnReason.CUSTOM); boolean couldSpawn = !Util.isLoaded(at) ? false : mcEntity.world.addEntity(mcEntity, SpawnReason.CUSTOM);
// send skin packets, if applicable, before other NMS packets are sent // send skin packets, if applicable, before other NMS packets are sent
@ -301,12 +300,6 @@ public class CitizensNPC extends AbstractNPC {
if (getEntity() instanceof LivingEntity) { if (getEntity() instanceof LivingEntity) {
boolean nameplateVisible = data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true); boolean nameplateVisible = data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true);
((LivingEntity) getEntity()).setCustomNameVisible(nameplateVisible); ((LivingEntity) getEntity()).setCustomNameVisible(nameplateVisible);
Byte toByte = Byte.valueOf((byte) (nameplateVisible ? 1 : 0));
try {
((CraftLivingEntity) getEntity()).getHandle().getDataWatcher().watch(3, toByte);
} catch (NullPointerException e) {
((CraftLivingEntity) getEntity()).getHandle().getDataWatcher().a(3, toByte);
}
} }
} catch (Exception ex) { } catch (Exception ex) {
Throwable error = Throwables.getRootCause(ex); Throwable error = Throwables.getRootCause(ex);

View File

@ -2,6 +2,11 @@ package net.citizensnpcs.npc;
import java.util.Map; import java.util.Map;
import org.bukkit.entity.EntityType;
import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
import net.citizensnpcs.npc.entity.BatController; import net.citizensnpcs.npc.entity.BatController;
import net.citizensnpcs.npc.entity.BlazeController; import net.citizensnpcs.npc.entity.BlazeController;
import net.citizensnpcs.npc.entity.CaveSpiderController; import net.citizensnpcs.npc.entity.CaveSpiderController;
@ -36,7 +41,6 @@ import net.citizensnpcs.npc.entity.WitherController;
import net.citizensnpcs.npc.entity.WolfController; import net.citizensnpcs.npc.entity.WolfController;
import net.citizensnpcs.npc.entity.ZombieController; import net.citizensnpcs.npc.entity.ZombieController;
import net.citizensnpcs.npc.entity.nonliving.ArmorStandController; 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.BoatController;
import net.citizensnpcs.npc.entity.nonliving.EggController; import net.citizensnpcs.npc.entity.nonliving.EggController;
import net.citizensnpcs.npc.entity.nonliving.EnderCrystalController; import net.citizensnpcs.npc.entity.nonliving.EnderCrystalController;
@ -61,13 +65,9 @@ import net.citizensnpcs.npc.entity.nonliving.SnowballController;
import net.citizensnpcs.npc.entity.nonliving.TNTPrimedController; import net.citizensnpcs.npc.entity.nonliving.TNTPrimedController;
import net.citizensnpcs.npc.entity.nonliving.ThrownExpBottleController; import net.citizensnpcs.npc.entity.nonliving.ThrownExpBottleController;
import net.citizensnpcs.npc.entity.nonliving.ThrownPotionController; import net.citizensnpcs.npc.entity.nonliving.ThrownPotionController;
import net.citizensnpcs.npc.entity.nonliving.TippedArrowController;
import net.citizensnpcs.npc.entity.nonliving.WitherSkullController; import net.citizensnpcs.npc.entity.nonliving.WitherSkullController;
import org.bukkit.entity.EntityType;
import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
public class EntityControllers { public class EntityControllers {
public static boolean controllerExistsForType(EntityType type) { public static boolean controllerExistsForType(EntityType type) {
return TYPES.containsKey(type); return TYPES.containsKey(type);
@ -92,7 +92,7 @@ public class EntityControllers {
private static final Map<EntityType, Class<? extends EntityController>> TYPES = Maps.newEnumMap(EntityType.class); private static final Map<EntityType, Class<? extends EntityController>> TYPES = Maps.newEnumMap(EntityType.class);
static { static {
TYPES.put(EntityType.ARROW, ArrowController.class); TYPES.put(EntityType.ARROW, TippedArrowController.class);
TYPES.put(EntityType.ARMOR_STAND, ArmorStandController.class); TYPES.put(EntityType.ARMOR_STAND, ArmorStandController.class);
TYPES.put(EntityType.BAT, BatController.class); TYPES.put(EntityType.BAT, BatController.class);
TYPES.put(EntityType.BLAZE, BlazeController.class); TYPES.put(EntityType.BLAZE, BlazeController.class);

View File

@ -3,16 +3,16 @@ package net.citizensnpcs.npc;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.Map; import java.util.Map;
import net.citizensnpcs.api.npc.NPC;
import net.minecraft.server.v1_8_R3.World;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.citizensnpcs.api.npc.NPC;
import net.minecraft.server.v1_9_R1.World;
public abstract class MobEntityController extends AbstractEntityController { public abstract class MobEntityController extends AbstractEntityController {
private final Constructor<?> constructor; private final Constructor<?> constructor;
@ -23,7 +23,7 @@ public abstract class MobEntityController extends AbstractEntityController {
@Override @Override
protected Entity createEntity(Location at, NPC npc) { protected Entity createEntity(Location at, NPC npc) {
net.minecraft.server.v1_8_R3.Entity entity = createEntityFromClass(((CraftWorld) at.getWorld()).getHandle(), net.minecraft.server.v1_9_R1.Entity entity = createEntityFromClass(((CraftWorld) at.getWorld()).getHandle(),
npc); npc);
entity.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch()); 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(); return entity.getBukkitEntity();
} }
private net.minecraft.server.v1_8_R3.Entity createEntityFromClass(Object... args) { private net.minecraft.server.v1_9_R1.Entity createEntityFromClass(Object... args) {
try { try {
return (net.minecraft.server.v1_8_R3.Entity) constructor.newInstance(args); return (net.minecraft.server.v1_9_R1.Entity) constructor.newInstance(args);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
return null; return null;

View File

@ -70,7 +70,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
} }
vector = plan.getCurrentVector(); vector = plan.getCurrentVector();
} }
net.minecraft.server.v1_8_R3.Entity handle = NMS.getHandle(npc.getEntity()); net.minecraft.server.v1_9_R1.Entity handle = NMS.getHandle(npc.getEntity());
double dX = vector.getBlockX() - handle.locX; double dX = vector.getBlockX() - handle.locX;
double dZ = vector.getBlockZ() - handle.locZ; double dZ = vector.getBlockZ() - handle.locZ;
double dY = vector.getY() - handle.locY; double dY = vector.getY() - handle.locY;

View File

@ -1,8 +1,8 @@
package net.citizensnpcs.npc.ai; package net.citizensnpcs.npc.ai;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.citizensnpcs.api.ai.tree.BehaviorStatus; import net.citizensnpcs.api.ai.tree.BehaviorStatus;
@ -10,17 +10,17 @@ import net.citizensnpcs.api.npc.BlockBreaker;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.PlayerAnimation; import net.citizensnpcs.util.PlayerAnimation;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.Blocks;
import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_9_R1.EnchantmentManager;
import net.minecraft.server.v1_8_R3.Enchantment; import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_8_R3.EnchantmentManager; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EnumItemSlot;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.ItemStack; import net.minecraft.server.v1_9_R1.ItemStack;
import net.minecraft.server.v1_8_R3.Material; import net.minecraft.server.v1_9_R1.Material;
import net.minecraft.server.v1_8_R3.MobEffectList; import net.minecraft.server.v1_9_R1.MobEffects;
public class CitizensBlockBreaker extends BlockBreaker { public class CitizensBlockBreaker extends BlockBreaker {
private final BlockBreakerConfiguration configuration; private final BlockBreakerConfiguration configuration;
@ -47,17 +47,17 @@ public class CitizensBlockBreaker extends BlockBreaker {
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2); return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
} }
private net.minecraft.server.v1_8_R3.ItemStack getCurrentItem() { private net.minecraft.server.v1_9_R1.ItemStack getCurrentItem() {
return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item())
: entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(0) : null; : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null;
} }
private float getStrength(Block block) { private float getStrength(IBlockData block) {
float base = block.g(null, new BlockPosition(0, 0, 0)); float base = block.getBlock().b(block, null, new BlockPosition(0, 0, 0));
return base < 0.0F ? 0.0F : (!isDestroyable(block) ? 1.0F / base / 100.0F : strengthMod(block) / base / 30.0F); return base < 0.0F ? 0.0F : (!isDestroyable(block) ? 1.0F / base / 100.0F : strengthMod(block) / base / 30.0F);
} }
private boolean isDestroyable(Block block) { private boolean isDestroyable(IBlockData block) {
if (block.getMaterial().isAlwaysDestroyable()) { if (block.getMaterial().isAlwaysDestroyable()) {
return true; return true;
} else { } else {
@ -99,7 +99,7 @@ public class CitizensBlockBreaker extends BlockBreaker {
if (entity instanceof EntityPlayer) { if (entity instanceof EntityPlayer) {
PlayerAnimation.ARM_SWING.play((Player) entity.getBukkitEntity()); PlayerAnimation.ARM_SWING.play((Player) entity.getBukkitEntity());
} }
Block block = entity.world.getType(new BlockPosition(x, y, z)).getBlock(); IBlockData block = entity.world.getType(new BlockPosition(x, y, z));
if (block == null || block == Blocks.AIR) { if (block == null || block == Blocks.AIR) {
return BehaviorStatus.SUCCESS; return BehaviorStatus.SUCCESS;
} else { } else {
@ -128,35 +128,45 @@ public class CitizensBlockBreaker extends BlockBreaker {
return entity.world.getType(new BlockPosition(x, y, z)).getBlock() != Blocks.AIR; return entity.world.getType(new BlockPosition(x, y, z)).getBlock() != Blocks.AIR;
} }
private float strengthMod(Block block) { private float strengthMod(IBlockData block) {
ItemStack itemstack = getCurrentItem(); ItemStack itemstack = getCurrentItem();
float strength = itemstack != null ? itemstack.a(block) : 1; float f = itemstack.a(block);
int ench = EnchantmentManager.getEnchantmentLevel(Enchantment.DURABILITY.id, getCurrentItem());
if (ench > 0 && itemstack != null) {
float levelSquared = ench * ench + 1;
if (!itemstack.b(block) && strength <= 1.0F) {
strength += levelSquared * 0.08F;
} else {
strength += levelSquared;
}
}
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
EntityLiving living = (EntityLiving) entity; EntityLiving handle = (EntityLiving) entity;
if (living.hasEffect(MobEffectList.FASTER_DIG)) { if (f > 1.0F) {
strength *= 1.0F + (living.getEffect(MobEffectList.FASTER_DIG).getAmplifier() + 1) * 0.2F; int i = EnchantmentManager.getDigSpeedEnchantmentLevel(handle);
if (i > 0) {
f += i * i + 1;
}
} }
if (living.hasEffect(MobEffectList.SLOWER_DIG)) { if (handle.hasEffect(MobEffects.FASTER_DIG)) {
strength *= 1.0F - (living.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F; f *= (1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F);
} }
if (entity.a(Material.WATER) && !EnchantmentManager.j(living)) { if (handle.hasEffect(MobEffects.SLOWER_DIG)) {
strength /= 5.0F; float f1 = 1.0F;
switch (handle.getEffect(MobEffects.SLOWER_DIG).getAmplifier()) {
case 0:
f1 = 0.3F;
break;
case 1:
f1 = 0.09F;
break;
case 2:
f1 = 0.0027F;
break;
case 3:
default:
f1 = 8.1E-4F;
}
f *= f1;
}
if ((handle.a(Material.WATER)) && (!EnchantmentManager.i(handle))) {
f /= 5.0F;
} }
} }
if (!entity.onGround) { if (!entity.onGround) {
strength /= 5.0F; f /= 5.0F;
} }
return strength; return f;
} }
} }

View File

@ -18,7 +18,7 @@ import net.citizensnpcs.api.astar.pathfinder.VectorNode;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_9_R1.MathHelper;
public class FlyingAStarNavigationStrategy extends AbstractPathStrategy { public class FlyingAStarNavigationStrategy extends AbstractPathStrategy {
private final NPC npc; private final NPC npc;

View File

@ -1,15 +1,15 @@
package net.citizensnpcs.npc.ai; package net.citizensnpcs.npc.ai;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity;
import net.citizensnpcs.api.ai.NavigatorParameters; import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.ai.TargetType; import net.citizensnpcs.api.ai.TargetType;
import net.citizensnpcs.api.ai.event.CancelReason; import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.NavigationAbstract; import net.minecraft.server.v1_9_R1.NavigationAbstract;
public class MCNavigationStrategy extends AbstractPathStrategy { public class MCNavigationStrategy extends AbstractPathStrategy {
private final EntityLiving handle; private final EntityLiving handle;

View File

@ -1,7 +1,7 @@
package net.citizensnpcs.npc.ai; package net.citizensnpcs.npc.ai;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import net.citizensnpcs.api.ai.AttackStrategy; import net.citizensnpcs.api.ai.AttackStrategy;
@ -12,10 +12,10 @@ import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.PlayerAnimation; import net.citizensnpcs.util.PlayerAnimation;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_8_R3.NavigationAbstract; import net.minecraft.server.v1_9_R1.NavigationAbstract;
public class MCTargetStrategy implements PathStrategy, EntityTarget { public class MCTargetStrategy implements PathStrategy, EntityTarget {
private final boolean aggro; private final boolean aggro;

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftBat; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftBat;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Bat; import org.bukkit.entity.Bat;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityBat; import net.minecraft.server.v1_9_R1.EntityBat;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class BatController extends MobEntityController { public class BatController extends MobEntityController {
public BatController() { public BatController() {
@ -60,33 +61,19 @@ public class BatController extends MobEntityController {
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bo() return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); : npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bp() return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); : npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null) {
return super.cc();
}
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -100,23 +87,6 @@ public class BatController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void E() {
if (npc == null) {
super.E();
} else {
NMS.updateAI(this);
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -150,6 +120,12 @@ public class BatController extends MobEntityController {
// cancelled. // cancelled.
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -162,14 +138,39 @@ public class BatController extends MobEntityController {
return npc; return npc;
} }
public void setFlying(boolean flying) { @Override
setAsleep(flying); public boolean isLeashed() {
if (npc == null) {
return super.isLeashed();
}
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
} }
@Override @Override
protected String z() { protected void L() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() if (npc == null) {
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); super.L();
}
}
@Override
public void M() {
if (npc == null) {
super.M();
} else {
NMS.updateAI(this);
npc.update();
}
}
public void setFlying(boolean flying) {
setAsleep(flying);
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftBlaze; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Blaze; import org.bukkit.entity.Blaze;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityBlaze; import net.minecraft.server.v1_9_R1.EntityBlaze;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class BlazeController extends MobEntityController { public class BlazeController extends MobEntityController {
public BlazeController() { public BlazeController() {
@ -59,30 +60,19 @@ public class BlazeController extends MobEntityController {
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -96,20 +86,6 @@ public class BlazeController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void E() {
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -143,6 +119,12 @@ public class BlazeController extends MobEntityController {
// cancelled. // cancelled.
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -156,9 +138,30 @@ public class BlazeController extends MobEntityController {
} }
@Override @Override
protected String z() { public boolean isLeashed() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() if (npc == null)
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
if (npc != null) {
npc.update();
}
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCaveSpider; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.CaveSpider; import org.bukkit.entity.CaveSpider;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityCaveSpider;
import net.minecraft.server.v1_8_R3.EntityCaveSpider; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class CaveSpiderController extends MobEntityController { public class CaveSpiderController extends MobEntityController {
public CaveSpiderController() { public CaveSpiderController() {
@ -61,39 +62,26 @@ public class CaveSpiderController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null) {
return super.cc();
}
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) {
return super.cc();
}
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -107,13 +95,6 @@ public class CaveSpiderController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -121,14 +102,6 @@ public class CaveSpiderController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -171,6 +144,12 @@ public class CaveSpiderController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -184,9 +163,39 @@ public class CaveSpiderController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null) {
return super.isLeashed();
}
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) {
return super.isLeashed();
}
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -200,11 +209,5 @@ public class CaveSpiderController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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());
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Chicken; import org.bukkit.entity.Chicken;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityChicken;
import net.minecraft.server.v1_8_R3.EntityChicken; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class ChickenController extends MobEntityController { public class ChickenController extends MobEntityController {
public ChickenController() { public ChickenController() {
@ -72,37 +73,26 @@ public class ChickenController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -116,13 +106,6 @@ public class ChickenController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -130,14 +113,6 @@ public class ChickenController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -180,6 +155,12 @@ public class ChickenController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -193,18 +174,40 @@ public class ChickenController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() super.M();
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCow; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftCow;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Cow; import org.bukkit.entity.Cow;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityCow;
import net.minecraft.server.v1_8_R3.EntityCow; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class CowController extends MobEntityController { public class CowController extends MobEntityController {
public CowController() { public CowController() {
@ -73,37 +74,26 @@ public class CowController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -117,13 +107,6 @@ public class CowController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -131,14 +114,6 @@ public class CowController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -181,6 +156,12 @@ public class CowController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -194,18 +175,40 @@ public class CowController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() super.M();
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreeper; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Creeper; import org.bukkit.entity.Creeper;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,13 +15,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityCreeper;
import net.minecraft.server.v1_8_R3.EntityCreeper; import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_9_R1.EntityLightning;
import net.minecraft.server.v1_8_R3.EntityLightning; import net.minecraft.server.v1_9_R1.EnumHand;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.ItemStack;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class CreeperController extends MobEntityController { public class CreeperController extends MobEntityController {
public CreeperController() { public CreeperController() {
@ -64,42 +67,32 @@ public class CreeperController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected boolean a(EntityHuman entityhuman) { protected boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
return npc == null || !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true) ? super.a(entityhuman) : false; return npc == null || !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)
? super.a(entityhuman, enumhand, itemstack) : false;
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -112,13 +105,6 @@ public class CreeperController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -126,14 +112,6 @@ public class CreeperController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -176,6 +154,12 @@ public class CreeperController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -189,9 +173,37 @@ public class CreeperController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -216,11 +228,5 @@ public class CreeperController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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());
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderDragon; import net.minecraft.server.v1_9_R1.EntityEnderDragon;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class EnderDragonController extends MobEntityController { public class EnderDragonController extends MobEntityController {
public EnderDragonController() { public EnderDragonController() {
@ -59,30 +60,19 @@ public class EnderDragonController extends MobEntityController {
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -95,13 +85,6 @@ public class EnderDragonController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -135,6 +118,12 @@ public class EnderDragonController extends MobEntityController {
// cancelled. // cancelled.
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -157,7 +146,27 @@ public class EnderDragonController extends MobEntityController {
} }
@Override @Override
public void m() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void n() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
if (motX != 0 || motY != 0 || motZ != 0) { if (motX != 0 || motY != 0 || motZ != 0) {
@ -168,14 +177,8 @@ public class EnderDragonController extends MobEntityController {
setPosition(locX + motX, locY + motY, locZ + motZ); setPosition(locX + motX, locY + motY, locZ + motZ);
} }
} else { } else {
super.m(); super.n();
} }
} }
@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());
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderman; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Enderman; import org.bukkit.entity.Enderman;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityEnderman;
import net.minecraft.server.v1_8_R3.EntityEnderman; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class EndermanController extends MobEntityController { public class EndermanController extends MobEntityController {
public EndermanController() { public EndermanController() {
@ -61,37 +62,26 @@ public class EndermanController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -104,13 +94,6 @@ public class EndermanController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -118,13 +101,6 @@ public class EndermanController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -167,6 +143,12 @@ public class EndermanController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -180,17 +162,44 @@ public class EndermanController extends MobEntityController {
} }
@Override @Override
protected boolean k(double d1, double d2, double d3) { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public boolean k(double d1, double d2, double d3) {
if (npc == null) { if (npc == null) {
return super.j(d1, d2, d3); return super.k(d1, d2, d3);
} }
return false; return false;
} }
@Override @Override
public boolean k_() { protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -204,11 +213,5 @@ public class EndermanController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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());
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEndermite; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEndermite;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Endermite; import org.bukkit.entity.Endermite;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityEndermite;
import net.minecraft.server.v1_8_R3.EntityEndermite; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class EndermiteController extends MobEntityController { public class EndermiteController extends MobEntityController {
public EndermiteController() { public EndermiteController() {
@ -61,37 +62,26 @@ public class EndermiteController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -104,13 +94,6 @@ public class EndermiteController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -118,13 +101,6 @@ public class EndermiteController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -167,6 +143,12 @@ public class EndermiteController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -180,9 +162,36 @@ public class EndermiteController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -196,11 +205,5 @@ public class EndermiteController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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());
}
} }
} }

View File

@ -7,8 +7,8 @@ import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue; import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -37,24 +37,25 @@ import net.citizensnpcs.util.nms.PlayerControllerJump;
import net.citizensnpcs.util.nms.PlayerControllerLook; import net.citizensnpcs.util.nms.PlayerControllerLook;
import net.citizensnpcs.util.nms.PlayerControllerMove; import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.citizensnpcs.util.nms.PlayerNavigation; import net.citizensnpcs.util.nms.PlayerNavigation;
import net.minecraft.server.v1_8_R3.AttributeInstance; import net.minecraft.server.v1_9_R1.AttributeInstance;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.EnumItemSlot;
import net.minecraft.server.v1_8_R3.EnumProtocolDirection; import net.minecraft.server.v1_9_R1.EnumProtocolDirection;
import net.minecraft.server.v1_8_R3.GenericAttributes; import net.minecraft.server.v1_9_R1.GenericAttributes;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_9_R1.MathHelper;
import net.minecraft.server.v1_8_R3.NavigationAbstract; import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_8_R3.NetworkManager; import net.minecraft.server.v1_9_R1.NavigationAbstract;
import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_9_R1.NetworkManager;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; import net.minecraft.server.v1_9_R1.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; import net.minecraft.server.v1_9_R1.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_8_R3.PlayerInteractManager; import net.minecraft.server.v1_9_R1.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_9_R1.PlayerInteractManager;
import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode; import net.minecraft.server.v1_9_R1.WorldServer;
import net.minecraft.server.v1_9_R1.WorldSettings.EnumGamemode;
public class EntityHumanNPC extends EntityPlayer implements NPCHolder, SkinnableEntity { public class EntityHumanNPC extends EntityPlayer implements NPCHolder, SkinnableEntity {
private PlayerControllerJump controllerJump; private PlayerControllerJump controllerJump;
@ -83,14 +84,14 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -231,7 +232,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
try { try {
conn = new EmptyNetworkManager(EnumProtocolDirection.CLIENTBOUND); conn = new EmptyNetworkManager(EnumProtocolDirection.CLIENTBOUND);
playerConnection = new EmptyNetHandler(minecraftServer, conn, this); playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
conn.a(playerConnection); conn.setPacketListener(playerConnection);
socket.close(); socket.close();
} catch (IOException e) { } catch (IOException e) {
// swallow // swallow
@ -257,69 +258,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
} }
@Override @Override
public boolean k_() { public void m() {
if (npc == null || !npc.isFlyable()) { super.m();
return super.k_();
} else {
return false;
}
}
private void moveOnCurrentHeading() {
NMS.updateAI(this);
if (aY) {
if (onGround && jumpTicks == 0) {
bF();
jumpTicks = 10;
}
} else {
jumpTicks = 0;
}
aZ *= 0.98F;
ba *= 0.98F;
bb *= 0.9F;
g(aZ, ba); // 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);
}
public void setShouldJump() {
controllerJump.a();
}
@Override
public void setSkinFlags(byte flags) {
// set skin flag byte (DataWatcher API is lacking so
// catch the NPE as a sign that this is a MC 1.7 server without the
// skin flag)
try {
getDataWatcher().watch(10, flags);
} catch (NullPointerException e) {
getDataWatcher().a(10, flags);
}
}
@Override
public void setSkinName(String name) {
Preconditions.checkNotNull(name);
npc.data().setPersistent(NPC.PLAYER_SKIN_UUID_METADATA, name.toLowerCase());
skinTracker.notifySkinChange();
}
public void setTargetLook(Entity target, float yawOffset, float renderOffset) {
controllerLook.a(target, yawOffset, renderOffset);
}
@Override
public void t_() {
super.t_();
if (npc == null) if (npc == null)
return; return;
boolean navigating = npc.getNavigator().isNavigating(); boolean navigating = npc.getNavigator().isNavigating();
@ -346,6 +286,61 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
npc.update(); npc.update();
} }
private void moveOnCurrentHeading() {
NMS.updateAI(this);
if (bc) {
if (onGround && jumpTicks == 0) {
ch();
jumpTicks = 10;
}
} else {
jumpTicks = 0;
}
bd *= 0.98F;
be *= 0.98F;
bf *= 0.9F;
g(bd, be); // movement method
NMS.setHeadYaw(this, yaw);
if (jumpTicks > 0) {
jumpTicks--;
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
}
public void setMoveDestination(double x, double y, double z, double speed) {
controllerMove.a(x, y, z, speed);
}
public void setShouldJump() {
controllerJump.a();
}
@Override
public void setSkinFlags(byte flags) {
// set skin flag byte
getDataWatcher().set(bp, flags);
}
@Override
public void setSkinName(String name) {
Preconditions.checkNotNull(name);
npc.data().setPersistent(NPC.PLAYER_SKIN_UUID_METADATA, name.toLowerCase());
skinTracker.notifySkinChange();
}
public void setTargetLook(Entity target, float yawOffset, float renderOffset) {
controllerLook.a(target, yawOffset, renderOffset);
}
public void updateAI() { public void updateAI() {
controllerMove.c(); controllerMove.c();
controllerLook.a(); controllerLook.a();
@ -361,8 +356,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
packets[5] = new PacketPlayOutEntityHeadRotation(this, packets[5] = new PacketPlayOutEntityHeadRotation(this,
(byte) MathHelper.d(NMS.getHeadYaw(this) * 256.0F / 360.0F)); (byte) MathHelper.d(NMS.getHeadYaw(this) * 256.0F / 360.0F));
} }
for (int i = 0; i < 5; i++) { int i = 0;
packets[i] = new PacketPlayOutEntityEquipment(getId(), i, getEquipment(i)); for (EnumItemSlot slot : EnumItemSlot.values()) {
packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
} }
boolean removeFromPlayerList = npc.data().get("removefromplayerlist", boolean removeFromPlayerList = npc.data().get("removefromplayerlist",
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean()); Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGhast; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftGhast;
import org.bukkit.entity.Ghast; import org.bukkit.entity.Ghast;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityGhast; import net.minecraft.server.v1_9_R1.EntityGhast;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class GhastController extends MobEntityController { public class GhastController extends MobEntityController {
public GhastController() { public GhastController() {
@ -45,35 +46,24 @@ public class GhastController extends MobEntityController {
} }
@Override @Override
public boolean bM() { protected SoundEffect bR() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
}
@Override
protected SoundEffect bS() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
}
@Override
public boolean co() {
return npc != null; return npc != null;
} }
@Override @Override
protected String bo() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
}
@Override
protected String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
}
@Override
public boolean cc() {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -86,21 +76,6 @@ public class GhastController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void E() {
if (npc != null) {
npc.update();
}
super.E();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -134,6 +109,12 @@ public class GhastController extends MobEntityController {
// cancelled. // cancelled.
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -147,9 +128,31 @@ public class GhastController extends MobEntityController {
} }
@Override @Override
protected String z() { public boolean isLeashed() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() if (npc == null)
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
if (npc != null) {
npc.update();
}
super.M();
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGiant; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftGiant;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityGiantZombie;
import net.minecraft.server.v1_8_R3.EntityGiantZombie; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class GiantController extends MobEntityController { public class GiantController extends MobEntityController {
public GiantController() { public GiantController() {
@ -47,37 +48,26 @@ public class GiantController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class GiantController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -146,6 +129,12 @@ public class GiantController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -159,9 +148,29 @@ public class GiantController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -175,12 +184,6 @@ public class GiantController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 GiantNPC extends CraftGiant implements NPCHolder { public static class GiantNPC extends CraftGiant implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGuardian; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftGuardian;
import org.bukkit.entity.Guardian; import org.bukkit.entity.Guardian;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityGuardian;
import net.minecraft.server.v1_8_R3.EntityGuardian; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class GuardianController extends MobEntityController { public class GuardianController extends MobEntityController {
public GuardianController() { public GuardianController() {
@ -47,37 +48,26 @@ public class GuardianController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -91,13 +81,6 @@ public class GuardianController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -147,6 +130,12 @@ public class GuardianController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -160,11 +149,22 @@ public class GuardianController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@ -177,6 +177,15 @@ public class GuardianController extends MobEntityController {
} }
} }
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
}
@Override @Override
public void setElder(boolean flag) { public void setElder(boolean flag) {
float oldw = width; float oldw = width;
@ -196,12 +205,6 @@ public class GuardianController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 { public static class GuardianNPC extends CraftGuardian implements NPCHolder {

View File

@ -2,9 +2,9 @@ package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftHorse;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -17,11 +17,12 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.HorseModifiers; import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityHorse;
import net.minecraft.server.v1_8_R3.EntityHorse; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class HorseController extends MobEntityController { public class HorseController extends MobEntityController {
public HorseController() { public HorseController() {
@ -67,37 +68,26 @@ public class HorseController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -106,24 +96,17 @@ public class HorseController extends MobEntityController {
} }
} }
@Override
public boolean cp() {
if (npc == null)
return super.cp();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return super.cp() && !protectedDefault;
}
@Override @Override
public boolean d(NBTTagCompound save) { public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override @Override
protected void D() { public boolean dd() {
if (npc == null) { if (npc == null)
super.D(); return super.dd();
} boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return super.dd() && !protectedDefault;
} }
@Override @Override
@ -133,16 +116,6 @@ public class HorseController extends MobEntityController {
} }
} }
@Override
public void E() {
if (npc == null) {
super.E();
} else {
NMS.setStepHeight(this, 1);
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -185,6 +158,12 @@ public class HorseController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -198,18 +177,42 @@ public class HorseController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() if (npc == null) {
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); super.M();
} else {
NMS.setStepHeight(this, 1);
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }

View File

@ -6,7 +6,7 @@ import java.util.regex.Pattern;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
@ -22,8 +22,8 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.skin.Skin; import net.citizensnpcs.npc.skin.Skin;
import net.citizensnpcs.npc.skin.SkinnableEntity; import net.citizensnpcs.npc.skin.SkinnableEntity;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.PlayerInteractManager; import net.minecraft.server.v1_9_R1.PlayerInteractManager;
import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_9_R1.WorldServer;
public class HumanController extends AbstractEntityController { public class HumanController extends AbstractEntityController {
public HumanController() { public HumanController() {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftIronGolem; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftIronGolem;
import org.bukkit.entity.IronGolem; import org.bukkit.entity.IronGolem;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityIronGolem;
import net.minecraft.server.v1_8_R3.EntityIronGolem; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class IronGolemController extends MobEntityController { public class IronGolemController extends MobEntityController {
public IronGolemController() { public IronGolemController() {
@ -47,37 +48,26 @@ public class IronGolemController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class IronGolemController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -104,13 +87,6 @@ public class IronGolemController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -153,6 +129,12 @@ public class IronGolemController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -166,9 +148,36 @@ public class IronGolemController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -182,12 +191,6 @@ public class IronGolemController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 IronGolemNPC extends CraftIronGolem implements NPCHolder { public static class IronGolemNPC extends CraftIronGolem implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMagmaCube; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMagmaCube;
import org.bukkit.entity.MagmaCube; import org.bukkit.entity.MagmaCube;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -16,11 +16,12 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.citizensnpcs.util.nms.PlayerControllerMove; import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityMagmaCube;
import net.minecraft.server.v1_8_R3.EntityMagmaCube; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class MagmaCubeController extends MobEntityController { public class MagmaCubeController extends MobEntityController {
public MagmaCubeController() { public MagmaCubeController() {
@ -50,33 +51,22 @@ public class MagmaCubeController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
} : npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
@Override
public boolean cc() {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
} }
@Override @Override
@ -87,7 +77,7 @@ public class MagmaCubeController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -100,13 +90,6 @@ public class MagmaCubeController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -114,13 +97,6 @@ public class MagmaCubeController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -163,6 +139,12 @@ public class MagmaCubeController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -176,9 +158,36 @@ public class MagmaCubeController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -192,12 +201,6 @@ public class MagmaCubeController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 MagmaCubeNPC extends CraftMagmaCube implements NPCHolder { public static class MagmaCubeNPC extends CraftMagmaCube implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMushroomCow; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMushroomCow;
import org.bukkit.entity.MushroomCow; import org.bukkit.entity.MushroomCow;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityMushroomCow;
import net.minecraft.server.v1_8_R3.EntityMushroomCow; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class MushroomCowController extends MobEntityController { public class MushroomCowController extends MobEntityController {
@ -59,37 +60,26 @@ public class MushroomCowController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -102,13 +92,6 @@ public class MushroomCowController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -116,13 +99,6 @@ public class MushroomCowController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -165,6 +141,12 @@ public class MushroomCowController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -178,18 +160,39 @@ public class MushroomCowController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() super.M();
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftOcelot; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftOcelot;
import org.bukkit.entity.Ocelot; import org.bukkit.entity.Ocelot;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityOcelot;
import net.minecraft.server.v1_8_R3.EntityOcelot; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class OcelotController extends MobEntityController { public class OcelotController extends MobEntityController {
public OcelotController() { public OcelotController() {
@ -58,37 +59,26 @@ public class OcelotController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -101,13 +91,6 @@ public class OcelotController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -115,13 +98,6 @@ public class OcelotController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -164,6 +140,12 @@ public class OcelotController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -177,18 +159,39 @@ public class OcelotController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() super.M();
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPig; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPig;
import org.bukkit.entity.Pig; import org.bukkit.entity.Pig;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,12 +15,13 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityLightning;
import net.minecraft.server.v1_8_R3.EntityLightning; import net.minecraft.server.v1_9_R1.EntityPig;
import net.minecraft.server.v1_8_R3.EntityPig; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class PigController extends MobEntityController { public class PigController extends MobEntityController {
public PigController() { public PigController() {
@ -59,37 +60,26 @@ public class PigController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -103,13 +93,6 @@ public class PigController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -117,13 +100,6 @@ public class PigController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -166,6 +142,12 @@ public class PigController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -179,9 +161,36 @@ public class PigController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -193,12 +202,6 @@ public class PigController extends MobEntityController {
super.onLightningStrike(entitylightning); super.onLightningStrike(entitylightning);
} }
} }
@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 PigNPC extends CraftPig implements NPCHolder { public static class PigNPC extends CraftPig implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPigZombie;
import org.bukkit.entity.PigZombie; import org.bukkit.entity.PigZombie;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityPigZombie;
import net.minecraft.server.v1_8_R3.EntityPigZombie; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class PigZombieController extends MobEntityController { public class PigZombieController extends MobEntityController {
@ -48,37 +49,26 @@ public class PigZombieController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -91,13 +81,6 @@ public class PigZombieController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -105,13 +88,6 @@ public class PigZombieController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -155,6 +131,12 @@ public class PigZombieController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -168,18 +150,39 @@ public class PigZombieController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() super.M();
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftRabbit; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftRabbit;
import org.bukkit.entity.Rabbit; import org.bukkit.entity.Rabbit;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,12 +15,13 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EntityRabbit;
import net.minecraft.server.v1_8_R3.EntityRabbit; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class RabbitController extends MobEntityController { public class RabbitController extends MobEntityController {
public RabbitController() { public RabbitController() {
@ -59,37 +60,26 @@ public class RabbitController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -103,13 +93,6 @@ public class RabbitController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -117,16 +100,6 @@ public class RabbitController extends MobEntityController {
} }
} }
@Override
public void E() {
if (npc != null) {
super.E();
npc.update();
} else {
super.E();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -169,6 +142,12 @@ public class RabbitController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -187,9 +166,39 @@ public class RabbitController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
if (npc != null) {
super.M();
npc.update();
} else {
super.M();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -198,17 +207,13 @@ public class RabbitController extends MobEntityController {
@Override @Override
public void setRabbitType(int i) { public void setRabbitType(int i) {
if (npc != null) { if (npc != null) {
this.datawatcher.watch(18, (byte) i); if (NMS.getRabbitTypeField() == null)
return;
this.datawatcher.set(NMS.getRabbitTypeField(), i);
return; return;
} }
super.setRabbitType(i); super.setRabbitType(i);
} }
@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 { public static class RabbitNPC extends CraftRabbit implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSheep; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSheep;
import org.bukkit.entity.Sheep; import org.bukkit.entity.Sheep;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntitySheep;
import net.minecraft.server.v1_8_R3.EntitySheep; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class SheepController extends MobEntityController { public class SheepController extends MobEntityController {
public SheepController() { public SheepController() {
@ -58,37 +59,26 @@ public class SheepController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -101,13 +91,6 @@ public class SheepController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -115,13 +98,6 @@ public class SheepController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -164,6 +140,12 @@ public class SheepController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -177,18 +159,39 @@ public class SheepController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() super.M();
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSilverfish; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSilverfish;
import org.bukkit.entity.Silverfish; import org.bukkit.entity.Silverfish;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntitySilverfish;
import net.minecraft.server.v1_8_R3.EntitySilverfish; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class SilverfishController extends MobEntityController { public class SilverfishController extends MobEntityController {
public SilverfishController() { public SilverfishController() {
@ -47,37 +48,26 @@ public class SilverfishController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class SilverfishController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -104,13 +87,6 @@ public class SilverfishController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -153,6 +129,12 @@ public class SilverfishController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -166,9 +148,36 @@ public class SilverfishController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -182,12 +191,6 @@ public class SilverfishController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 SilverfishNPC extends CraftSilverfish implements NPCHolder { public static class SilverfishNPC extends CraftSilverfish implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSkeleton; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSkeleton;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntitySkeleton;
import net.minecraft.server.v1_8_R3.EntitySkeleton; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class SkeletonController extends MobEntityController { public class SkeletonController extends MobEntityController {
public SkeletonController() { public SkeletonController() {
@ -47,37 +48,26 @@ public class SkeletonController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class SkeletonController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -104,14 +87,6 @@ public class SkeletonController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -154,6 +129,12 @@ public class SkeletonController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -167,9 +148,37 @@ public class SkeletonController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -183,12 +192,6 @@ public class SkeletonController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 SkeletonNPC extends CraftSkeleton implements NPCHolder { public static class SkeletonNPC extends CraftSkeleton implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSlime; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSlime;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -16,12 +16,13 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.citizensnpcs.util.nms.PlayerControllerMove; import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_9_R1.EntitySlime;
import net.minecraft.server.v1_8_R3.EntitySlime; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class SlimeController extends MobEntityController { public class SlimeController extends MobEntityController {
@ -52,33 +53,22 @@ public class SlimeController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
} : npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
@Override
public boolean cc() {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
} }
@Override @Override
@ -89,7 +79,7 @@ public class SlimeController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -110,13 +100,6 @@ public class SlimeController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -124,14 +107,6 @@ public class SlimeController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -174,6 +149,12 @@ public class SlimeController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -187,9 +168,37 @@ public class SlimeController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -203,12 +212,6 @@ public class SlimeController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 SlimeNPC extends CraftSlime implements NPCHolder { public static class SlimeNPC extends CraftSlime implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowman; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSnowman;
import org.bukkit.entity.Snowman; import org.bukkit.entity.Snowman;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntitySnowman;
import net.minecraft.server.v1_8_R3.EntitySnowman; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class SnowmanController extends MobEntityController { public class SnowmanController extends MobEntityController {
public SnowmanController() { public SnowmanController() {
@ -47,37 +48,26 @@ public class SnowmanController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class SnowmanController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -104,13 +87,6 @@ public class SnowmanController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -153,6 +129,12 @@ public class SnowmanController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -166,9 +148,36 @@ public class SnowmanController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -182,12 +191,6 @@ public class SnowmanController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 SnowmanNPC extends CraftSnowman implements NPCHolder { public static class SnowmanNPC extends CraftSnowman implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSpider; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSpider;
import org.bukkit.entity.Spider; import org.bukkit.entity.Spider;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntitySpider;
import net.minecraft.server.v1_8_R3.EntitySpider; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class SpiderController extends MobEntityController { public class SpiderController extends MobEntityController {
public SpiderController() { public SpiderController() {
@ -47,37 +48,26 @@ public class SpiderController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class SpiderController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -104,13 +87,6 @@ public class SpiderController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -153,6 +129,12 @@ public class SpiderController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -166,9 +148,36 @@ public class SpiderController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -183,11 +192,6 @@ public class SpiderController extends MobEntityController {
} }
} }
@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 SpiderNPC extends CraftSpider implements NPCHolder { public static class SpiderNPC extends CraftSpider implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSquid; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSquid;
import org.bukkit.entity.Squid; import org.bukkit.entity.Squid;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntitySquid;
import net.minecraft.server.v1_8_R3.EntitySquid; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class SquidController extends MobEntityController { public class SquidController extends MobEntityController {
public SquidController() { public SquidController() {
@ -47,37 +48,26 @@ public class SquidController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class SquidController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -146,6 +129,12 @@ public class SquidController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -159,9 +148,29 @@ public class SquidController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -175,12 +184,6 @@ public class SquidController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 SquidNPC extends CraftSquid implements NPCHolder { public static class SquidNPC extends CraftSquid implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftVillager; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftVillager;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,12 +15,13 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_9_R1.EntityVillager;
import net.minecraft.server.v1_8_R3.EntityVillager; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class VillagerController extends MobEntityController { public class VillagerController extends MobEntityController {
public VillagerController() { public VillagerController() {
@ -60,7 +61,7 @@ public class VillagerController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
@ -73,30 +74,19 @@ public class VillagerController extends MobEntityController {
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -110,13 +100,6 @@ public class VillagerController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -124,15 +107,6 @@ public class VillagerController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
NMS.setHeadYaw(this, yaw);
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -175,6 +149,12 @@ public class VillagerController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -192,9 +172,38 @@ public class VillagerController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null) {
NMS.setHeadYaw(this, yaw);
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -203,12 +212,6 @@ public class VillagerController extends MobEntityController {
public void setBlockTrades(boolean blocked) { public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked; this.blockTrades = blocked;
} }
@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 VillagerNPC extends CraftVillager implements NPCHolder { public static class VillagerNPC extends CraftVillager implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWitch; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWitch;
import org.bukkit.entity.Witch; import org.bukkit.entity.Witch;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityWitch;
import net.minecraft.server.v1_8_R3.EntityWitch; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class WitchController extends MobEntityController { public class WitchController extends MobEntityController {
public WitchController() { public WitchController() {
@ -47,37 +48,26 @@ public class WitchController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class WitchController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -104,13 +87,6 @@ public class WitchController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -153,6 +129,12 @@ public class WitchController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -166,9 +148,36 @@ public class WitchController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null)
npc.update();
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; return false;
} }
@ -182,12 +191,6 @@ public class WitchController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@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 WitchNPC extends CraftWitch implements NPCHolder { public static class WitchNPC extends CraftWitch implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWither;
import org.bukkit.entity.Wither; import org.bukkit.entity.Wither;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityWither; import net.minecraft.server.v1_9_R1.EntityWither;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class WitherController extends MobEntityController { public class WitherController extends MobEntityController {
public WitherController() { public WitherController() {
@ -45,30 +46,19 @@ public class WitherController extends MobEntityController {
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -81,21 +71,6 @@ public class WitherController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
protected void E() {
if (npc == null) {
super.E();
}
npc.update();
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -129,6 +104,12 @@ public class WitherController extends MobEntityController {
// cancelled. // cancelled.
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -142,14 +123,36 @@ public class WitherController extends MobEntityController {
} }
@Override @Override
public int s(int i) { public boolean isLeashed() {
return npc == null ? super.s(i) : 0; if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
} }
@Override @Override
protected String z() { protected void L() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() if (npc == null) {
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); super.L();
}
}
@Override
public int m(int i) {
return npc == null ? super.m(i) : 0;
}
@Override
protected void M() {
if (npc == null) {
super.M();
}
npc.update();
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWolf; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWolf;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityWolf;
import net.minecraft.server.v1_8_R3.EntityWolf; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class WolfController extends MobEntityController { public class WolfController extends MobEntityController {
public WolfController() { public WolfController() {
@ -58,37 +59,26 @@ public class WolfController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -102,13 +92,6 @@ public class WolfController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -116,14 +99,6 @@ public class WolfController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -166,6 +141,12 @@ public class WolfController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -179,19 +160,42 @@ public class WolfController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null)
return super.isLeashed();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
}
}
@Override
public void M() {
super.M();
if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
return super.k_(); return super.n_();
} else { } else {
return false; 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 WolfNPC extends CraftWolf implements NPCHolder { public static class WolfNPC extends CraftWolf implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity; package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftZombie; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftZombie;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.EntityZombie;
import net.minecraft.server.v1_8_R3.EntityZombie; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.SoundEffect;
import net.minecraft.server.v1_9_R1.World;
public class ZombieController extends MobEntityController { public class ZombieController extends MobEntityController {
public ZombieController() { public ZombieController() {
@ -47,37 +48,26 @@ public class ZombieController extends MobEntityController {
} }
@Override @Override
protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
super.a(d0, flag, block, blockposition); super.a(d0, flag, block, blockposition);
} }
} }
@Override @Override
protected String bo() { protected SoundEffect bR() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo()); return (SoundEffect) (npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bR()
: npc.data().get(NPC.HURT_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
protected String bp() { protected SoundEffect bS() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp()); return (SoundEffect) (npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bS()
: npc.data().get(NPC.DEATH_SOUND_METADATA, SoundEffect.a.b(super.bR()).toString()));
} }
@Override @Override
public boolean cc() { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
if (npc == null)
return super.cc();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.cc();
if (super.cc()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,13 +80,6 @@ public class ZombieController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override @Override
public void e(float f, float f1) { public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -104,14 +87,6 @@ public class ZombieController extends MobEntityController {
} }
} }
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) if (npc == null)
@ -154,6 +129,12 @@ public class ZombieController extends MobEntityController {
} }
} }
@Override
protected SoundEffect G() {
return (SoundEffect) (npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.G()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, SoundEffect.a.b(super.G()).toString()));
}
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) if (bukkitEntity == null && npc != null)
@ -167,18 +148,40 @@ public class ZombieController extends MobEntityController {
} }
@Override @Override
public boolean k_() { public boolean isLeashed() {
if (npc == null || !npc.isFlyable()) { if (npc == null)
return super.k_(); return super.isLeashed();
} else { boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return false; if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
return super.isLeashed();
if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update
}
return false; // shouldLeash
}
@Override
protected void L() {
if (npc == null) {
super.L();
} }
} }
@Override @Override
protected String z() { public void M() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() super.M();
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z()); if (npc != null) {
npc.update();
}
}
@Override
public boolean n_() {
if (npc == null || !npc.isFlyable()) {
return super.n_();
} else {
return false;
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArmorStand; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftArmorStand;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
@ -16,11 +16,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityArmorStand; import net.minecraft.server.v1_9_R1.EntityArmorStand;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.EnumHand;
import net.minecraft.server.v1_8_R3.Vec3D; import net.minecraft.server.v1_9_R1.EnumInteractionResult;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.ItemStack;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.Vec3D;
import net.minecraft.server.v1_9_R1.World;
public class ArmorStandController extends MobEntityController { public class ArmorStandController extends MobEntityController {
public ArmorStandController() { public ArmorStandController() {
@ -59,18 +62,18 @@ public class ArmorStandController extends MobEntityController {
} }
@Override @Override
public boolean a(EntityHuman entityhuman, Vec3D vec3d) { public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
if (npc == null) { if (npc == null) {
return super.a(entityhuman, vec3d); return super.a(entityhuman, vec3d, itemstack, enumhand);
} }
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(), PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
getBukkitEntity()); getBukkitEntity());
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
return !event.isCancelled(); return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -119,6 +122,14 @@ public class ArmorStandController extends MobEntityController {
return npc; return npc;
} }
@Override
public void m() {
super.m();
if (npc != null) {
npc.update();
}
}
@Override @Override
public void setSize(float f, float f1) { public void setSize(float f, float f1) {
if (npc == null) { if (npc == null) {
@ -127,13 +138,5 @@ public class ArmorStandController extends MobEntityController {
NMS.setSize(this, f, f1, justCreated); NMS.setSize(this, f, f1, justCreated);
} }
} }
@Override
public void t_() {
super.t_();
if (npc != null) {
npc.update();
}
}
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftBoat; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftBoat;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Boat; import org.bukkit.entity.Boat;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,9 +14,9 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityBoat; import net.minecraft.server.v1_9_R1.EntityBoat;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class BoatController extends MobEntityController { public class BoatController extends MobEntityController {
public BoatController() { public BoatController() {
@ -55,7 +55,7 @@ public class BoatController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -114,11 +114,11 @@ public class BoatController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,17 +6,17 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEgg; import net.minecraft.server.v1_9_R1.EntityEgg;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_9_R1.WorldServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEgg; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEgg;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -75,7 +75,7 @@ public class EggController extends AbstractEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -120,14 +120,14 @@ public class EggController extends AbstractEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_(); super.m();
} }
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderCrystal; import net.minecraft.server.v1_9_R1.EntityEnderCrystal;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderCrystal; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderCrystal;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.EnderCrystal;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -59,7 +59,7 @@ public class EnderCrystalController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -104,11 +104,11 @@ public class EnderCrystalController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderPearl; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderPearl;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderPearl; import org.bukkit.entity.EnderPearl;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -13,9 +13,9 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderPearl; import net.minecraft.server.v1_9_R1.EntityEnderPearl;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class EnderPearlController extends MobEntityController { public class EnderPearlController extends MobEntityController {
public EnderPearlController() { public EnderPearlController() {
@ -54,7 +54,7 @@ public class EnderPearlController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -104,14 +104,14 @@ public class EnderPearlController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_(); super.m();
} }
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderSignal; import net.minecraft.server.v1_9_R1.EntityEnderSignal;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderSignal; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderSignal;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderSignal; import org.bukkit.entity.EnderSignal;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -59,7 +59,7 @@ public class EnderSignalController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -104,11 +104,11 @@ public class EnderSignalController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityExperienceOrb; import net.minecraft.server.v1_9_R1.EntityExperienceOrb;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftExperienceOrb; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftExperienceOrb;
import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.ExperienceOrb;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -40,7 +40,7 @@ public class ExperienceOrbController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class ExperienceOrbController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -3,11 +3,11 @@ package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftFallingSand;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.craftbukkit.v1_9_R1.util.CraftMagicNumbers;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -19,13 +19,13 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.Block;
import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_9_R1.Blocks;
import net.minecraft.server.v1_8_R3.EntityFallingBlock; import net.minecraft.server.v1_9_R1.EntityFallingBlock;
import net.minecraft.server.v1_8_R3.IBlockData; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_9_R1.WorldServer;
public class FallingBlockController extends AbstractEntityController { public class FallingBlockController extends AbstractEntityController {
public FallingBlockController() { public FallingBlockController() {
@ -69,7 +69,7 @@ public class FallingBlockController extends AbstractEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -128,7 +128,7 @@ public class FallingBlockController extends AbstractEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
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) {
@ -138,7 +138,7 @@ public class FallingBlockController extends AbstractEntityController {
move(motX, motY, motZ); move(motX, motY, motZ);
} }
} else { } else {
super.t_(); super.m();
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityFireworks; import net.minecraft.server.v1_9_R1.EntityFireworks;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFirework; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftFirework;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class FireworkController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class FireworkController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityFishingHook; import net.minecraft.server.v1_9_R1.EntityFishingHook;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFish; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftFish;
import org.bukkit.entity.Fish; import org.bukkit.entity.Fish;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -40,7 +40,7 @@ public class FishingHookController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class FishingHookController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,21 +6,21 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityItem; import net.minecraft.server.v1_9_R1.EntityItem;
import net.minecraft.server.v1_8_R3.ItemStack; import net.minecraft.server.v1_9_R1.ItemStack;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_9_R1.WorldServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftItem;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -62,7 +62,7 @@ public class ItemController extends AbstractEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -119,11 +119,11 @@ public class ItemController extends AbstractEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -3,9 +3,9 @@ package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItemFrame; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftItemFrame;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -16,11 +16,11 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityItemFrame; import net.minecraft.server.v1_9_R1.EntityItemFrame;
import net.minecraft.server.v1_8_R3.EnumDirection; import net.minecraft.server.v1_9_R1.EnumDirection;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class ItemFrameController extends MobEntityController { public class ItemFrameController extends MobEntityController {
public ItemFrameController() { public ItemFrameController() {
@ -54,7 +54,7 @@ public class ItemFrameController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -109,11 +109,11 @@ public class ItemFrameController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftLargeFireball;
import org.bukkit.entity.LargeFireball; import org.bukkit.entity.LargeFireball;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,9 +14,9 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityLargeFireball; import net.minecraft.server.v1_9_R1.EntityLargeFireball;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class LargeFireballController extends MobEntityController { public class LargeFireballController extends MobEntityController {
public LargeFireballController() { public LargeFireballController() {
@ -41,7 +41,7 @@ public class LargeFireballController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -100,14 +100,14 @@ public class LargeFireballController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_(); super.m();
} }
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityLeash; import net.minecraft.server.v1_9_R1.EntityLeash;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLeash; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftLeash;
import org.bukkit.entity.LeashHitch; import org.bukkit.entity.LeashHitch;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -40,7 +40,7 @@ public class LeashController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class LeashController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartChest; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMinecartChest;
import org.bukkit.entity.Minecart; import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,10 +14,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartChest; import net.minecraft.server.v1_9_R1.EntityMinecartChest;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class MinecartChestController extends MobEntityController { public class MinecartChestController extends MobEntityController {
public MinecartChestController() { public MinecartChestController() {
@ -42,7 +42,7 @@ public class MinecartChestController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -99,12 +99,12 @@ public class MinecartChestController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
NMS.minecartItemLogic(this); NMS.minecartItemLogic(this);
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartCommand; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMinecartCommand;
import org.bukkit.entity.Minecart; import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,10 +14,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartCommandBlock; import net.minecraft.server.v1_9_R1.EntityMinecartCommandBlock;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class MinecartCommandController extends MobEntityController { public class MinecartCommandController extends MobEntityController {
public MinecartCommandController() { public MinecartCommandController() {
@ -42,7 +42,7 @@ public class MinecartCommandController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -99,12 +99,12 @@ public class MinecartCommandController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
NMS.minecartItemLogic(this); NMS.minecartItemLogic(this);
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartFurnace; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMinecartFurnace;
import org.bukkit.entity.Minecart; import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,10 +14,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartFurnace; import net.minecraft.server.v1_9_R1.EntityMinecartFurnace;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class MinecartFurnaceController extends MobEntityController { public class MinecartFurnaceController extends MobEntityController {
public MinecartFurnaceController() { public MinecartFurnaceController() {
@ -42,7 +42,7 @@ public class MinecartFurnaceController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -99,12 +99,12 @@ public class MinecartFurnaceController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
NMS.minecartItemLogic(this); NMS.minecartItemLogic(this);
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -10,10 +10,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartHopper; import net.minecraft.server.v1_9_R1.EntityMinecartHopper;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class MinecartHopperController extends MobEntityController { public class MinecartHopperController extends MobEntityController {
public MinecartHopperController() { public MinecartHopperController() {
@ -38,7 +38,7 @@ public class MinecartHopperController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -87,12 +87,12 @@ public class MinecartHopperController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
NMS.minecartItemLogic(this); NMS.minecartItemLogic(this);
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartRideable; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMinecartRideable;
import org.bukkit.entity.Minecart; import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,10 +14,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartRideable; import net.minecraft.server.v1_9_R1.EntityMinecartRideable;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class MinecartRideableController extends MobEntityController { public class MinecartRideableController extends MobEntityController {
public MinecartRideableController() { public MinecartRideableController() {
@ -42,7 +42,7 @@ public class MinecartRideableController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -99,12 +99,12 @@ public class MinecartRideableController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
NMS.minecartItemLogic(this); NMS.minecartItemLogic(this);
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -10,10 +10,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartMobSpawner; import net.minecraft.server.v1_9_R1.EntityMinecartMobSpawner;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class MinecartSpawnerController extends MobEntityController { public class MinecartSpawnerController extends MobEntityController {
public MinecartSpawnerController() { public MinecartSpawnerController() {
@ -38,7 +38,7 @@ public class MinecartSpawnerController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -87,12 +87,12 @@ public class MinecartSpawnerController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
NMS.minecartItemLogic(this); NMS.minecartItemLogic(this);
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -10,10 +10,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartTNT; import net.minecraft.server.v1_9_R1.EntityMinecartTNT;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class MinecartTNTController extends MobEntityController { public class MinecartTNTController extends MobEntityController {
public MinecartTNTController() { public MinecartTNTController() {
@ -38,7 +38,7 @@ public class MinecartTNTController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -87,12 +87,12 @@ public class MinecartTNTController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
NMS.minecartItemLogic(this); NMS.minecartItemLogic(this);
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityPainting; import net.minecraft.server.v1_9_R1.EntityPainting;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPainting; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPainting;
import org.bukkit.entity.Painting; import org.bukkit.entity.Painting;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class PaintingController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class PaintingController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSmallFireball; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSmallFireball;
import org.bukkit.entity.SmallFireball; import org.bukkit.entity.SmallFireball;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -13,9 +13,9 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntitySmallFireball; import net.minecraft.server.v1_9_R1.EntitySmallFireball;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class SmallFireballController extends MobEntityController { public class SmallFireballController extends MobEntityController {
public SmallFireballController() { public SmallFireballController() {
@ -40,7 +40,7 @@ public class SmallFireballController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,14 +90,14 @@ public class SmallFireballController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_(); super.m();
} }
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntitySnowball; import net.minecraft.server.v1_9_R1.EntitySnowball;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowball; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSnowball;
import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowball;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -59,7 +59,7 @@ public class SnowballController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -104,11 +104,11 @@ public class SnowballController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityTNTPrimed; import net.minecraft.server.v1_9_R1.EntityTNTPrimed;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftTNTPrimed; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftTNTPrimed;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class TNTPrimedController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class TNTPrimedController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftThrownExpBottle; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftThrownExpBottle;
import org.bukkit.entity.ThrownExpBottle; import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -13,9 +13,9 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityThrownExpBottle; import net.minecraft.server.v1_9_R1.EntityThrownExpBottle;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class ThrownExpBottleController extends MobEntityController { public class ThrownExpBottleController extends MobEntityController {
public ThrownExpBottleController() { public ThrownExpBottleController() {
@ -40,7 +40,7 @@ public class ThrownExpBottleController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,14 +90,14 @@ public class ThrownExpBottleController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_(); super.m();
} }
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityPotion; import net.minecraft.server.v1_9_R1.EntityPotion;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftThrownPotion; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftThrownPotion;
import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.ThrownPotion;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class ThrownPotionController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class ThrownPotionController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,25 +1,25 @@
package net.citizensnpcs.npc.entity.nonliving; package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Arrow;
import org.bukkit.util.Vector;
import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.NPCPushEvent;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityArrow; import net.minecraft.server.v1_9_R1.EntityTippedArrow;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; public class TippedArrowController extends MobEntityController {
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; public TippedArrowController() {
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; super(EntityTippedArrowNPC.class);
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.Arrow;
import org.bukkit.util.Vector;
public class ArrowController extends MobEntityController {
public ArrowController() {
super(EntityArrowNPC.class);
} }
@Override @Override
@ -27,10 +27,10 @@ public class ArrowController extends MobEntityController {
return (Arrow) super.getBukkitEntity(); return (Arrow) super.getBukkitEntity();
} }
public static class ArrowNPC extends CraftArrow implements NPCHolder { public static class TippedArrowNPC extends CraftArrow implements NPCHolder {
private final CitizensNPC npc; private final CitizensNPC npc;
public ArrowNPC(EntityArrowNPC entity) { public TippedArrowNPC(EntityTippedArrowNPC entity) {
super((CraftServer) Bukkit.getServer(), entity); super((CraftServer) Bukkit.getServer(), entity);
this.npc = entity.npc; this.npc = entity.npc;
} }
@ -41,25 +41,20 @@ public class ArrowController extends MobEntityController {
} }
} }
public static class EntityArrowNPC extends EntityArrow implements NPCHolder { public static class EntityTippedArrowNPC extends EntityTippedArrow implements NPCHolder {
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityArrowNPC(World world) { public EntityTippedArrowNPC(World world) {
this(world, null); this(world, null);
} }
@Override public EntityTippedArrowNPC(World world, NPC npc) {
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
}
public EntityArrowNPC(World world, NPC npc) {
super(world); super(world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -68,6 +63,11 @@ public class ArrowController extends MobEntityController {
} }
} }
@Override
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
}
@Override @Override
public void g(double x, double y, double z) { public void g(double x, double y, double z) {
if (npc == null) { if (npc == null) {
@ -93,7 +93,7 @@ public class ArrowController extends MobEntityController {
@Override @Override
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) { if (bukkitEntity == null && npc != null) {
bukkitEntity = new ArrowNPC(this); bukkitEntity = new TippedArrowNPC(this);
} }
return super.getBukkitEntity(); return super.getBukkitEntity();
} }
@ -104,11 +104,11 @@ public class ArrowController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -6,14 +6,14 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityWitherSkull; import net.minecraft.server.v1_9_R1.EntityWitherSkull;
import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWitherSkull; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWitherSkull;
import org.bukkit.entity.WitherSkull; import org.bukkit.entity.WitherSkull;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class WitherSkullController extends MobEntityController {
} }
@Override @Override
public void collide(net.minecraft.server.v1_8_R3.Entity entity) { public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling // this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving. // it will not stop the NPC from moving.
super.collide(entity); super.collide(entity);
@ -90,11 +90,11 @@ public class WitherSkullController extends MobEntityController {
} }
@Override @Override
public void t_() { public void m() {
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else { } else {
super.t_(); super.m();
} }
} }
} }

View File

@ -1,10 +1,10 @@
package net.citizensnpcs.npc.network; package net.citizensnpcs.npc.network;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_8_R3.NetworkManager; import net.minecraft.server.v1_9_R1.NetworkManager;
import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_9_R1.Packet;
import net.minecraft.server.v1_8_R3.PlayerConnection; import net.minecraft.server.v1_9_R1.PlayerConnection;
public class EmptyNetHandler extends PlayerConnection { public class EmptyNetHandler extends PlayerConnection {
public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer) { public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer) {

View File

@ -3,8 +3,8 @@ package net.citizensnpcs.npc.network;
import java.io.IOException; import java.io.IOException;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.EnumProtocolDirection; import net.minecraft.server.v1_9_R1.EnumProtocolDirection;
import net.minecraft.server.v1_8_R3.NetworkManager; import net.minecraft.server.v1_9_R1.NetworkManager;
public class EmptyNetworkManager extends NetworkManager { public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException { public EmptyNetworkManager(EnumProtocolDirection flag) throws IOException {

View File

@ -3,7 +3,7 @@ package net.citizensnpcs.trait;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.Map; import java.util.Map;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -27,9 +27,9 @@ import net.citizensnpcs.api.trait.trait.Owner;
import net.citizensnpcs.api.util.DataKey; import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderDragon; import net.minecraft.server.v1_9_R1.EntityEnderDragon;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.EntityPlayer;
//TODO: reduce reliance on CitizensNPC //TODO: reduce reliance on CitizensNPC
@TraitName("controllable") @TraitName("controllable")
@ -69,8 +69,8 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
private void enterOrLeaveVehicle(Player player) { private void enterOrLeaveVehicle(Player player) {
EntityPlayer handle = ((CraftPlayer) player).getHandle(); EntityPlayer handle = ((CraftPlayer) player).getHandle();
if (getHandle().passenger != null) { if (getHandle().isVehicle()) {
if (getHandle().passenger == handle) { if (getHandle().passengers.contains(handle)) {
player.leaveVehicle(); player.leaveVehicle();
} }
return; return;
@ -78,10 +78,10 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
if (ownerRequired && !npc.getTrait(Owner.class).isOwnedBy(handle.getBukkitEntity())) { if (ownerRequired && !npc.getTrait(Owner.class).isOwnedBy(handle.getBukkitEntity())) {
return; return;
} }
handle.mount(getHandle()); NMS.mount(player, npc.getEntity());
} }
private net.minecraft.server.v1_8_R3.Entity getHandle() { private net.minecraft.server.v1_9_R1.Entity getHandle() {
return NMS.getHandle(npc.getEntity()); return NMS.getHandle(npc.getEntity());
} }
@ -138,7 +138,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
return; return;
EntityPlayer handle = ((CraftPlayer) event.getPlayer()).getHandle(); EntityPlayer handle = ((CraftPlayer) event.getPlayer()).getHandle();
Action performed = event.getAction(); Action performed = event.getAction();
if (!handle.equals(getHandle().passenger)) if (!getHandle().passengers.contains(getHandle()))
return; return;
switch (performed) { switch (performed) {
case RIGHT_CLICK_BLOCK: case RIGHT_CLICK_BLOCK:
@ -168,10 +168,10 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
@Override @Override
public void run() { public void run() {
if (!enabled || !npc.isSpawned() || getHandle().passenger == null if (!enabled || !npc.isSpawned() || !getHandle().isVehicle()
|| !(getHandle().passenger.getBukkitEntity() instanceof Player)) || !(getHandle().passengers.get(0).getBukkitEntity() instanceof Player))
return; return;
controller.run((Player) getHandle().passenger.getBukkitEntity()); controller.run((Player) getHandle().passengers.get(0).getBukkitEntity());
} }
@Override @Override
@ -188,7 +188,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
return enabled; return enabled;
} }
private void setMountedYaw(net.minecraft.server.v1_8_R3.Entity handle) { private void setMountedYaw(net.minecraft.server.v1_9_R1.Entity handle) {
if (handle instanceof EntityEnderDragon || !Setting.USE_BOAT_CONTROLS.asBoolean()) if (handle instanceof EntityEnderDragon || !Setting.USE_BOAT_CONTROLS.asBoolean())
return; // EnderDragon handles this separately return; // EnderDragon handles this separately
double tX = handle.locX + handle.motX; double tX = handle.locX + handle.motX;
@ -208,18 +208,18 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
@Override @Override
public boolean toggle() { public boolean toggle() {
enabled = !enabled; enabled = !enabled;
if (!enabled && getHandle().passenger != null) { if (!enabled && getHandle().isVehicle()) {
getHandle().passenger.getBukkitEntity().leaveVehicle(); getHandle().passengers.get(0).getBukkitEntity().leaveVehicle();
} }
return enabled; return enabled;
} }
private double updateHorizontalSpeed(net.minecraft.server.v1_8_R3.Entity handle, private double updateHorizontalSpeed(net.minecraft.server.v1_9_R1.Entity handle,
net.minecraft.server.v1_8_R3.Entity passenger, double speed, float speedMod) { net.minecraft.server.v1_9_R1.Entity passenger, double speed, float speedMod) {
double oldSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ); double oldSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
double angle = Math.toRadians(passenger.yaw - ((EntityLiving) passenger).aZ * 45.0F); double angle = Math.toRadians(passenger.yaw - ((EntityLiving) passenger).bd * 45.0F);
handle.motX += speedMod * -Math.sin(angle) * ((EntityLiving) passenger).ba * 0.05; handle.motX += speedMod * -Math.sin(angle) * ((EntityLiving) passenger).be * 0.05;
handle.motZ += speedMod * Math.cos(angle) * ((EntityLiving) passenger).ba * 0.05; handle.motZ += speedMod * Math.cos(angle) * ((EntityLiving) passenger).be * 0.05;
double newSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ); double newSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
if (newSpeed > oldSpeed && speed < 0.35D) { if (newSpeed > oldSpeed && speed < 0.35D) {
@ -248,8 +248,8 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
@Override @Override
public void run(Player rider) { public void run(Player rider) {
net.minecraft.server.v1_8_R3.Entity handle = getHandle(); net.minecraft.server.v1_9_R1.Entity handle = getHandle();
net.minecraft.server.v1_8_R3.Entity passenger = ((CraftPlayer) rider).getHandle(); net.minecraft.server.v1_9_R1.Entity passenger = ((CraftPlayer) rider).getHandle();
boolean onGround = handle.onGround; boolean onGround = handle.onGround;
float speedMod = npc.getNavigator().getDefaultParameters() float speedMod = npc.getNavigator().getDefaultParameters()
.modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED)); .modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED));
@ -300,7 +300,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
} }
Vector dir = rider.getEyeLocation().getDirection(); Vector dir = rider.getEyeLocation().getDirection();
dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier()); dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier());
net.minecraft.server.v1_8_R3.Entity handle = getHandle(); net.minecraft.server.v1_9_R1.Entity handle = getHandle();
handle.motX = dir.getX(); handle.motX = dir.getX();
handle.motY = dir.getY(); handle.motY = dir.getY();
handle.motZ = dir.getZ(); handle.motZ = dir.getZ();
@ -343,8 +343,8 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
getHandle().motY = 0.001; getHandle().motY = 0.001;
return; return;
} }
net.minecraft.server.v1_8_R3.Entity handle = getHandle(); net.minecraft.server.v1_9_R1.Entity handle = getHandle();
net.minecraft.server.v1_8_R3.Entity passenger = ((CraftPlayer) rider).getHandle(); net.minecraft.server.v1_9_R1.Entity passenger = ((CraftPlayer) rider).getHandle();
speed = updateHorizontalSpeed(handle, passenger, speed, 1F); speed = updateHorizontalSpeed(handle, passenger, speed, 1F);
boolean shouldJump = NMS.shouldJump(passenger); boolean shouldJump = NMS.shouldJump(passenger);

View File

@ -1,6 +1,6 @@
package net.citizensnpcs.trait; package net.citizensnpcs.trait;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftRabbit; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftRabbit;
import org.bukkit.entity.Rabbit; import org.bukkit.entity.Rabbit;
import net.citizensnpcs.api.persistence.Persist; import net.citizensnpcs.api.persistence.Persist;

View File

@ -1,12 +1,12 @@
package net.citizensnpcs.trait; package net.citizensnpcs.trait;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWither;
import org.bukkit.entity.Wither; import org.bukkit.entity.Wither;
import net.citizensnpcs.api.persistence.Persist; import net.citizensnpcs.api.persistence.Persist;
import net.citizensnpcs.api.trait.Trait; import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.TraitName; import net.citizensnpcs.api.trait.TraitName;
import net.minecraft.server.v1_8_R3.EntityWither; import net.minecraft.server.v1_9_R1.EntityWither;
@TraitName("withertrait") @TraitName("withertrait")
public class WitherTrait extends Trait { public class WitherTrait extends Trait {
@ -30,7 +30,7 @@ public class WitherTrait extends Trait {
if (npc.getEntity() instanceof Wither) { if (npc.getEntity() instanceof Wither) {
Wither wither = (Wither) npc.getEntity(); Wither wither = (Wither) npc.getEntity();
EntityWither handle = ((CraftWither) wither).getHandle(); EntityWither handle = ((CraftWither) wither).getHandle();
handle.r(charged ? 20 : 0); handle.l(charged ? 20 : 0);
} }
} }

View File

@ -1,8 +1,8 @@
package net.citizensnpcs.trait.waypoint; package net.citizensnpcs.trait.waypoint;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EntityEnderSignal; import net.minecraft.server.v1_9_R1.EntityEnderSignal;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.World;
public class EntityEnderSignalMarker extends EntityEnderSignal { public class EntityEnderSignalMarker extends EntityEnderSignal {
public EntityEnderSignalMarker(World world) { public EntityEnderSignalMarker(World world) {
@ -19,10 +19,10 @@ public class EntityEnderSignalMarker extends EntityEnderSignal {
} }
@Override @Override
public void h() { public void i() {
} }
@Override @Override
public void t_() { public void m() {
} }
} }

View File

@ -20,11 +20,11 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftSound; import org.bukkit.craftbukkit.v1_9_R1.CraftSound;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -52,33 +52,37 @@ import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.citizensnpcs.npc.network.EmptyChannel; import net.citizensnpcs.npc.network.EmptyChannel;
import net.citizensnpcs.npc.skin.SkinnableEntity; import net.citizensnpcs.npc.skin.SkinnableEntity;
import net.citizensnpcs.util.nms.PlayerlistTrackerEntry; import net.citizensnpcs.util.nms.PlayerlistTrackerEntry;
import net.minecraft.server.v1_8_R3.AttributeInstance; import net.minecraft.server.v1_9_R1.AttributeInstance;
import net.minecraft.server.v1_8_R3.AxisAlignedBB; import net.minecraft.server.v1_9_R1.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.Block;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.ControllerJump; import net.minecraft.server.v1_9_R1.ControllerJump;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_8_R3.EnchantmentManager; import net.minecraft.server.v1_9_R1.DataWatcherObject;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_9_R1.EnchantmentManager;
import net.minecraft.server.v1_8_R3.EntityHorse; import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_9_R1.EntityHorse;
import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityMinecartAbstract; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.EntityMinecartAbstract;
import net.minecraft.server.v1_8_R3.EntityTameableAnimal; import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTracker; import net.minecraft.server.v1_9_R1.EntityRabbit;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry; import net.minecraft.server.v1_9_R1.EntityTameableAnimal;
import net.minecraft.server.v1_8_R3.EntityTypes; import net.minecraft.server.v1_9_R1.EntityTracker;
import net.minecraft.server.v1_8_R3.GenericAttributes; import net.minecraft.server.v1_9_R1.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_9_R1.EntityTypes;
import net.minecraft.server.v1_8_R3.NavigationAbstract; import net.minecraft.server.v1_9_R1.GenericAttributes;
import net.minecraft.server.v1_8_R3.NetworkManager; import net.minecraft.server.v1_9_R1.MathHelper;
import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_9_R1.MobEffects;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_9_R1.NavigationAbstract;
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector; import net.minecraft.server.v1_9_R1.NetworkManager;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.Packet;
import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_9_R1.PathfinderGoalSelector;
import net.minecraft.server.v1_9_R1.Vec3D;
import net.minecraft.server.v1_9_R1.World;
import net.minecraft.server.v1_9_R1.WorldServer;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class NMS { public class NMS {
@ -116,7 +120,7 @@ public class NMS {
int i = 0; int i = 0;
if (target instanceof EntityLiving) { if (target instanceof EntityLiving) {
f += EnchantmentManager.a(handle.bA(), ((EntityLiving) target).getMonsterType()); f += EnchantmentManager.a(handle.getItemInMainHand(), ((EntityLiving) target).getMonsterType());
i += EnchantmentManager.a(handle); i += EnchantmentManager.a(handle);
} }
@ -175,7 +179,7 @@ public class NMS {
if (Bukkit.isPrimaryThread()) if (Bukkit.isPrimaryThread())
throw new IllegalStateException("NMS.fillProfileProperties cannot be invoked from the main thread."); throw new IllegalStateException("NMS.fillProfileProperties cannot be invoked from the main thread.");
MinecraftSessionService sessionService = ((CraftServer) Bukkit.getServer()).getServer().aD(); MinecraftSessionService sessionService = ((CraftServer) Bukkit.getServer()).getServer().ay();
YggdrasilAuthenticationService auth = ((YggdrasilMinecraftSessionService) sessionService) YggdrasilAuthenticationService auth = ((YggdrasilMinecraftSessionService) sessionService)
.getAuthenticationService(); .getAuthenticationService();
@ -198,12 +202,12 @@ public class NMS {
} }
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) { public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
if (entity.bM()) { if (entity.co() || entity.bx()) {
if (entity.V()) { if (entity.isInWater()) {
double d0 = entity.locY; double d0 = entity.locY;
float f3 = 0.8F; float f3 = 0.8F;
float f4 = 0.02F; float f4 = 0.02F;
float f2 = EnchantmentManager.b(entity); float f2 = EnchantmentManager.d(entity);
if (f2 > 3.0F) { if (f2 > 3.0F) {
f2 = 3.0F; f2 = 3.0F;
} }
@ -214,7 +218,7 @@ public class NMS {
if (f2 > 0.0F) { if (f2 > 0.0F) {
f3 += (0.5460001F - f3) * f2 / 3.0F; f3 += (0.5460001F - f3) * f2 / 3.0F;
f4 += (entity.bI() * 1.0F - f4) * f2 / 3.0F; f4 += (entity.ck() * 1.0F - f4) * f2 / 3.0F;
} }
entity.a(f, f1, f4); entity.a(f, f1, f4);
@ -226,7 +230,7 @@ public class NMS {
if ((entity.positionChanged) if ((entity.positionChanged)
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d0, entity.motZ))) && (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d0, entity.motZ)))
entity.motY = 0.300000011920929D; entity.motY = 0.300000011920929D;
} else if (entity.ab()) { } else if (entity.an()) {
double d0 = entity.locY; double d0 = entity.locY;
entity.a(f, f1, 0.02F); entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ); entity.move(entity.motX, entity.motY, entity.motZ);
@ -237,74 +241,113 @@ public class NMS {
if ((entity.positionChanged) if ((entity.positionChanged)
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d0, entity.motZ))) && (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d0, entity.motZ)))
entity.motY = 0.300000011920929D; entity.motY = 0.300000011920929D;
} else if (entity.cB()) {
if (entity.motY > -0.5D) {
entity.fallDistance = 1.0F;
}
Vec3D vec3d = entity.aB();
float f5 = entity.pitch * 0.017453292F;
double d0 = Math.sqrt(vec3d.x * vec3d.x + vec3d.z * vec3d.z);
double d2 = Math.sqrt(entity.motX * entity.motX + entity.motZ * entity.motZ);
double d3 = vec3d.b();
float f6 = MathHelper.cos(f5);
f6 = (float) (f6 * f6 * Math.min(1.0D, d3 / 0.4D));
entity.motY += -0.08D + f6 * 0.06D;
if ((entity.motY < 0.0D) && (d0 > 0.0D)) {
double d4 = entity.motY * -0.1D * f6;
entity.motY += d4;
entity.motX += vec3d.x * d4 / d0;
entity.motZ += vec3d.z * d4 / d0;
}
if (f5 < 0.0F) {
double d4 = d2 * -MathHelper.sin(f5) * 0.04D;
entity.motY += d4 * 3.2D;
entity.motX -= vec3d.x * d4 / d0;
entity.motZ -= vec3d.z * d4 / d0;
}
if (d0 > 0.0D) {
entity.motX += (vec3d.x / d0 * d2 - entity.motX) * 0.1D;
entity.motZ += (vec3d.z / d0 * d2 - entity.motZ) * 0.1D;
}
entity.motX *= 0.9900000095367432D;
entity.motY *= 0.9800000190734863D;
entity.motZ *= 0.9900000095367432D;
entity.move(entity.motX, entity.motY, entity.motZ);
if ((entity.positionChanged) && (!entity.world.isClientSide)) {
double d4 = Math.sqrt(entity.motX * entity.motX + entity.motZ * entity.motZ);
double d5 = d2 - d4;
float f7 = (float) (d5 * 10.0D - 3.0D);
if (f7 > 0.0F) {
entity.a(entity.e((int) f7), 1.0F, 1.0F);
entity.damageEntity(DamageSource.j, f7);
}
}
if ((entity.onGround) && (!entity.world.isClientSide)) {
entity.setFlag(7, false);
}
} else { } else {
float f5 = 0.91F; float f8 = 0.91F;
BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition
.c(entity.locX, entity.getBoundingBox().b - 1.0D, entity.locZ);
if (entity.onGround) { if (entity.onGround) {
f5 = entity.world f8 = entity.world.getType(blockposition_pooledblockposition).getBlock().frictionFactor * 0.91F;
.getType(new BlockPosition(MathHelper.floor(entity.locX),
MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ)))
.getBlock().frictionFactor * 0.91F;
} }
float f4 = 0.16277136F / (f8 * f8 * f8);
float f6 = 0.1627714F / (f5 * f5 * f5);
float f3; float f3;
if (entity.onGround)
f3 = entity.bI() * f6;
else {
f3 = entity.aM;
}
entity.a(f, f1, f3);
f5 = 0.91F;
if (entity.onGround) { if (entity.onGround) {
f5 = entity.world f3 = entity.ck() * f4;
.getType(new BlockPosition(MathHelper.floor(entity.locX), } else {
MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ))) f3 = entity.aQ;
.getBlock().frictionFactor * 0.91F;
} }
entity.a(f, f1, f3);
if (entity.k_()) { f8 = 0.91F;
float f4 = 0.15F; if (entity.onGround) {
entity.motX = MathHelper.a(entity.motX, -f4, f4); f8 = entity.world.getType(blockposition_pooledblockposition.d(entity.locX,
entity.motZ = MathHelper.a(entity.motZ, -f4, f4); entity.getBoundingBox().b - 1.0D, entity.locZ)).getBlock().frictionFactor * 0.91F;
}
if (entity.n_()) {
float f2 = 0.15F;
entity.motX = MathHelper.a(entity.motX, -f2, f2);
entity.motZ = MathHelper.a(entity.motZ, -f2, f2);
entity.fallDistance = 0.0F; entity.fallDistance = 0.0F;
if (entity.motY < -0.15D) { if (entity.motY < -0.15D) {
entity.motY = -0.15D; entity.motY = -0.15D;
} }
boolean flag = (entity.isSneaking()) && ((entity instanceof EntityHuman)); boolean flag = (entity.isSneaking()) && ((entity instanceof EntityHuman));
if ((flag) && (entity.motY < 0.0D)) { if ((flag) && (entity.motY < 0.0D)) {
entity.motY = 0.0D; entity.motY = 0.0D;
} }
} }
entity.move(entity.motX, entity.motY, entity.motZ); entity.move(entity.motX, entity.motY, entity.motZ);
if ((entity.positionChanged) && (entity.k_())) { if ((entity.positionChanged) && (entity.n_())) {
entity.motY = 0.2D; entity.motY = 0.2D;
} }
if (entity.hasEffect(MobEffects.LEVITATION)) {
if ((entity.world.isClientSide) && ((!entity.world entity.motY += (0.05D * (entity.getEffect(MobEffects.LEVITATION).getAmplifier() + 1) - entity.motY)
.isLoaded(new BlockPosition((int) entity.locX, 0, (int) entity.locZ))) * 0.2D;
|| (!entity.world
.getChunkAtWorldCoords(new BlockPosition((int) entity.locX, 0, (int) entity.locZ))
.o()))) {
if (entity.locY > 0.0D)
entity.motY = -0.1D;
else
entity.motY = 0.0D;
} else { } else {
entity.motY -= 0.08D; blockposition_pooledblockposition.d(entity.locX, 0.0D, entity.locZ);
if ((entity.world.isClientSide) && ((!entity.world.isLoaded(blockposition_pooledblockposition))
|| (!entity.world.getChunkAtWorldCoords(blockposition_pooledblockposition).p()))) {
if (entity.locY > 0.0D) {
entity.motY = -0.1D;
} else {
entity.motY = 0.0D;
}
} else {
entity.motY -= 0.08D;
}
} }
entity.motY *= 0.9800000190734863D; entity.motY *= 0.9800000190734863D;
entity.motX *= f5; entity.motX *= f8;
entity.motZ *= f5; entity.motZ *= f8;
blockposition_pooledblockposition.t();
} }
} }
entity.aA = entity.aB; entity.aE = entity.aF;
double d0 = entity.locX - entity.lastX; double d0 = entity.locX - entity.lastX;
double d1 = entity.locZ - entity.lastZ; double d1 = entity.locZ - entity.lastZ;
@ -313,8 +356,8 @@ public class NMS {
f2 = 1.0F; f2 = 1.0F;
} }
entity.aB += (f2 - entity.aB) * 0.4F; entity.aF += (f2 - entity.aF) * 0.4F;
entity.aC += entity.aB; entity.aG += entity.aF;
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -358,7 +401,7 @@ public class NMS {
} }
public static float getHeadYaw(EntityLiving handle) { public static float getHeadYaw(EntityLiving handle) {
return handle.aK; return handle.aO;
} }
public static NavigationAbstract getNavigation(Entity handle) { public static NavigationAbstract getNavigation(Entity handle) {
@ -382,6 +425,19 @@ public class NMS {
} }
} }
public static DataWatcherObject<Integer> getRabbitTypeField() {
if (RABBIT_FIELD == null)
return null;
try {
return (DataWatcherObject<Integer>) RABBIT_FIELD.get(null);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
@Nullable @Nullable
public static SkinnableEntity getSkinnable(org.bukkit.entity.Entity entity) { public static SkinnableEntity getSkinnable(org.bukkit.entity.Entity entity) {
Preconditions.checkNotNull(entity); Preconditions.checkNotNull(entity);
@ -416,14 +472,14 @@ public class NMS {
} }
public static float getStepHeight(LivingEntity entity) { public static float getStepHeight(LivingEntity entity) {
return NMS.getHandle(entity).S; return NMS.getHandle(entity).P;
} }
public static void initNetworkManager(NetworkManager network) { public static void initNetworkManager(NetworkManager network) {
if (NETWORK_CHANNEL == null || NETWORK_ADDRESS == null) if (NETWORK_ADDRESS == null)
return; return;
try { try {
NETWORK_CHANNEL.set(network, new EmptyChannel(null)); network.channel = new EmptyChannel(null);
NETWORK_ADDRESS.set(network, new SocketAddress() { NETWORK_ADDRESS.set(network, new SocketAddress() {
private static final long serialVersionUID = 8207338859896320185L; private static final long serialVersionUID = 8207338859896320185L;
}); });
@ -438,11 +494,11 @@ public class NMS {
Entity mcEntity = getHandle(entity); Entity mcEntity = getHandle(entity);
if (mcEntity == null) if (mcEntity == null)
return false; return false;
return mcEntity.W() || mcEntity.ab(); return mcEntity.aj() || mcEntity.an();
} }
public static boolean isNavigationFinished(NavigationAbstract navigation) { public static boolean isNavigationFinished(NavigationAbstract navigation) {
return navigation.m(); return navigation.n();
} }
public static void loadPlugins() { public static void loadPlugins() {
@ -451,7 +507,7 @@ public class NMS {
public static void look(Entity handle, Entity target) { public static void look(Entity handle, Entity target) {
if (handle instanceof EntityInsentient) { if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).bQ()); ((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).N());
} else if (handle instanceof EntityHumanNPC) { } else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setTargetLook(target, 10F, 40F); ((EntityHumanNPC) handle).setTargetLook(target, 10F, 40F);
} }
@ -479,7 +535,7 @@ public class NMS {
if (mat != null) { if (mat != null) {
minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(data)); minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(data));
} }
minecart.SetDisplayBlockOffset(offset); minecart.setDisplayBlockOffset(offset);
} }
public static float modifiedSpeed(float baseSpeed, NPC npc) { public static float modifiedSpeed(float baseSpeed, NPC npc) {
@ -489,7 +545,7 @@ public class NMS {
public static void mount(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity passenger) { public static void mount(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity passenger) {
if (NMS.getHandle(passenger) == null) if (NMS.getHandle(passenger) == null)
return; return;
NMS.getHandle(passenger).mount(NMS.getHandle(entity)); NMS.getHandle(passenger).startRiding(NMS.getHandle(entity));
} }
public static void openHorseScreen(Horse horse, Player equipper) { public static void openHorseScreen(Horse horse, Player equipper) {
@ -647,10 +703,10 @@ public class NMS {
return; return;
EntityLiving handle = (EntityLiving) en; EntityLiving handle = (EntityLiving) en;
yaw = clampYaw(yaw); yaw = clampYaw(yaw);
handle.aK = yaw; handle.aO = yaw;
if (!(handle instanceof EntityHuman)) if (!(handle instanceof EntityHuman))
handle.aI = yaw; handle.aM = yaw;
handle.aL = yaw; handle.aP = yaw;
} }
public static void setProfile(SkullMeta meta, GameProfile profile) { public static void setProfile(SkullMeta meta, GameProfile profile) {
@ -699,17 +755,17 @@ public class NMS {
} }
public static void setStepHeight(EntityLiving entity, float height) { public static void setStepHeight(EntityLiving entity, float height) {
entity.S = height; entity.P = height;
} }
public static void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) { public static void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
if (!bukkitEntity.getType().isAlive()) if (!bukkitEntity.getType().isAlive())
return; return;
EntityLiving handle = NMS.getHandle((LivingEntity) bukkitEntity); EntityLiving handle = NMS.getHandle((LivingEntity) bukkitEntity);
handle.ba = (float) d; handle.be = (float) d;
} }
public static boolean shouldJump(net.minecraft.server.v1_8_R3.Entity entity) { public static boolean shouldJump(net.minecraft.server.v1_9_R1.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof EntityLiving)) if (JUMP_FIELD == null || !(entity instanceof EntityLiving))
return false; return false;
try { try {
@ -811,17 +867,18 @@ public class NMS {
} }
private static final float DEFAULT_SPEED = 1F; private static final float DEFAULT_SPEED = 1F;
private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT; private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT;
private static Map<Class<?>, String> ENTITY_CLASS_TO_NAME; private static Map<Class<?>, String> ENTITY_CLASS_TO_NAME;
private static final Map<Class<?>, Constructor<?>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>(); private static final Map<Class<?>, Constructor<?>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>();
private static Field GOAL_FIELD = getField(PathfinderGoalSelector.class, "b"); private static Field GOAL_FIELD = getField(PathfinderGoalSelector.class, "b");
private static final Field JUMP_FIELD = getField(EntityLiving.class, "aY"); private static final Field JUMP_FIELD = getField(EntityLiving.class, "bc");
private static Method MAKE_REQUEST; private static Method MAKE_REQUEST;
private static Field NAVIGATION_WORLD_FIELD = getField(NavigationAbstract.class, "c"); private static Field NAVIGATION_WORLD_FIELD = getField(NavigationAbstract.class, "b");
private static Field NETWORK_ADDRESS = getField(NetworkManager.class, "l"); private static Field NETWORK_ADDRESS = getField(NetworkManager.class, "l");
private static Field NETWORK_CHANNEL = getField(NetworkManager.class, "channel");
private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0); private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
private static Field PATHFINDING_RANGE = getField(NavigationAbstract.class, "a"); private static Field PATHFINDING_RANGE = getField(NavigationAbstract.class, "o");
private static final Field RABBIT_FIELD = getField(EntityRabbit.class, "bv");
private static final Random RANDOM = Util.getFastRandom(); private static final Random RANDOM = Util.getFastRandom();
private static Field SKULL_PROFILE_FIELD; private static Field SKULL_PROFILE_FIELD;

View File

@ -2,20 +2,20 @@ package net.citizensnpcs.util;
import java.util.Arrays; import java.util.Arrays;
import net.citizensnpcs.api.CitizensAPI; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
import net.minecraft.server.v1_8_R3.PacketPlayOutBed;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_9_R1.Packet;
import net.minecraft.server.v1_9_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_9_R1.PacketPlayOutBed;
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityMetadata;
public enum PlayerAnimation { public enum PlayerAnimation {
ARM_SWING { ARM_SWING {
@Override @Override
@ -64,8 +64,8 @@ public enum PlayerAnimation {
cancel(); cancel();
return; return;
} }
if (player.passenger != player) { if (!player.passengers.contains(player)) {
player.mount(player); NMS.mount(player.getBukkitEntity(), player.getBukkitEntity());
} }
} }
}.runTaskTimer(CitizensAPI.getPlugin(), 0, 1); }.runTaskTimer(CitizensAPI.getPlugin(), 0, 1);
@ -100,7 +100,7 @@ public enum PlayerAnimation {
protected void playAnimation(EntityPlayer player, int radius) { protected void playAnimation(EntityPlayer player, int radius) {
player.getBukkitEntity().setMetadata("citizens.sitting", player.getBukkitEntity().setMetadata("citizens.sitting",
new FixedMetadataValue(CitizensAPI.getPlugin(), false)); new FixedMetadataValue(CitizensAPI.getPlugin(), false));
player.mount(null); NMS.mount(player.getBukkitEntity(), null);
} }
}, },
STOP_SLEEPING { STOP_SLEEPING {

View File

@ -15,7 +15,7 @@ public class PlayerControllerJump {
} }
public void b() { public void b() {
this.a.i(this.b); this.a.k(this.b);
this.b = false; this.b = false;
} }
} }

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.util.nms; package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC; import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_9_R1.MathHelper;
public class PlayerControllerLook { public class PlayerControllerLook {
private final EntityHumanNPC a; private final EntityHumanNPC a;
@ -22,29 +22,27 @@ public class PlayerControllerLook {
this.a.pitch = 0.0F; this.a.pitch = 0.0F;
if (this.d) { if (this.d) {
this.d = false; this.d = false;
double d0 = this.e - this.a.locX;
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) (MathHelper.b(d2, d0) * 180.0D / 3.141592741012573D) - 90.0F; double d1 = this.e - this.a.locX;
float f1 = (float) (-(MathHelper.b(d1, d3) * 180.0D / 3.141592741012573D)); double d2 = this.f - (this.a.locY + this.a.getHeadHeight());
double d3 = this.g - this.a.locZ;
double d4 = MathHelper.sqrt(d1 * d1 + d3 * d3);
this.a.pitch = a(this.a.pitch, f1, this.c); float f1 = (float) (MathHelper.b(d3, d1) * 57.2957763671875D) - 90.0F;
this.a.aK = a(this.a.aK, f, this.b); float f2 = (float) -(MathHelper.b(d2, d4) * 57.2957763671875D);
this.a.pitch = a(this.a.pitch, f2, this.c);
this.a.aO = a(this.a.aO, f1, this.b);
} else { } else {
this.a.aK = a(this.a.aK, this.a.aI, 10.0F); this.a.aO = a(this.a.aO, this.a.aM, 10.0F);
} }
float f3 = MathHelper.g(this.a.aO - this.a.aM);
float f2 = MathHelper.g(this.a.aK - this.a.aI); if (!this.a.getNavigation().n()) {
if (f3 < -75.0F) {
if (!this.a.getNavigation().m()) { this.a.aO = (this.a.aM - 75.0F);
if (f2 < -75.0F) { }
this.a.aK = (this.a.aI - 75.0F); if (f3 > 75.0F) {
this.a.aO = (this.a.aM + 75.0F);
} }
if (f2 > 75.0F)
this.a.aK = (this.a.aI + 75.0F);
} }
} }

View File

@ -4,13 +4,13 @@ import java.util.Random;
import net.citizensnpcs.npc.entity.EntityHumanNPC; import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.AttributeInstance; import net.minecraft.server.v1_9_R1.AttributeInstance;
import net.minecraft.server.v1_8_R3.ControllerMove; import net.minecraft.server.v1_9_R1.ControllerMove;
import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_9_R1.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_8_R3.EntitySlime; import net.minecraft.server.v1_9_R1.EntitySlime;
import net.minecraft.server.v1_8_R3.GenericAttributes; import net.minecraft.server.v1_9_R1.GenericAttributes;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_9_R1.MathHelper;
public class PlayerControllerMove extends ControllerMove { public class PlayerControllerMove extends ControllerMove {
protected EntityLiving a; protected EntityLiving a;
@ -74,7 +74,7 @@ public class PlayerControllerMove extends ControllerMove {
@Override @Override
public void c() { public void c() {
this.a.ba = 0F; this.a.be = 0F;
if (this.f) { if (this.f) {
this.f = false; this.f = false;
int i = MathHelper.floor(this.a.getBoundingBox().b + 0.5D); int i = MathHelper.floor(this.a.getBoundingBox().b + 0.5D);
@ -90,7 +90,7 @@ public class PlayerControllerMove extends ControllerMove {
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
speed.setValue(0.1D * this.e); speed.setValue(0.1D * this.e);
float movement = (float) (this.e * speed.getValue()) * 10; float movement = (float) (this.e * speed.getValue()) * 10;
this.a.ba = movement; this.a.be = movement;
if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) { if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) {
this.h = cg(); this.h = cg();
this.h /= 3; this.h /= 3;

View File

@ -1,80 +1,102 @@
package net.citizensnpcs.util.nms; package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC; import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.minecraft.server.v1_8_R3.AttributeInstance; import net.minecraft.server.v1_9_R1.AttributeInstance;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_9_R1.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_9_R1.Block;
import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_8_R3.ChunkCache; import net.minecraft.server.v1_9_R1.Blocks;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_9_R1.ChunkCache;
import net.minecraft.server.v1_8_R3.EntityChicken; import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_9_R1.EntityInsentient;
import net.minecraft.server.v1_8_R3.GenericAttributes; import net.minecraft.server.v1_9_R1.GenericAttributes;
import net.minecraft.server.v1_8_R3.Material; import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_9_R1.Material;
import net.minecraft.server.v1_8_R3.NavigationAbstract; import net.minecraft.server.v1_9_R1.MathHelper;
import net.minecraft.server.v1_8_R3.PathEntity; import net.minecraft.server.v1_9_R1.NavigationAbstract;
import net.minecraft.server.v1_8_R3.PathPoint; import net.minecraft.server.v1_9_R1.PathEntity;
import net.minecraft.server.v1_8_R3.Pathfinder; import net.minecraft.server.v1_9_R1.PathPoint;
import net.minecraft.server.v1_8_R3.PathfinderNormal; import net.minecraft.server.v1_9_R1.PathType;
import net.minecraft.server.v1_8_R3.Vec3D; import net.minecraft.server.v1_9_R1.Pathfinder;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_9_R1.PathfinderAbstract;
import net.minecraft.server.v1_9_R1.PathfinderNormal;
import net.minecraft.server.v1_9_R1.Vec3D;
import net.minecraft.server.v1_9_R1.World;
public class PlayerNavigation extends NavigationAbstract { public class PlayerNavigation extends NavigationAbstract {
private final AttributeInstance a; protected EntityHumanNPC a;
private PathfinderNormal aa; protected World b;
protected EntityHumanNPC b; protected PathEntity c;
protected World c; protected double d;
protected PathEntity d; protected PathfinderAbstract e;
protected double e; private boolean f2;
private int f; private final AttributeInstance g;
private boolean ff; private int h;
private int g; private int i;
private Vec3D h = new Vec3D(0.0D, 0.0D, 0.0D); private Vec3D j = Vec3D.a;
private float i = 1.0F; private Vec3D k = Vec3D.a;
private final Pathfinder j; private long l = 0L;
private long m = 0L;
private double n;
private float o = 0.5F;
private boolean p;
private long q;
private BlockPosition r;
private final Pathfinder s;
public PlayerNavigation(EntityHumanNPC entityinsentient, World world) { public PlayerNavigation(EntityHumanNPC entityinsentient, World world) {
super(getDummyInsentient(entityinsentient), world); super(getDummyInsentient(entityinsentient), world);
this.b = entityinsentient; this.a = entityinsentient;
this.c = world; this.b = world;
this.a = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); this.g = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
this.a.setValue(24); this.g.setValue(24);
this.j = a(); this.s = a();
this.b.C().a(this);
} }
@Override @Override
protected Pathfinder a() { protected Pathfinder a() {
this.aa = new PathfinderNormal(); this.e = new PathfinderNormal();
this.aa.a(true); this.e.a(true);
return new Pathfinder(this.aa); return new Pathfinder(this.e);
} }
@Override @Override
public PathEntity a(BlockPosition paramBlockPosition) { public PathEntity a(BlockPosition paramBlockPosition) {
if (!b()) { BlockPosition localBlockPosition;
return null; if (this.b.getType(paramBlockPosition).getMaterial() == Material.AIR) {
localBlockPosition = paramBlockPosition.down();
while ((localBlockPosition.getY() > 0)
&& (this.b.getType(localBlockPosition).getMaterial() == Material.AIR)) {
localBlockPosition = localBlockPosition.down();
}
if (localBlockPosition.getY() > 0) {
return super.a(localBlockPosition.up());
}
while ((localBlockPosition.getY() < this.b.getHeight())
&& (this.b.getType(localBlockPosition).getMaterial() == Material.AIR)) {
localBlockPosition = localBlockPosition.up();
}
paramBlockPosition = localBlockPosition;
} }
if (this.b.getType(paramBlockPosition).getMaterial().isBuildable()) {
float f1 = i(); localBlockPosition = paramBlockPosition.up();
this.c.methodProfiler.a("pathfind"); while ((localBlockPosition.getY() < this.b.getHeight())
BlockPosition localBlockPosition = new BlockPosition(this.b); && (this.b.getType(localBlockPosition).getMaterial().isBuildable())) {
int k = (int) (f1 + 8.0F); localBlockPosition = localBlockPosition.up();
}
ChunkCache localChunkCache = new ChunkCache(this.c, localBlockPosition.a(-k, -k, -k), return a2(localBlockPosition);
localBlockPosition.a(k, k, k), 0); }
PathEntity localPathEntity = this.j.a(localChunkCache, this.b, paramBlockPosition, f1); return a2(paramBlockPosition);
this.c.methodProfiler.b();
return localPathEntity;
} }
public void a(boolean paramBoolean) { public void a(boolean paramBoolean) {
this.aa.c(paramBoolean); this.e.b(paramBoolean);
} }
@Override @Override
public void a(double paramDouble) { public void a(double paramDouble) {
this.e = paramDouble; this.d = paramDouble;
} }
@Override @Override
@ -86,20 +108,8 @@ public class PlayerNavigation extends NavigationAbstract {
@Override @Override
public PathEntity a(Entity paramEntity) { public PathEntity a(Entity paramEntity) {
if (!b()) { BlockPosition localBlockPosition = new BlockPosition(paramEntity);
return null; return a(localBlockPosition);
}
float f1 = i();
this.c.methodProfiler.a("pathfind");
BlockPosition localBlockPosition = new BlockPosition(this.b).up();
int k = (int) (f1 + 16.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, paramEntity, f1);
this.c.methodProfiler.b();
return localPathEntity;
} }
@Override @Override
@ -111,95 +121,111 @@ public class PlayerNavigation extends NavigationAbstract {
return false; 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, private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6,
Vec3D paramVec3D, double paramDouble1, double paramDouble2) { Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
int i = paramInt1 - paramInt4 / 2; int i = paramInt1 - paramInt4 / 2;
int j = paramInt3 - paramInt6 / 2; int j = paramInt3 - paramInt6 / 2;
if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) { if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
return false; return false;
} }
for (int k = i; k < i + paramInt4; k++) { for (int k = i; k < i + paramInt4; k++) {
for (int m = j; m < j + paramInt6; m++) { for (int m = j; m < j + paramInt6; m++) {
double d1 = k + 0.5D - paramVec3D.a; double d1 = k + 0.5D - paramVec3D.x;
double d2 = m + 0.5D - paramVec3D.c; double d2 = m + 0.5D - paramVec3D.z;
if (d1 * paramDouble1 + d2 * paramDouble2 < 0.0D) { if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
continue; PathType localPathType = this.e.a(this.b, k, paramInt2 - 1, m, this.a, paramInt4, paramInt5,
} paramInt6, true, true);
Block localBlock = this.c.getType(new BlockPosition(k, paramInt2 - 1, m)).getBlock(); if (localPathType == PathType.WATER) {
Material localMaterial = localBlock.getMaterial(); return false;
if (localMaterial == Material.AIR) { }
return false; if (localPathType == PathType.LAVA) {
} return false;
if ((localMaterial == Material.WATER) && (!this.b.V())) { }
return false; if (localPathType == PathType.OPEN) {
} return false;
if (localMaterial == Material.LAVA) { }
return false; localPathType = this.e.a(this.b, k, paramInt2, m, this.a, paramInt4, paramInt5, paramInt6, true,
true);
float f1 = this.a.a(localPathType);
if ((f1 < 0.0F) || (f1 >= 8.0F)) {
return false;
}
if ((localPathType == PathType.DAMAGE_FIRE) || (localPathType == PathType.DANGER_FIRE)
|| (localPathType == PathType.DAMAGE_OTHER)) {
return false;
}
} }
} }
} }
return true; return true;
} }
@Override @Override
public boolean a(PathEntity paramPathEntity, double paramDouble) { public boolean a(PathEntity paramPathEntity, double paramDouble) {
if (paramPathEntity == null) { if (paramPathEntity == null) {
this.d = null; this.c = null;
return false; return false;
} }
if (!paramPathEntity.a(this.d)) { if (!paramPathEntity.a(this.c)) {
this.d = paramPathEntity; this.c = paramPathEntity;
} }
d(); d();
if (this.d.d() == 0) { if (this.c.d() == 0) {
return false; return false;
} }
this.d = paramDouble;
this.e = paramDouble;
Vec3D localVec3D = c(); Vec3D localVec3D = c();
this.g = this.f; this.i = this.h;
this.h = localVec3D; this.j = localVec3D;
return true; return true;
} }
@Override @Override
protected void a(Vec3D paramVec3D) { protected void a(Vec3D paramVec3D) {
if (this.f - this.g > 100) { if (this.h - this.i > 100) {
if (paramVec3D.distanceSquared(this.h) < 2.25D) { if (paramVec3D.distanceSquared(this.j) < 2.25D) {
n(); o();
} }
this.g = this.f; this.i = this.h;
this.h = paramVec3D; this.j = paramVec3D;
}
if ((this.c != null) && (!this.c.b())) {
Vec3D localVec3D = this.c.f();
if (!localVec3D.equals(this.k)) {
this.k = localVec3D;
double d1 = paramVec3D.f(this.k);
this.n = (this.a.ck() > 0.0F ? d1 / this.a.ck() * 1000.0D : 0.0D);
} else {
this.l += System.currentTimeMillis() - this.m;
}
if ((this.n > 0.0D) && (this.l > this.n * 3.0D)) {
this.k = Vec3D.a;
this.l = 0L;
this.n = 0.0D;
o();
}
this.m = System.currentTimeMillis();
} }
} }
@Override @Override
protected boolean a(Vec3D paramVec3D1, Vec3D paramVec3D2, int paramInt1, int paramInt2, int paramInt3) { protected boolean a(Vec3D paramVec3D1, Vec3D paramVec3D2, int paramInt1, int paramInt2, int paramInt3) {
int i = MathHelper.floor(paramVec3D1.a); int i = MathHelper.floor(paramVec3D1.x);
int j = MathHelper.floor(paramVec3D1.c); int j = MathHelper.floor(paramVec3D1.z);
double d1 = paramVec3D2.a - paramVec3D1.a; double d1 = paramVec3D2.x - paramVec3D1.x;
double d2 = paramVec3D2.c - paramVec3D1.c; double d2 = paramVec3D2.z - paramVec3D1.z;
double d3 = d1 * d1 + d2 * d2; double d3 = d1 * d1 + d2 * d2;
if (d3 < 1.0E-008D) { if (d3 < 1.0E-8D) {
return false; return false;
} }
double d4 = 1.0D / Math.sqrt(d3); double d4 = 1.0D / Math.sqrt(d3);
d1 *= d4; d1 *= d4;
d2 *= d4; d2 *= d4;
paramInt1 += 2; paramInt1 += 2;
paramInt3 += 2; paramInt3 += 2;
if (!a(i, (int) paramVec3D1.b, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) { if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
return false; return false;
} }
paramInt1 -= 2; paramInt1 -= 2;
@ -208,8 +234,8 @@ public class PlayerNavigation extends NavigationAbstract {
double d5 = 1.0D / Math.abs(d1); double d5 = 1.0D / Math.abs(d1);
double d6 = 1.0D / Math.abs(d2); double d6 = 1.0D / Math.abs(d2);
double d7 = i * 1 - paramVec3D1.a; double d7 = i - paramVec3D1.x;
double d8 = j * 1 - paramVec3D1.c; double d8 = j - paramVec3D1.z;
if (d1 >= 0.0D) { if (d1 >= 0.0D) {
d7 += 1.0D; d7 += 1.0D;
} }
@ -221,8 +247,8 @@ public class PlayerNavigation extends NavigationAbstract {
int k = d1 < 0.0D ? -1 : 1; int k = d1 < 0.0D ? -1 : 1;
int m = d2 < 0.0D ? -1 : 1; int m = d2 < 0.0D ? -1 : 1;
int n = MathHelper.floor(paramVec3D2.a); int n = MathHelper.floor(paramVec3D2.x);
int i1 = MathHelper.floor(paramVec3D2.c); int i1 = MathHelper.floor(paramVec3D2.z);
int i2 = n - i; int i2 = n - i;
int i3 = i1 - j; int i3 = i1 - j;
while ((i2 * k > 0) || (i3 * m > 0)) { while ((i2 * k > 0) || (i3 * m > 0)) {
@ -235,35 +261,59 @@ public class PlayerNavigation extends NavigationAbstract {
j += m; j += m;
i3 = i1 - j; i3 = i1 - j;
} }
if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
if (!a(i, (int) paramVec3D1.b, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
return false; return false;
} }
} }
return true; return true;
} }
public PathEntity a2(BlockPosition paramBlockPosition) {
if (!b()) {
return null;
}
if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.r))) {
return this.c;
}
this.r = paramBlockPosition;
float f1 = h();
this.b.methodProfiler.a("pathfind");
BlockPosition localBlockPosition = new BlockPosition(this.a);
int i1 = (int) (f1 + 8.0F);
ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1),
localBlockPosition.a(i1, i1, i1), 0);
PathEntity localPathEntity = this.s.a(localChunkCache, this.a, this.r, f1);
this.b.methodProfiler.b();
return localPathEntity;
}
@Override @Override
protected boolean b() { protected boolean b() {
return (this.b.onGround) || ((h()) && (o())) || ((this.b.au()) && ((this.b.vehicle instanceof EntityChicken))); return (this.a.onGround) || ((g()) && (p())) || (this.a.isPassenger());
}
@Override
public boolean b(BlockPosition paramBlockPosition) {
return this.b.getType(paramBlockPosition.down()).b();
} }
public void b(boolean paramBoolean) { public void b(boolean paramBoolean) {
this.aa.b(paramBoolean); this.e.a(paramBoolean);
} }
private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6,
Vec3D paramVec3D, double paramDouble1, double paramDouble2) { Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
for (BlockPosition localBlockPosition : BlockPosition.a(new BlockPosition(paramInt1, paramInt2, paramInt3), for (BlockPosition localBlockPosition : BlockPosition.a(new BlockPosition(paramInt1, paramInt2, paramInt3),
new BlockPosition(paramInt1 + paramInt4 - 1, paramInt2 + paramInt5 - 1, paramInt3 + paramInt6 - 1))) { new BlockPosition(paramInt1 + paramInt4 - 1, paramInt2 + paramInt5 - 1, paramInt3 + paramInt6 - 1))) {
double d1 = localBlockPosition.getX() + 0.5D - paramVec3D.a; double d1 = localBlockPosition.getX() + 0.5D - paramVec3D.x;
double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.c; double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.z;
if (d1 * paramDouble1 + d2 * paramDouble2 < 0.0D) { if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
continue; Block localBlock = this.b.getType(localBlockPosition).getBlock();
} if (!localBlock.b(this.b, localBlockPosition)) {
Block localBlock = this.c.getType(localBlockPosition).getBlock(); return false;
if (!localBlock.b(this.c, localBlockPosition)) { }
return false;
} }
} }
return true; return true;
@ -271,168 +321,192 @@ public class PlayerNavigation extends NavigationAbstract {
@Override @Override
protected Vec3D c() { protected Vec3D c() {
return new Vec3D(this.b.locX, p(), this.b.locZ); return new Vec3D(this.a.locX, r(), this.a.locZ);
} }
public void c(boolean paramBoolean) { public void c(boolean paramBoolean) {
this.aa.a(paramBoolean); this.e.c(paramBoolean);
} }
@Override @Override
protected void d() { protected void d() {
super.d(); super.d();
if (this.ff) { PathPoint localPathPoint;
if (this.c.i(new BlockPosition(MathHelper.floor(this.b.locX), (int) (this.b.getBoundingBox().b + 0.5D), for (int i = 0; i < this.c.d(); i++) {
MathHelper.floor(this.b.locZ)))) { localPathPoint = this.c.a(i);
Object localObject = i + 1 < this.c.d() ? this.c.a(i + 1) : null;
IBlockData localIBlockData = this.b
.getType(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c));
Block localBlock = localIBlockData.getBlock();
if (localBlock == Blocks.cauldron) {
this.c.a(i, localPathPoint.a(localPathPoint.a, localPathPoint.b + 1, localPathPoint.c));
if ((localObject != null) && (localPathPoint.b >= ((PathPoint) localObject).b)) {
this.c.a(i + 1, ((PathPoint) localObject).a(((PathPoint) localObject).a, localPathPoint.b + 1,
((PathPoint) localObject).c));
}
}
}
if (this.f2) {
if (this.b.h(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D),
MathHelper.floor(this.a.locZ)))) {
return; return;
} }
for (i = 0; i < this.c.d(); i++) {
for (int i = 0; i < this.d.d(); i++) { localPathPoint = this.c.a(i);
PathPoint localPathPoint = this.d.a(i); if (this.b.h(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
if (this.c.i(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) { this.c.b(i - 1);
this.d.b(i - 1);
return; return;
} }
} }
} }
} }
public void d(boolean paramBoolean) { public boolean f() {
this.aa.d(paramBoolean); return this.e.c();
}
public boolean e() {
return this.aa.e();
}
public void e(boolean paramBoolean) {
this.ff = paramBoolean;
} }
public boolean g() { public boolean g() {
return this.aa.b(); return this.e.e();
}
public boolean h() {
return this.aa.d();
} }
@Override @Override
public float i() { public float h() {
return (float) this.a.getValue(); return (float) this.g.getValue();
} }
@Override @Override
public PathEntity j() { public boolean i() {
return this.d; return this.p;
} }
@Override @Override
public void k() { public void j() {
this.f += 1; if (this.b.getTime() - this.q > f) {
if (m()) { if (this.r != null) {
return; this.c = null;
} this.c = a(this.r);
this.q = this.b.getTime();
if (b()) { this.p = false;
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);
} }
} else {
this.p = true;
} }
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 @Override
protected void l() { public PathEntity k() {
return this.c;
}
@Override
public void l() {
this.h += 1;
if (this.p) {
j();
}
if (n()) {
return;
}
if (b()) {
m();
} else if ((this.c != null) && (this.c.e() < this.c.d())) {
Vec3D localVec3D = c();
Vec3D localObject = this.c.a(this.a, this.c.e());
if ((localVec3D.y > localObject.y) && (!this.a.onGround)
&& (MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x))
&& (MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z))) {
this.c.c(this.c.e() + 1);
}
}
if (n()) {
return;
}
Vec3D localVec3D = this.c.a(this.a);
if (localVec3D == null) {
return;
}
Object localObject = new BlockPosition(localVec3D).down();
AxisAlignedBB localAxisAlignedBB = this.b.getType((BlockPosition) localObject).c(this.b,
(BlockPosition) localObject);
localVec3D = localVec3D.a(0.0D, 1.0D - localAxisAlignedBB.e, 0.0D);
this.a.getControllerMove().a(localVec3D.x, localVec3D.y, localVec3D.z, this.d);
}
@Override
protected void m() {
Vec3D localVec3D1 = c(); Vec3D localVec3D1 = c();
int k = this.d.d(); int i1 = this.c.d();
for (int m = this.d.e(); m < this.d.d(); m++) { for (int i2 = this.c.e(); i2 < this.c.d(); i2++) {
if (this.d.a(m).b != (int) localVec3D1.b) { if (this.c.a(i2).b != Math.floor(localVec3D1.y)) {
k = m; i1 = i2;
break; break;
} }
}
} this.o = (this.a.width > 0.75F ? this.a.width / 2.0F : 0.75F - this.a.width / 2.0F);
Vec3D localVec3D2 = this.c.f();
float f1 = this.b.width * this.b.width * this.i; if ((MathHelper.e((float) (this.a.locX - (localVec3D2.x + 0.5D))) < this.o)
for (int n = this.d.e(); n < k; n++) { && (MathHelper.e((float) (this.a.locZ - (localVec3D2.z + 0.5D))) < this.o)) {
Vec3D localVec3D2 = this.d.a(this.b, n); this.c.c(this.c.e() + 1);
if (localVec3D1.distanceSquared(localVec3D2) < f1) { }
this.d.c(n + 1); int i3 = MathHelper.f(this.a.width);
} int i4 = (int) this.a.length + 1;
int i5 = i3;
} for (int i6 = i1 - 1; i6 >= this.c.e(); i6--) {
int n = MathHelper.f(this.b.width); if (a(localVec3D1, this.c.a(this.a, i6), i3, i4, i5)) {
int i1 = (int) this.b.length + 1; this.c.c(i6);
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; break;
} }
} }
a(localVec3D1); a(localVec3D1);
} }
@Override @Override
public boolean m() { public boolean n() {
return (this.d == null) || (this.d.b()); return (this.c == null) || (this.c.b());
} }
@Override @Override
public void n() { public void o() {
this.d = null; this.c = null;
} }
@Override @Override
protected boolean o() { protected boolean p() {
return (this.b.V()) || (this.b.ab()); return (this.a.isInWater()) || (this.a.an());
} }
private int p() { private int r() {
if ((!this.b.V()) || (!h())) { if ((!this.a.isInWater()) || (!g())) {
return (int) (this.b.getBoundingBox().b + 0.5D); return (int) (this.a.getBoundingBox().b + 0.5D);
} }
int i = (int) this.a.getBoundingBox().b;
int i = (int) this.b.getBoundingBox().b; Block localBlock = this.b
Block localBlock = this.c .getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ))).getBlock();
.getType(new BlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ))).getBlock();
int j = 0; int j = 0;
while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) { while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
i++; i++;
localBlock = this.c localBlock = this.b
.getType(new BlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ))) .getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ)))
.getBlock(); .getBlock();
j++; j++;
if (j > 16) { if (j > 16) {
return (int) this.b.getBoundingBox().b; return (int) this.a.getBoundingBox().b;
} }
} }
return i; return i;
} }
public void setRange(float pathfindingRange) { public void setRange(float pathfindingRange) {
this.a.setValue(pathfindingRange); this.g.setValue(pathfindingRange);
} }
private static EntityInsentient getDummyInsentient(EntityHumanNPC from) { private static EntityInsentient getDummyInsentient(EntityHumanNPC from) {
return new EntityInsentient(null) { return new EntityInsentient(null) {
}; };
} }
private static int f = 20;
} }

View File

@ -1,14 +1,15 @@
package net.citizensnpcs.util.nms; package net.citizensnpcs.util.nms;
import java.lang.reflect.Field;
import org.bukkit.entity.Player;
import net.citizensnpcs.npc.entity.EntityHumanNPC; import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.citizensnpcs.npc.skin.SkinnableEntity; import net.citizensnpcs.npc.skin.SkinnableEntity;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry; import net.minecraft.server.v1_9_R1.EntityTrackerEntry;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
public class PlayerlistTrackerEntry extends EntityTrackerEntry { public class PlayerlistTrackerEntry extends EntityTrackerEntry {
public PlayerlistTrackerEntry(Entity entity, int i, int j, boolean flag) { public PlayerlistTrackerEntry(Entity entity, int i, int j, boolean flag) {
@ -21,7 +22,6 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
@Override @Override
public void updatePlayer(final EntityPlayer entityplayer) { public void updatePlayer(final EntityPlayer entityplayer) {
// prevent updates to NPC "viewers" // prevent updates to NPC "viewers"
if (entityplayer instanceof EntityHumanNPC) if (entityplayer instanceof EntityHumanNPC)
return; return;
@ -34,7 +34,7 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
if ((this.tracker instanceof SkinnableEntity)) { if ((this.tracker instanceof SkinnableEntity)) {
SkinnableEntity skinnable = (SkinnableEntity)this.tracker; SkinnableEntity skinnable = (SkinnableEntity) this.tracker;
Player player = skinnable.getBukkitEntity(); Player player = skinnable.getBukkitEntity();
if (!entityplayer.getBukkitEntity().canSee(player)) if (!entityplayer.getBukkitEntity().canSee(player))