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

View File

@ -7,9 +7,8 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@ -45,7 +44,7 @@ import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityTeleport;
public class CitizensNPC extends AbstractNPC {
private EntityController entityController;
@ -192,7 +191,7 @@ public class CitizensNPC extends AbstractNPC {
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);
// send skin packets, if applicable, before other NMS packets are sent
@ -301,12 +300,6 @@ public class CitizensNPC extends AbstractNPC {
if (getEntity() instanceof LivingEntity) {
boolean nameplateVisible = data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true);
((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) {
Throwable error = Throwables.getRootCause(ex);

View File

@ -2,6 +2,11 @@ package net.citizensnpcs.npc;
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.BlazeController;
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.ZombieController;
import net.citizensnpcs.npc.entity.nonliving.ArmorStandController;
import net.citizensnpcs.npc.entity.nonliving.ArrowController;
import net.citizensnpcs.npc.entity.nonliving.BoatController;
import net.citizensnpcs.npc.entity.nonliving.EggController;
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.ThrownExpBottleController;
import net.citizensnpcs.npc.entity.nonliving.ThrownPotionController;
import net.citizensnpcs.npc.entity.nonliving.TippedArrowController;
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 static boolean controllerExistsForType(EntityType 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);
static {
TYPES.put(EntityType.ARROW, ArrowController.class);
TYPES.put(EntityType.ARROW, TippedArrowController.class);
TYPES.put(EntityType.ARMOR_STAND, ArmorStandController.class);
TYPES.put(EntityType.BAT, BatController.class);
TYPES.put(EntityType.BLAZE, BlazeController.class);

View File

@ -3,16 +3,16 @@ package net.citizensnpcs.npc;
import java.lang.reflect.Constructor;
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.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.entity.Entity;
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 {
private final Constructor<?> constructor;
@ -23,7 +23,7 @@ public abstract class MobEntityController extends AbstractEntityController {
@Override
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);
entity.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
@ -36,9 +36,9 @@ public abstract class MobEntityController extends AbstractEntityController {
return entity.getBukkitEntity();
}
private net.minecraft.server.v1_8_R3.Entity createEntityFromClass(Object... args) {
private net.minecraft.server.v1_9_R1.Entity createEntityFromClass(Object... args) {
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) {
ex.printStackTrace();
return null;

View File

@ -70,7 +70,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
}
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 dZ = vector.getBlockZ() - handle.locZ;
double dY = vector.getY() - handle.locY;

View File

@ -1,8 +1,8 @@
package net.citizensnpcs.npc.ai;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
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.util.PlayerAnimation;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.Enchantment;
import net.minecraft.server.v1_8_R3.EnchantmentManager;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.Material;
import net.minecraft.server.v1_8_R3.MobEffectList;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.Blocks;
import net.minecraft.server.v1_9_R1.EnchantmentManager;
import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_9_R1.EnumItemSlot;
import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_9_R1.ItemStack;
import net.minecraft.server.v1_9_R1.Material;
import net.minecraft.server.v1_9_R1.MobEffects;
public class CitizensBlockBreaker extends BlockBreaker {
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);
}
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())
: entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(0) : null;
: entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null;
}
private float getStrength(Block block) {
float base = block.g(null, new BlockPosition(0, 0, 0));
private float getStrength(IBlockData block) {
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);
}
private boolean isDestroyable(Block block) {
private boolean isDestroyable(IBlockData block) {
if (block.getMaterial().isAlwaysDestroyable()) {
return true;
} else {
@ -99,7 +99,7 @@ public class CitizensBlockBreaker extends BlockBreaker {
if (entity instanceof EntityPlayer) {
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) {
return BehaviorStatus.SUCCESS;
} else {
@ -128,35 +128,45 @@ public class CitizensBlockBreaker extends BlockBreaker {
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();
float strength = itemstack != null ? itemstack.a(block) : 1;
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;
}
}
float f = itemstack.a(block);
if (entity instanceof EntityLiving) {
EntityLiving living = (EntityLiving) entity;
if (living.hasEffect(MobEffectList.FASTER_DIG)) {
strength *= 1.0F + (living.getEffect(MobEffectList.FASTER_DIG).getAmplifier() + 1) * 0.2F;
EntityLiving handle = (EntityLiving) entity;
if (f > 1.0F) {
int i = EnchantmentManager.getDigSpeedEnchantmentLevel(handle);
if (i > 0) {
f += i * i + 1;
}
}
if (living.hasEffect(MobEffectList.SLOWER_DIG)) {
strength *= 1.0F - (living.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F;
if (handle.hasEffect(MobEffects.FASTER_DIG)) {
f *= (1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F);
}
if (entity.a(Material.WATER) && !EnchantmentManager.j(living)) {
strength /= 5.0F;
if (handle.hasEffect(MobEffects.SLOWER_DIG)) {
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) {
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.util.NMS;
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 {
private final NPC npc;

View File

@ -1,15 +1,15 @@
package net.citizensnpcs.npc.ai;
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.TargetType;
import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_9_R1.NavigationAbstract;
public class MCNavigationStrategy extends AbstractPathStrategy {
private final EntityLiving handle;

View File

@ -1,7 +1,7 @@
package net.citizensnpcs.npc.ai;
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 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.util.NMS;
import net.citizensnpcs.util.PlayerAnimation;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_9_R1.NavigationAbstract;
public class MCTargetStrategy implements PathStrategy, EntityTarget {
private final boolean aggro;

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftBat;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftBat;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Bat;
import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityBat;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityBat;
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 BatController extends MobEntityController {
public BatController() {
@ -60,33 +61,19 @@ public class BatController extends MobEntityController {
}
@Override
protected String bo() {
return npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.bo()
: npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.bp()
: npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -100,23 +87,6 @@ public class BatController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void E() {
if (npc == null) {
super.E();
} else {
NMS.updateAI(this);
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
@ -150,6 +120,12 @@ public class BatController extends MobEntityController {
// 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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -162,14 +138,39 @@ public class BatController extends MobEntityController {
return npc;
}
public void setFlying(boolean flying) {
setAsleep(flying);
@Override
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 String z() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z());
protected void L() {
if (npc == null) {
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Blaze;
import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityBlaze;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityBlaze;
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 BlazeController extends MobEntityController {
public BlazeController() {
@ -59,30 +60,19 @@ public class BlazeController extends MobEntityController {
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -96,20 +86,6 @@ public class BlazeController extends MobEntityController {
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
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
@ -143,6 +119,12 @@ public class BlazeController extends MobEntityController {
// 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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -156,9 +138,30 @@ public class BlazeController 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 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) {
npc.update();
}
}
}
}

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.CaveSpider;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityCaveSpider;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityCaveSpider;
import net.minecraft.server.v1_9_R1.IBlockData;
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 CaveSpiderController extends MobEntityController {
public CaveSpiderController() {
@ -61,39 +62,26 @@ public class CaveSpiderController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -107,13 +95,6 @@ public class CaveSpiderController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -121,14 +102,6 @@ public class CaveSpiderController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -184,9 +163,39 @@ public class CaveSpiderController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -200,11 +209,5 @@ public class CaveSpiderController extends MobEntityController {
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Chicken;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityChicken;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityChicken;
import net.minecraft.server.v1_9_R1.IBlockData;
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 ChickenController extends MobEntityController {
public ChickenController() {
@ -72,37 +73,26 @@ public class ChickenController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -116,13 +106,6 @@ public class ChickenController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -130,14 +113,6 @@ public class ChickenController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -193,18 +174,40 @@ public class ChickenController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
super.M();
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCow;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftCow;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Cow;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityCow;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityCow;
import net.minecraft.server.v1_9_R1.IBlockData;
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 CowController extends MobEntityController {
public CowController() {
@ -73,37 +74,26 @@ public class CowController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -117,13 +107,6 @@ public class CowController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -131,14 +114,6 @@ public class CowController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -194,18 +175,40 @@ public class CowController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
super.M();
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Creeper;
import org.bukkit.util.Vector;
@ -15,13 +15,16 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityCreeper;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityLightning;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityCreeper;
import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_9_R1.EntityLightning;
import net.minecraft.server.v1_9_R1.EnumHand;
import net.minecraft.server.v1_9_R1.IBlockData;
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 CreeperController() {
@ -64,42 +67,32 @@ public class CreeperController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected boolean a(EntityHuman entityhuman) {
return npc == null || !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true) ? super.a(entityhuman) : false;
protected boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
return npc == null || !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)
? super.a(entityhuman, enumhand, itemstack) : false;
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -112,13 +105,6 @@ public class CreeperController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -126,14 +112,6 @@ public class CreeperController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -189,9 +173,37 @@ public class CreeperController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -216,11 +228,5 @@ public class CreeperController extends MobEntityController {
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderDragon;
import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderDragon;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityEnderDragon;
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 EnderDragonController extends MobEntityController {
public EnderDragonController() {
@ -59,30 +60,19 @@ public class EnderDragonController extends MobEntityController {
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -95,13 +85,6 @@ public class EnderDragonController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
@ -135,6 +118,12 @@ public class EnderDragonController extends MobEntityController {
// 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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -157,7 +146,27 @@ public class EnderDragonController extends MobEntityController {
}
@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) {
npc.update();
if (motX != 0 || motY != 0 || motZ != 0) {
@ -168,14 +177,8 @@ public class EnderDragonController extends MobEntityController {
setPosition(locX + motX, locY + motY, locZ + motZ);
}
} 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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Enderman;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityEnderman;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityEnderman;
import net.minecraft.server.v1_9_R1.IBlockData;
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 EndermanController extends MobEntityController {
public EndermanController() {
@ -61,37 +62,26 @@ public class EndermanController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -104,13 +94,6 @@ public class EndermanController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -118,13 +101,6 @@ public class EndermanController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -180,17 +162,44 @@ public class EndermanController extends MobEntityController {
}
@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) {
return super.j(d1, d2, d3);
return super.k(d1, d2, d3);
}
return false;
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -204,11 +213,5 @@ public class EndermanController extends MobEntityController {
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEndermite;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEndermite;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Endermite;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityEndermite;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityEndermite;
import net.minecraft.server.v1_9_R1.IBlockData;
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 EndermiteController extends MobEntityController {
public EndermiteController() {
@ -61,37 +62,26 @@ public class EndermiteController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -104,13 +94,6 @@ public class EndermiteController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -118,13 +101,6 @@ public class EndermiteController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -180,9 +162,36 @@ public class EndermiteController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -196,11 +205,5 @@ public class EndermiteController extends MobEntityController {
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.ChatColor;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;
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.PlayerControllerMove;
import net.citizensnpcs.util.nms.PlayerNavigation;
import net.minecraft.server.v1_8_R3.AttributeInstance;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EnumProtocolDirection;
import net.minecraft.server.v1_8_R3.GenericAttributes;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_8_R3.NetworkManager;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_8_R3.PlayerInteractManager;
import net.minecraft.server.v1_8_R3.WorldServer;
import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode;
import net.minecraft.server.v1_9_R1.AttributeInstance;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_9_R1.EnumItemSlot;
import net.minecraft.server.v1_9_R1.EnumProtocolDirection;
import net.minecraft.server.v1_9_R1.GenericAttributes;
import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_9_R1.MathHelper;
import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_9_R1.NavigationAbstract;
import net.minecraft.server.v1_9_R1.NetworkManager;
import net.minecraft.server.v1_9_R1.Packet;
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_9_R1.PlayerInteractManager;
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 {
private PlayerControllerJump controllerJump;
@ -83,14 +84,14 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -231,7 +232,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
try {
conn = new EmptyNetworkManager(EnumProtocolDirection.CLIENTBOUND);
playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
conn.a(playerConnection);
conn.setPacketListener(playerConnection);
socket.close();
} catch (IOException e) {
// swallow
@ -257,69 +258,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
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_();
public void m() {
super.m();
if (npc == null)
return;
boolean navigating = npc.getNavigator().isNavigating();
@ -346,6 +286,61 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
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() {
controllerMove.c();
controllerLook.a();
@ -361,8 +356,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
packets[5] = new PacketPlayOutEntityHeadRotation(this,
(byte) MathHelper.d(NMS.getHeadYaw(this) * 256.0F / 360.0F));
}
for (int i = 0; i < 5; i++) {
packets[i] = new PacketPlayOutEntityEquipment(getId(), i, getEquipment(i));
int i = 0;
for (EnumItemSlot slot : EnumItemSlot.values()) {
packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
}
boolean removeFromPlayerList = npc.data().get("removefromplayerlist",
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGhast;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftGhast;
import org.bukkit.entity.Ghast;
import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityGhast;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityGhast;
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 GhastController extends MobEntityController {
public GhastController() {
@ -45,35 +46,24 @@ public class GhastController extends MobEntityController {
}
@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;
}
@Override
protected String bo() {
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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -86,21 +76,6 @@ public class GhastController extends MobEntityController {
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
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
@ -134,6 +109,12 @@ public class GhastController extends MobEntityController {
// 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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -147,9 +128,31 @@ public class GhastController 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 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) {
npc.update();
}
super.M();
}
}

View File

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

View File

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

View File

@ -2,9 +2,9 @@ package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftHorse;
import org.bukkit.entity.Horse;
import org.bukkit.util.Vector;
@ -17,11 +17,12 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityHorse;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityHorse;
import net.minecraft.server.v1_9_R1.IBlockData;
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 HorseController extends MobEntityController {
public HorseController() {
@ -67,37 +68,26 @@ public class HorseController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
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
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
public boolean dd() {
if (npc == null)
return super.dd();
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
return super.dd() && !protectedDefault;
}
@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
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -198,18 +177,42 @@ public class HorseController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
if (npc == null) {
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.ChatColor;
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.Player;
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.SkinnableEntity;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.PlayerInteractManager;
import net.minecraft.server.v1_8_R3.WorldServer;
import net.minecraft.server.v1_9_R1.PlayerInteractManager;
import net.minecraft.server.v1_9_R1.WorldServer;
public class HumanController extends AbstractEntityController {
public HumanController() {

View File

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

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMagmaCube;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMagmaCube;
import org.bukkit.entity.MagmaCube;
import org.bukkit.util.Vector;
@ -16,11 +16,12 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityMagmaCube;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityMagmaCube;
import net.minecraft.server.v1_9_R1.IBlockData;
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 MagmaCubeController extends MobEntityController {
public MagmaCubeController() {
@ -50,33 +51,22 @@ public class MagmaCubeController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 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
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
@ -87,7 +77,7 @@ public class MagmaCubeController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -100,13 +90,6 @@ public class MagmaCubeController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -114,13 +97,6 @@ public class MagmaCubeController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -176,9 +158,36 @@ public class MagmaCubeController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -192,12 +201,6 @@ public class MagmaCubeController extends MobEntityController {
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 {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMushroomCow;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMushroomCow;
import org.bukkit.entity.MushroomCow;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityMushroomCow;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityMushroomCow;
import net.minecraft.server.v1_9_R1.IBlockData;
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 MushroomCowController extends MobEntityController {
@ -59,37 +60,26 @@ public class MushroomCowController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -102,13 +92,6 @@ public class MushroomCowController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -116,13 +99,6 @@ public class MushroomCowController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -178,18 +160,39 @@ public class MushroomCowController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
super.M();
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftOcelot;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftOcelot;
import org.bukkit.entity.Ocelot;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityOcelot;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityOcelot;
import net.minecraft.server.v1_9_R1.IBlockData;
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 OcelotController extends MobEntityController {
public OcelotController() {
@ -58,37 +59,26 @@ public class OcelotController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -101,13 +91,6 @@ public class OcelotController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -115,13 +98,6 @@ public class OcelotController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -177,18 +159,39 @@ public class OcelotController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
super.M();
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPig;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPig;
import org.bukkit.entity.Pig;
import org.bukkit.util.Vector;
@ -15,12 +15,13 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityLightning;
import net.minecraft.server.v1_8_R3.EntityPig;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityLightning;
import net.minecraft.server.v1_9_R1.EntityPig;
import net.minecraft.server.v1_9_R1.IBlockData;
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 PigController extends MobEntityController {
public PigController() {
@ -59,37 +60,26 @@ public class PigController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -103,13 +93,6 @@ public class PigController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -117,13 +100,6 @@ public class PigController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -179,9 +161,36 @@ public class PigController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -193,12 +202,6 @@ public class PigController extends MobEntityController {
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 {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPigZombie;
import org.bukkit.entity.PigZombie;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityPigZombie;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityPigZombie;
import net.minecraft.server.v1_9_R1.IBlockData;
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 PigZombieController extends MobEntityController {
@ -48,37 +49,26 @@ public class PigZombieController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -91,13 +81,6 @@ public class PigZombieController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -105,13 +88,6 @@ public class PigZombieController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -168,18 +150,39 @@ public class PigZombieController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
super.M();
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftRabbit;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftRabbit;
import org.bukkit.entity.Rabbit;
import org.bukkit.util.Vector;
@ -15,12 +15,13 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityRabbit;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_9_R1.EntityRabbit;
import net.minecraft.server.v1_9_R1.IBlockData;
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 RabbitController extends MobEntityController {
public RabbitController() {
@ -59,37 +60,26 @@ public class RabbitController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -103,13 +93,6 @@ public class RabbitController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -117,16 +100,6 @@ public class RabbitController extends MobEntityController {
}
}
@Override
public void E() {
if (npc != null) {
super.E();
npc.update();
} else {
super.E();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -187,9 +166,39 @@ public class RabbitController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -198,17 +207,13 @@ public class RabbitController extends MobEntityController {
@Override
public void setRabbitType(int i) {
if (npc != null) {
this.datawatcher.watch(18, (byte) i);
if (NMS.getRabbitTypeField() == null)
return;
this.datawatcher.set(NMS.getRabbitTypeField(), i);
return;
}
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 {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSheep;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSheep;
import org.bukkit.entity.Sheep;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntitySheep;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntitySheep;
import net.minecraft.server.v1_9_R1.IBlockData;
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 SheepController extends MobEntityController {
public SheepController() {
@ -58,37 +59,26 @@ public class SheepController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -101,13 +91,6 @@ public class SheepController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -115,13 +98,6 @@ public class SheepController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -177,18 +159,39 @@ public class SheepController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
super.M();
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSilverfish;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSilverfish;
import org.bukkit.entity.Silverfish;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntitySilverfish;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntitySilverfish;
import net.minecraft.server.v1_9_R1.IBlockData;
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 SilverfishController extends MobEntityController {
public SilverfishController() {
@ -47,37 +48,26 @@ public class SilverfishController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,13 +80,6 @@ public class SilverfishController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -104,13 +87,6 @@ public class SilverfishController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null)
npc.update();
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -166,9 +148,36 @@ public class SilverfishController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -182,12 +191,6 @@ public class SilverfishController extends MobEntityController {
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 {

View File

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

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSlime;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSlime;
import org.bukkit.entity.Slime;
import org.bukkit.util.Vector;
@ -16,12 +16,13 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntitySlime;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_9_R1.EntitySlime;
import net.minecraft.server.v1_9_R1.IBlockData;
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 SlimeController extends MobEntityController {
@ -52,33 +53,22 @@ public class SlimeController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 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
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
@ -89,7 +79,7 @@ public class SlimeController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -110,13 +100,6 @@ public class SlimeController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -124,14 +107,6 @@ public class SlimeController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -187,9 +168,37 @@ public class SlimeController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
@ -203,12 +212,6 @@ public class SlimeController extends MobEntityController {
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 {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWither;
import org.bukkit.entity.Wither;
import org.bukkit.util.Vector;
@ -15,9 +15,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityWither;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityWither;
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 WitherController extends MobEntityController {
public WitherController() {
@ -45,30 +46,19 @@ public class WitherController extends MobEntityController {
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -81,21 +71,6 @@ public class WitherController extends MobEntityController {
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
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
@ -129,6 +104,12 @@ public class WitherController extends MobEntityController {
// 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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -142,14 +123,36 @@ public class WitherController extends MobEntityController {
}
@Override
public int s(int i) {
return npc == null ? super.s(i) : 0;
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 String z() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z());
protected void L() {
if (npc == null) {
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWolf;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWolf;
import org.bukkit.entity.Wolf;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityWolf;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityWolf;
import net.minecraft.server.v1_9_R1.IBlockData;
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 WolfController extends MobEntityController {
public WolfController() {
@ -58,37 +59,26 @@ public class WolfController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -102,13 +92,6 @@ public class WolfController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -116,14 +99,6 @@ public class WolfController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -179,19 +160,42 @@ public class WolfController extends MobEntityController {
}
@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()) {
return super.k_();
return super.n_();
} else {
return false;
}
}
@Override
protected String z() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z()
: npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.z());
}
}
public static class WolfNPC extends CraftWolf implements NPCHolder {

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftZombie;
import org.bukkit.entity.Zombie;
import org.bukkit.util.Vector;
@ -15,11 +15,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityZombie;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.EntityZombie;
import net.minecraft.server.v1_9_R1.IBlockData;
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 ZombieController extends MobEntityController {
public ZombieController() {
@ -47,37 +48,26 @@ public class ZombieController extends MobEntityController {
}
@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()) {
super.a(d0, flag, block, blockposition);
}
}
@Override
protected String bo() {
return npc == null ? super.bo() : npc.data().get(NPC.HURT_SOUND_METADATA, super.bo());
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 String bp() {
return npc == null ? super.bp() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.bp());
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 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) {
public void collide(net.minecraft.server.v1_9_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,13 +80,6 @@ public class ZombieController extends MobEntityController {
return npc == null ? super.d(save) : false;
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
@Override
public void e(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
@ -104,14 +87,6 @@ public class ZombieController extends MobEntityController {
}
}
@Override
public void E() {
super.E();
if (npc != null) {
npc.update();
}
}
@Override
public void enderTeleportTo(double d0, double d1, double d2) {
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
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
@ -167,18 +148,40 @@ public class ZombieController extends MobEntityController {
}
@Override
public boolean k_() {
if (npc == null || !npc.isFlyable()) {
return super.k_();
} else {
return false;
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
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 void M() {
super.M();
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArmorStand;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftArmorStand;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEntityEvent;
@ -16,11 +16,14 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.Vec3D;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityArmorStand;
import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_9_R1.EnumHand;
import net.minecraft.server.v1_9_R1.EnumInteractionResult;
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 ArmorStandController() {
@ -59,18 +62,18 @@ public class ArmorStandController extends MobEntityController {
}
@Override
public boolean a(EntityHuman entityhuman, Vec3D vec3d) {
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
if (npc == null) {
return super.a(entityhuman, vec3d);
return super.a(entityhuman, vec3d, itemstack, enumhand);
}
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
getBukkitEntity());
Bukkit.getPluginManager().callEvent(event);
return !event.isCancelled();
return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -119,6 +122,14 @@ public class ArmorStandController extends MobEntityController {
return npc;
}
@Override
public void m() {
super.m();
if (npc != null) {
npc.update();
}
}
@Override
public void setSize(float f, float f1) {
if (npc == null) {
@ -127,13 +138,5 @@ public class ArmorStandController extends MobEntityController {
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;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftBoat;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftBoat;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Boat;
import org.bukkit.util.Vector;
@ -14,9 +14,9 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityBoat;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityBoat;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class BoatController extends MobEntityController {
public BoatController() {
@ -55,7 +55,7 @@ public class BoatController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -114,11 +114,11 @@ public class BoatController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEgg;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_8_R3.WorldServer;
import net.minecraft.server.v1_9_R1.EntityEgg;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import net.minecraft.server.v1_9_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEgg;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEgg;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -75,7 +75,7 @@ public class EggController extends AbstractEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -120,14 +120,14 @@ public class EggController extends AbstractEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_();
super.m();
}
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderCrystal;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityEnderCrystal;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderCrystal;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderCrystal;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.util.Vector;
@ -59,7 +59,7 @@ public class EnderCrystalController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -104,11 +104,11 @@ public class EnderCrystalController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}
}

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderPearl;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderPearl;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderPearl;
import org.bukkit.util.Vector;
@ -13,9 +13,9 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderPearl;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityEnderPearl;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class EnderPearlController extends MobEntityController {
public EnderPearlController() {
@ -54,7 +54,7 @@ public class EnderPearlController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -104,14 +104,14 @@ public class EnderPearlController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_();
super.m();
}
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityEnderSignal;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityEnderSignal;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderSignal;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEnderSignal;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.entity.EnderSignal;
import org.bukkit.util.Vector;
@ -59,7 +59,7 @@ public class EnderSignalController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -104,11 +104,11 @@ public class EnderSignalController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityExperienceOrb;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityExperienceOrb;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftExperienceOrb;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftExperienceOrb;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.util.Vector;
@ -40,7 +40,7 @@ public class ExperienceOrbController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class ExperienceOrbController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}
}

View File

@ -3,11 +3,11 @@ package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftFallingSand;
import org.bukkit.craftbukkit.v1_9_R1.util.CraftMagicNumbers;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.util.Vector;
@ -19,13 +19,13 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.EntityFallingBlock;
import net.minecraft.server.v1_8_R3.IBlockData;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_8_R3.WorldServer;
import net.minecraft.server.v1_9_R1.Block;
import net.minecraft.server.v1_9_R1.Blocks;
import net.minecraft.server.v1_9_R1.EntityFallingBlock;
import net.minecraft.server.v1_9_R1.IBlockData;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import net.minecraft.server.v1_9_R1.WorldServer;
public class FallingBlockController extends AbstractEntityController {
public FallingBlockController() {
@ -69,7 +69,7 @@ public class FallingBlockController extends AbstractEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -128,7 +128,7 @@ public class FallingBlockController extends AbstractEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
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);
}
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityFireworks;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityFireworks;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFirework;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftFirework;
import org.bukkit.entity.Firework;
import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class FireworkController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class FireworkController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityFishingHook;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityFishingHook;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFish;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftFish;
import org.bukkit.entity.Fish;
import org.bukkit.util.Vector;
@ -40,7 +40,7 @@ public class FishingHookController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class FishingHookController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityItem;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_8_R3.WorldServer;
import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_9_R1.EntityItem;
import net.minecraft.server.v1_9_R1.ItemStack;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import net.minecraft.server.v1_9_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftItem;
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.util.Vector;
@ -62,7 +62,7 @@ public class ItemController extends AbstractEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -119,11 +119,11 @@ public class ItemController extends AbstractEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}
}

View File

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

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftLargeFireball;
import org.bukkit.entity.LargeFireball;
import org.bukkit.util.Vector;
@ -14,9 +14,9 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityLargeFireball;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityLargeFireball;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class LargeFireballController extends MobEntityController {
public LargeFireballController() {
@ -41,7 +41,7 @@ public class LargeFireballController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -100,14 +100,14 @@ public class LargeFireballController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_();
super.m();
}
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityLeash;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityLeash;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLeash;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftLeash;
import org.bukkit.entity.LeashHitch;
import org.bukkit.util.Vector;
@ -40,7 +40,7 @@ public class LeashController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class LeashController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}

View File

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

View File

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

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartFurnace;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMinecartFurnace;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@ -14,10 +14,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartFurnace;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.EntityMinecartFurnace;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class MinecartFurnaceController extends MobEntityController {
public MinecartFurnaceController() {
@ -42,7 +42,7 @@ public class MinecartFurnaceController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -99,12 +99,12 @@ public class MinecartFurnaceController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} 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.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartHopper;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.EntityMinecartHopper;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class MinecartHopperController extends MobEntityController {
public MinecartHopperController() {
@ -38,7 +38,7 @@ public class MinecartHopperController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -87,12 +87,12 @@ public class MinecartHopperController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} else {
super.t_();
super.m();
}
}
}

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartRideable;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftMinecartRideable;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@ -14,10 +14,10 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartRideable;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.EntityMinecartRideable;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class MinecartRideableController extends MobEntityController {
public MinecartRideableController() {
@ -42,7 +42,7 @@ public class MinecartRideableController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -99,12 +99,12 @@ public class MinecartRideableController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} 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.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartMobSpawner;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.EntityMinecartMobSpawner;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class MinecartSpawnerController extends MobEntityController {
public MinecartSpawnerController() {
@ -38,7 +38,7 @@ public class MinecartSpawnerController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -87,12 +87,12 @@ public class MinecartSpawnerController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} 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.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EntityMinecartTNT;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.EntityMinecartTNT;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class MinecartTNTController extends MobEntityController {
public MinecartTNTController() {
@ -38,7 +38,7 @@ public class MinecartTNTController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -87,12 +87,12 @@ public class MinecartTNTController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
NMS.minecartItemLogic(this);
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityPainting;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityPainting;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPainting;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPainting;
import org.bukkit.entity.Painting;
import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class PaintingController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class PaintingController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSmallFireball;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSmallFireball;
import org.bukkit.entity.SmallFireball;
import org.bukkit.util.Vector;
@ -13,9 +13,9 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntitySmallFireball;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntitySmallFireball;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class SmallFireballController extends MobEntityController {
public SmallFireballController() {
@ -40,7 +40,7 @@ public class SmallFireballController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,14 +90,14 @@ public class SmallFireballController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_();
super.m();
}
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntitySnowball;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntitySnowball;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowball;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftSnowball;
import org.bukkit.entity.Snowball;
import org.bukkit.util.Vector;
@ -59,7 +59,7 @@ public class SnowballController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -104,11 +104,11 @@ public class SnowballController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityTNTPrimed;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityTNTPrimed;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftTNTPrimed;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftTNTPrimed;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class TNTPrimedController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class TNTPrimedController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}
}

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.npc.entity.nonliving;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftThrownExpBottle;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftThrownExpBottle;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.util.Vector;
@ -13,9 +13,9 @@ import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityThrownExpBottle;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityThrownExpBottle;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
public class ThrownExpBottleController extends MobEntityController {
public ThrownExpBottleController() {
@ -40,7 +40,7 @@ public class ThrownExpBottleController extends MobEntityController {
}
@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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,14 +90,14 @@ public class ThrownExpBottleController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
super.t_();
super.m();
}
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityPotion;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityPotion;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftThrownPotion;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftThrownPotion;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class ThrownPotionController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class ThrownPotionController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}
}

View File

@ -1,25 +1,25 @@
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.npc.NPC;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityArrow;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityTippedArrow;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow;
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);
public class TippedArrowController extends MobEntityController {
public TippedArrowController() {
super(EntityTippedArrowNPC.class);
}
@Override
@ -27,10 +27,10 @@ public class ArrowController extends MobEntityController {
return (Arrow) super.getBukkitEntity();
}
public static class ArrowNPC extends CraftArrow implements NPCHolder {
public static class TippedArrowNPC extends CraftArrow implements NPCHolder {
private final CitizensNPC npc;
public ArrowNPC(EntityArrowNPC entity) {
public TippedArrowNPC(EntityTippedArrowNPC entity) {
super((CraftServer) Bukkit.getServer(), entity);
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;
public EntityArrowNPC(World world) {
public EntityTippedArrowNPC(World world) {
this(world, null);
}
@Override
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
}
public EntityArrowNPC(World world, NPC npc) {
public EntityTippedArrowNPC(World world, NPC npc) {
super(world);
this.npc = (CitizensNPC) npc;
}
@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
// it will not stop the NPC from moving.
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
public void g(double x, double y, double z) {
if (npc == null) {
@ -93,7 +93,7 @@ public class ArrowController extends MobEntityController {
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null) {
bukkitEntity = new ArrowNPC(this);
bukkitEntity = new TippedArrowNPC(this);
}
return super.getBukkitEntity();
}
@ -104,11 +104,11 @@ public class ArrowController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} 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.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.EntityWitherSkull;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.EntityWitherSkull;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWitherSkull;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftWitherSkull;
import org.bukkit.entity.WitherSkull;
import org.bukkit.util.Vector;
@ -45,7 +45,7 @@ public class WitherSkullController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_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
// it will not stop the NPC from moving.
super.collide(entity);
@ -90,11 +90,11 @@ public class WitherSkullController extends MobEntityController {
}
@Override
public void t_() {
public void m() {
if (npc != null) {
npc.update();
} else {
super.t_();
super.m();
}
}
}

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
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 net.citizensnpcs.api.persistence.Persist;

View File

@ -1,12 +1,12 @@
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 net.citizensnpcs.api.persistence.Persist;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.TraitName;
import net.minecraft.server.v1_8_R3.EntityWither;
import net.minecraft.server.v1_9_R1.EntityWither;
@TraitName("withertrait")
public class WitherTrait extends Trait {
@ -30,7 +30,7 @@ public class WitherTrait extends Trait {
if (npc.getEntity() instanceof Wither) {
Wither wither = (Wither) npc.getEntity();
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;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EntityEnderSignal;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.EntityEnderSignal;
import net.minecraft.server.v1_9_R1.World;
public class EntityEnderSignalMarker extends EntityEnderSignal {
public EntityEnderSignalMarker(World world) {
@ -19,10 +19,10 @@ public class EntityEnderSignalMarker extends EntityEnderSignal {
}
@Override
public void h() {
public void i() {
}
@Override
public void t_() {
public void m() {
}
}

View File

@ -20,11 +20,11 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftSound;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.CraftSound;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
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.skin.SkinnableEntity;
import net.citizensnpcs.util.nms.PlayerlistTrackerEntry;
import net.minecraft.server.v1_8_R3.AttributeInstance;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.ControllerJump;
import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EnchantmentManager;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityHorse;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityMinecartAbstract;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTameableAnimal;
import net.minecraft.server.v1_8_R3.EntityTracker;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.EntityTypes;
import net.minecraft.server.v1_8_R3.GenericAttributes;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_8_R3.NetworkManager;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_8_R3.WorldServer;
import net.minecraft.server.v1_9_R1.AttributeInstance;
import net.minecraft.server.v1_9_R1.AxisAlignedBB;
import net.minecraft.server.v1_9_R1.Block;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.ControllerJump;
import net.minecraft.server.v1_9_R1.DamageSource;
import net.minecraft.server.v1_9_R1.DataWatcherObject;
import net.minecraft.server.v1_9_R1.EnchantmentManager;
import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_9_R1.EntityHorse;
import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_9_R1.EntityInsentient;
import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_9_R1.EntityMinecartAbstract;
import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_9_R1.EntityRabbit;
import net.minecraft.server.v1_9_R1.EntityTameableAnimal;
import net.minecraft.server.v1_9_R1.EntityTracker;
import net.minecraft.server.v1_9_R1.EntityTrackerEntry;
import net.minecraft.server.v1_9_R1.EntityTypes;
import net.minecraft.server.v1_9_R1.GenericAttributes;
import net.minecraft.server.v1_9_R1.MathHelper;
import net.minecraft.server.v1_9_R1.MobEffects;
import net.minecraft.server.v1_9_R1.NavigationAbstract;
import net.minecraft.server.v1_9_R1.NetworkManager;
import net.minecraft.server.v1_9_R1.Packet;
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")
public class NMS {
@ -116,7 +120,7 @@ public class NMS {
int i = 0;
if (target instanceof EntityLiving) {
f += EnchantmentManager.a(handle.bA(), ((EntityLiving) target).getMonsterType());
f += EnchantmentManager.a(handle.getItemInMainHand(), ((EntityLiving) target).getMonsterType());
i += EnchantmentManager.a(handle);
}
@ -175,7 +179,7 @@ public class NMS {
if (Bukkit.isPrimaryThread())
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)
.getAuthenticationService();
@ -198,12 +202,12 @@ public class NMS {
}
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
if (entity.bM()) {
if (entity.V()) {
if (entity.co() || entity.bx()) {
if (entity.isInWater()) {
double d0 = entity.locY;
float f3 = 0.8F;
float f4 = 0.02F;
float f2 = EnchantmentManager.b(entity);
float f2 = EnchantmentManager.d(entity);
if (f2 > 3.0F) {
f2 = 3.0F;
}
@ -214,7 +218,7 @@ public class NMS {
if (f2 > 0.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);
@ -226,7 +230,7 @@ public class NMS {
if ((entity.positionChanged)
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d0, entity.motZ)))
entity.motY = 0.300000011920929D;
} else if (entity.ab()) {
} else if (entity.an()) {
double d0 = entity.locY;
entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ);
@ -237,74 +241,113 @@ public class NMS {
if ((entity.positionChanged)
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d0, entity.motZ)))
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 {
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) {
f5 = entity.world
.getType(new BlockPosition(MathHelper.floor(entity.locX),
MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ)))
.getBlock().frictionFactor * 0.91F;
f8 = entity.world.getType(blockposition_pooledblockposition).getBlock().frictionFactor * 0.91F;
}
float f6 = 0.1627714F / (f5 * f5 * f5);
float f4 = 0.16277136F / (f8 * f8 * f8);
float f3;
if (entity.onGround)
f3 = entity.bI() * f6;
else {
f3 = entity.aM;
}
entity.a(f, f1, f3);
f5 = 0.91F;
if (entity.onGround) {
f5 = entity.world
.getType(new BlockPosition(MathHelper.floor(entity.locX),
MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ)))
.getBlock().frictionFactor * 0.91F;
f3 = entity.ck() * f4;
} else {
f3 = entity.aQ;
}
if (entity.k_()) {
float f4 = 0.15F;
entity.motX = MathHelper.a(entity.motX, -f4, f4);
entity.motZ = MathHelper.a(entity.motZ, -f4, f4);
entity.a(f, f1, f3);
f8 = 0.91F;
if (entity.onGround) {
f8 = entity.world.getType(blockposition_pooledblockposition.d(entity.locX,
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;
if (entity.motY < -0.15D) {
entity.motY = -0.15D;
}
boolean flag = (entity.isSneaking()) && ((entity instanceof EntityHuman));
if ((flag) && (entity.motY < 0.0D)) {
entity.motY = 0.0D;
}
}
entity.move(entity.motX, entity.motY, entity.motZ);
if ((entity.positionChanged) && (entity.k_())) {
if ((entity.positionChanged) && (entity.n_())) {
entity.motY = 0.2D;
}
if ((entity.world.isClientSide) && ((!entity.world
.isLoaded(new BlockPosition((int) entity.locX, 0, (int) entity.locZ)))
|| (!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;
if (entity.hasEffect(MobEffects.LEVITATION)) {
entity.motY += (0.05D * (entity.getEffect(MobEffects.LEVITATION).getAmplifier() + 1) - entity.motY)
* 0.2D;
} 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.motX *= f5;
entity.motZ *= f5;
entity.motX *= f8;
entity.motZ *= f8;
blockposition_pooledblockposition.t();
}
}
entity.aA = entity.aB;
entity.aE = entity.aF;
double d0 = entity.locX - entity.lastX;
double d1 = entity.locZ - entity.lastZ;
@ -313,8 +356,8 @@ public class NMS {
f2 = 1.0F;
}
entity.aB += (f2 - entity.aB) * 0.4F;
entity.aC += entity.aB;
entity.aF += (f2 - entity.aF) * 0.4F;
entity.aG += entity.aF;
}
@SuppressWarnings("deprecation")
@ -358,7 +401,7 @@ public class NMS {
}
public static float getHeadYaw(EntityLiving handle) {
return handle.aK;
return handle.aO;
}
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
public static SkinnableEntity getSkinnable(org.bukkit.entity.Entity entity) {
Preconditions.checkNotNull(entity);
@ -416,14 +472,14 @@ public class NMS {
}
public static float getStepHeight(LivingEntity entity) {
return NMS.getHandle(entity).S;
return NMS.getHandle(entity).P;
}
public static void initNetworkManager(NetworkManager network) {
if (NETWORK_CHANNEL == null || NETWORK_ADDRESS == null)
if (NETWORK_ADDRESS == null)
return;
try {
NETWORK_CHANNEL.set(network, new EmptyChannel(null));
network.channel = new EmptyChannel(null);
NETWORK_ADDRESS.set(network, new SocketAddress() {
private static final long serialVersionUID = 8207338859896320185L;
});
@ -438,11 +494,11 @@ public class NMS {
Entity mcEntity = getHandle(entity);
if (mcEntity == null)
return false;
return mcEntity.W() || mcEntity.ab();
return mcEntity.aj() || mcEntity.an();
}
public static boolean isNavigationFinished(NavigationAbstract navigation) {
return navigation.m();
return navigation.n();
}
public static void loadPlugins() {
@ -451,7 +507,7 @@ public class NMS {
public static void look(Entity handle, Entity target) {
if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).bQ());
((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).N());
} else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setTargetLook(target, 10F, 40F);
}
@ -479,7 +535,7 @@ public class NMS {
if (mat != null) {
minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(data));
}
minecart.SetDisplayBlockOffset(offset);
minecart.setDisplayBlockOffset(offset);
}
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) {
if (NMS.getHandle(passenger) == null)
return;
NMS.getHandle(passenger).mount(NMS.getHandle(entity));
NMS.getHandle(passenger).startRiding(NMS.getHandle(entity));
}
public static void openHorseScreen(Horse horse, Player equipper) {
@ -647,10 +703,10 @@ public class NMS {
return;
EntityLiving handle = (EntityLiving) en;
yaw = clampYaw(yaw);
handle.aK = yaw;
handle.aO = yaw;
if (!(handle instanceof EntityHuman))
handle.aI = yaw;
handle.aL = yaw;
handle.aM = yaw;
handle.aP = yaw;
}
public static void setProfile(SkullMeta meta, GameProfile profile) {
@ -699,17 +755,17 @@ public class NMS {
}
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) {
if (!bukkitEntity.getType().isAlive())
return;
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))
return false;
try {
@ -811,17 +867,18 @@ public class NMS {
}
private static final float DEFAULT_SPEED = 1F;
private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT;
private static Map<Class<?>, String> ENTITY_CLASS_TO_NAME;
private static final Map<Class<?>, Constructor<?>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>();
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 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_CHANNEL = getField(NetworkManager.class, "channel");
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 Field SKULL_PROFILE_FIELD;

View File

@ -2,20 +2,20 @@ package net.citizensnpcs.util;
import java.util.Arrays;
import net.citizensnpcs.api.CitizensAPI;
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.craftbukkit.v1_9_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
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 {
ARM_SWING {
@Override
@ -64,8 +64,8 @@ public enum PlayerAnimation {
cancel();
return;
}
if (player.passenger != player) {
player.mount(player);
if (!player.passengers.contains(player)) {
NMS.mount(player.getBukkitEntity(), player.getBukkitEntity());
}
}
}.runTaskTimer(CitizensAPI.getPlugin(), 0, 1);
@ -100,7 +100,7 @@ public enum PlayerAnimation {
protected void playAnimation(EntityPlayer player, int radius) {
player.getBukkitEntity().setMetadata("citizens.sitting",
new FixedMetadataValue(CitizensAPI.getPlugin(), false));
player.mount(null);
NMS.mount(player.getBukkitEntity(), null);
}
},
STOP_SLEEPING {

View File

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

View File

@ -1,9 +1,9 @@
package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_9_R1.Entity;
import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_9_R1.MathHelper;
public class PlayerControllerLook {
private final EntityHumanNPC a;
@ -22,29 +22,27 @@ public class PlayerControllerLook {
this.a.pitch = 0.0F;
if (this.d) {
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;
float f1 = (float) (-(MathHelper.b(d1, d3) * 180.0D / 3.141592741012573D));
double d1 = this.e - this.a.locX;
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);
this.a.aK = a(this.a.aK, f, this.b);
float f1 = (float) (MathHelper.b(d3, d1) * 57.2957763671875D) - 90.0F;
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 {
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 f2 = MathHelper.g(this.a.aK - this.a.aI);
if (!this.a.getNavigation().m()) {
if (f2 < -75.0F) {
this.a.aK = (this.a.aI - 75.0F);
float f3 = MathHelper.g(this.a.aO - this.a.aM);
if (!this.a.getNavigation().n()) {
if (f3 < -75.0F) {
this.a.aO = (this.a.aM - 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.util.NMS;
import net.minecraft.server.v1_8_R3.AttributeInstance;
import net.minecraft.server.v1_8_R3.ControllerMove;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntitySlime;
import net.minecraft.server.v1_8_R3.GenericAttributes;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_9_R1.AttributeInstance;
import net.minecraft.server.v1_9_R1.ControllerMove;
import net.minecraft.server.v1_9_R1.EntityInsentient;
import net.minecraft.server.v1_9_R1.EntityLiving;
import net.minecraft.server.v1_9_R1.EntitySlime;
import net.minecraft.server.v1_9_R1.GenericAttributes;
import net.minecraft.server.v1_9_R1.MathHelper;
public class PlayerControllerMove extends ControllerMove {
protected EntityLiving a;
@ -74,7 +74,7 @@ public class PlayerControllerMove extends ControllerMove {
@Override
public void c() {
this.a.ba = 0F;
this.a.be = 0F;
if (this.f) {
this.f = false;
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);
speed.setValue(0.1D * this.e);
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))) {
this.h = cg();
this.h /= 3;

View File

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

View File

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