mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-27 19:47:51 +01:00
Initial untested 1.7.2 update
This commit is contained in:
parent
e25df6cd47
commit
38cec9d3f3
6
pom.xml
6
pom.xml
@ -6,13 +6,13 @@
|
||||
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizens</artifactId>
|
||||
<version>2.0.10-SNAPSHOT</version>
|
||||
<version>2.0.11-SNAPSHOT</version>
|
||||
<name>Citizens</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<craftbukkit.version>LATEST</craftbukkit.version>
|
||||
<citizensapi.version>2.0.10-SNAPSHOT</citizensapi.version>
|
||||
<craftbukkit.version>1.7.2-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
<citizensapi.version>2.0.11-SNAPSHOT</citizensapi.version>
|
||||
<vault.version>1.2.19-SNAPSHOT</vault.version>
|
||||
<powermock.version>1.4.12</powermock.version>
|
||||
<build.number>Unknown</build.number>
|
||||
|
@ -408,8 +408,9 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
public void storeNPCs() {
|
||||
if (saves == null)
|
||||
return;
|
||||
for (NPC npc : npcRegistry)
|
||||
for (NPC npc : npcRegistry) {
|
||||
saves.store(npc);
|
||||
}
|
||||
}
|
||||
|
||||
public void storeNPCs(CommandContext args) {
|
||||
@ -431,5 +432,5 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final String COMPATIBLE_MC_VERSION = "1.6.4";
|
||||
private static final String COMPATIBLE_MC_VERSION = "1.7.2";
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ 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_6_R3.Packet34EntityTeleport;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -159,7 +159,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
|
||||
at = at.clone();
|
||||
entityController.spawn(at, this);
|
||||
net.minecraft.server.v1_6_R3.Entity mcEntity = ((CraftEntity) getEntity()).getHandle();
|
||||
net.minecraft.server.v1_7_R1.Entity mcEntity = ((CraftEntity) getEntity()).getHandle();
|
||||
boolean couldSpawn = !Util.isLoaded(at) ? false : mcEntity.world.addEntity(mcEntity, SpawnReason.CUSTOM);
|
||||
mcEntity.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
|
||||
if (!couldSpawn) {
|
||||
@ -218,7 +218,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
if (++packetUpdateCount > 30) {
|
||||
if (!getNavigator().isNavigating()) {
|
||||
NMS.sendPacketNearby(getStoredLocation(),
|
||||
new Packet34EntityTeleport(NMS.getHandle(getEntity())));
|
||||
new PacketPlayOutEntityTeleport(NMS.getHandle(getEntity())));
|
||||
}
|
||||
packetUpdateCount = 0;
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import java.util.Map;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
@ -24,7 +24,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
||||
|
||||
@Override
|
||||
protected Entity createEntity(Location at, NPC npc) {
|
||||
net.minecraft.server.v1_6_R3.Entity entity = createEntityFromClass(((CraftWorld) at.getWorld()).getHandle(),
|
||||
net.minecraft.server.v1_7_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_6_R3.Entity createEntityFromClass(Object... args) {
|
||||
private net.minecraft.server.v1_7_R1.Entity createEntityFromClass(Object... args) {
|
||||
try {
|
||||
return (net.minecraft.server.v1_6_R3.Entity) constructor.newInstance(args);
|
||||
return (net.minecraft.server.v1_7_R1.Entity) constructor.newInstance(args);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
|
@ -61,7 +61,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||
}
|
||||
vector = plan.getCurrentVector();
|
||||
}
|
||||
net.minecraft.server.v1_6_R3.Entity handle = NMS.getHandle(npc.getEntity());
|
||||
net.minecraft.server.v1_7_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;
|
||||
|
@ -3,17 +3,18 @@ package net.citizensnpcs.npc.ai;
|
||||
import net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter;
|
||||
import net.citizensnpcs.api.ai.tree.BehaviorStatus;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.minecraft.server.v1_6_R3.Block;
|
||||
import net.minecraft.server.v1_6_R3.Enchantment;
|
||||
import net.minecraft.server.v1_6_R3.EnchantmentManager;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.ItemStack;
|
||||
import net.minecraft.server.v1_6_R3.Material;
|
||||
import net.minecraft.server.v1_6_R3.MobEffectList;
|
||||
import net.minecraft.server.v1_7_R1.Block;
|
||||
import net.minecraft.server.v1_7_R1.Blocks;
|
||||
import net.minecraft.server.v1_7_R1.Enchantment;
|
||||
import net.minecraft.server.v1_7_R1.EnchantmentManager;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.ItemStack;
|
||||
import net.minecraft.server.v1_7_R1.Material;
|
||||
import net.minecraft.server.v1_7_R1.MobEffectList;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -39,17 +40,17 @@ public class BlockBreaker extends BehaviorGoalAdapter {
|
||||
return Math.pow(entity.locX - x, 2) + Math.pow(entity.locY - y, 2) + Math.pow(entity.locZ - z, 2);
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_6_R3.ItemStack getCurrentItem() {
|
||||
private net.minecraft.server.v1_7_R1.ItemStack getCurrentItem() {
|
||||
return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) : entity.getEquipment(0);
|
||||
}
|
||||
|
||||
private float getStrength(Block block) {
|
||||
float base = block.l(null, 0, 0, 0);
|
||||
float base = block.f(null, 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) {
|
||||
if (block.material.isAlwaysDestroyable()) {
|
||||
if (block.getMaterial().isAlwaysDestroyable()) {
|
||||
return true;
|
||||
} else {
|
||||
ItemStack current = getCurrentItem();
|
||||
@ -83,7 +84,7 @@ public class BlockBreaker extends BehaviorGoalAdapter {
|
||||
}
|
||||
if (entity instanceof EntityPlayer)
|
||||
PlayerAnimation.ARM_SWING.play((Player) entity.getBukkitEntity());
|
||||
Block block = Block.byId[entity.world.getTypeId(x, y, z)];
|
||||
Block block = entity.world.getType(x, y, z);
|
||||
if (block == null) {
|
||||
return BehaviorStatus.SUCCESS;
|
||||
} else {
|
||||
@ -104,12 +105,12 @@ public class BlockBreaker extends BehaviorGoalAdapter {
|
||||
}
|
||||
|
||||
private void setBlockDamage(int modifiedDamage) {
|
||||
entity.world.f(entity.id, x, y, z, modifiedDamage);
|
||||
entity.world.d(entity.getId(), x, y, z, modifiedDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute() {
|
||||
return entity.world.getTypeId(x, y, z) > 0;
|
||||
return entity.world.getType(x, y, z) != Blocks.AIR;
|
||||
}
|
||||
|
||||
private float strengthMod(Block block) {
|
||||
|
@ -11,7 +11,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_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
@ -5,11 +5,11 @@ 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_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
|
||||
public class MCNavigationStrategy extends AbstractPathStrategy {
|
||||
private final Navigation navigation;
|
||||
|
@ -12,16 +12,16 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.PlayerAnimation;
|
||||
import net.citizensnpcs.util.nms.PlayerNavigation;
|
||||
import net.minecraft.server.v1_6_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R3.Entity;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_6_R3.PathEntity;
|
||||
import net.minecraft.server.v1_7_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.PathEntity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
|
@ -7,13 +7,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_6_R3.EntityBat;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityBat;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftBat;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftBat;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Bat;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -58,23 +58,23 @@ public class BatController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null) {
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
}
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
public void bn() {
|
||||
if (npc == null) {
|
||||
super.bi();
|
||||
super.bn();
|
||||
} else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -82,7 +82,7 @@ public class BatController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -125,8 +125,8 @@ public class BatController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void l_() {
|
||||
super.l_();
|
||||
public void h() {
|
||||
super.h();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityBlaze;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityBlaze;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftBlaze;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftBlaze;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Blaze;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,30 +57,30 @@ public class BlazeController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc != null) {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
} else {
|
||||
super.bl();
|
||||
super.bq();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
|
@ -7,13 +7,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_6_R3.EntityCaveSpider;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityCaveSpider;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCaveSpider;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCaveSpider;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.CaveSpider;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -72,32 +72,32 @@ public class CaveSpiderController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null) {
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
}
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) {
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
}
|
||||
if (super.bH()) {
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null) {
|
||||
super.bl();
|
||||
super.bq();
|
||||
} else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -105,7 +105,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,15 +114,6 @@ public class CaveSpiderController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -165,5 +156,14 @@ public class CaveSpiderController extends MobEntityController {
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,13 +7,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_6_R3.EntityChicken;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityChicken;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftChicken;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftChicken;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -71,27 +71,27 @@ public class ChickenController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,15 +99,6 @@ public class ChickenController extends MobEntityController {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -150,5 +141,14 @@ public class ChickenController extends MobEntityController {
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,13 +7,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_6_R3.EntityCow;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityCow;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCow;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCow;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -72,28 +72,28 @@ public class CowController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,15 +102,6 @@ public class CowController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -153,5 +144,14 @@ public class CowController extends MobEntityController {
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreeper;
|
||||
import net.minecraft.server.v1_6_R3.EntityLightning;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityCreeper;
|
||||
import net.minecraft.server.v1_7_R1.EntityLightning;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreeper;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreeper;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -79,28 +79,28 @@ public class CreeperController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +109,9 @@ public class CreeperController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEnderDragon;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEnderDragon;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,27 +57,36 @@ public class EnderDragonController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null) {
|
||||
super.bl();
|
||||
super.bq();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e() {
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
if (motX != 0 || motY != 0 || motZ != 0) {
|
||||
@ -87,17 +96,9 @@ public class EnderDragonController extends MobEntityController {
|
||||
yaw = getCorrectYaw(locX + motX, locZ + motZ);
|
||||
setPosition(locX + motX, locY + motY, locZ + motZ);
|
||||
}
|
||||
} else
|
||||
super.c();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
} else {
|
||||
super.e();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,13 +7,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_6_R3.EntityEnderman;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityEnderman;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEnderman;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEnderman;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -72,29 +72,29 @@ public class EndermanController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null)
|
||||
super.bl();
|
||||
super.bq();
|
||||
else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -102,17 +102,7 @@ public class EndermanController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc == null)
|
||||
super.c();
|
||||
else {
|
||||
updateAIWithMovement();
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -121,11 +111,12 @@ public class EndermanController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
} else {
|
||||
return false;
|
||||
public void e() {
|
||||
if (npc == null)
|
||||
super.e();
|
||||
else {
|
||||
updateAIWithMovement();
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +164,16 @@ public class EndermanController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean j(double d1, double d2, double d3) {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean k(double d1, double d2, double d3) {
|
||||
if (npc == null) {
|
||||
return super.j(d1, d2, d3);
|
||||
}
|
||||
@ -189,7 +189,7 @@ public class EndermanController extends MobEntityController {
|
||||
motY += 0.04;
|
||||
} else //(handled elsewhere)*/
|
||||
if (onGround && jumpTicks == 0) {
|
||||
be();
|
||||
bj();
|
||||
jumpTicks = 10;
|
||||
}
|
||||
} else {
|
||||
|
@ -18,27 +18,27 @@ 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_6_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R3.Connection;
|
||||
import net.minecraft.server.v1_6_R3.Entity;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.EnumGamemode;
|
||||
import net.minecraft.server.v1_6_R3.GenericAttributes;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_6_R3.NetworkManager;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet201PlayerInfo;
|
||||
import net.minecraft.server.v1_6_R3.Packet35EntityHeadRotation;
|
||||
import net.minecraft.server.v1_6_R3.Packet5EntityEquipment;
|
||||
import net.minecraft.server.v1_6_R3.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.EnumGamemode;
|
||||
import net.minecraft.server.v1_7_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityHeadRotation;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_7_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_7_R1.WorldServer;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -55,9 +55,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
private int packetUpdateCount;
|
||||
private int useListName = -1;
|
||||
|
||||
public EntityHumanNPC(MinecraftServer minecraftServer, World world, String string,
|
||||
public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile,
|
||||
PlayerInteractManager playerInteractManager, NPC npc) {
|
||||
super(minecraftServer, world, string, playerInteractManager);
|
||||
super(minecraftServer, world, gameProfile, playerInteractManager);
|
||||
playerInteractManager.setGameMode(EnumGamemode.SURVIVAL);
|
||||
|
||||
this.npc = (CitizensNPC) npc;
|
||||
@ -81,7 +81,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,15 +90,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -150,48 +141,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
return npc;
|
||||
}
|
||||
|
||||
private void initialise(MinecraftServer minecraftServer) {
|
||||
Socket socket = new EmptySocket();
|
||||
NetworkManager conn = null;
|
||||
try {
|
||||
conn = new EmptyNetworkManager(minecraftServer.getLogger(), socket, "npc mgr", new Connection() {
|
||||
@Override
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
}, minecraftServer.H().getPrivate());
|
||||
playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
|
||||
conn.a(playerConnection);
|
||||
} catch (IOException e) {
|
||||
// swallow
|
||||
}
|
||||
|
||||
NMS.setStepHeight(this, 1);// stepHeight - must not stay as the default
|
||||
// 0 (breaks steps).
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException ex) {
|
||||
// swallow
|
||||
}
|
||||
AttributeInstance range = this.getAttributeInstance(GenericAttributes.b);
|
||||
if (range == null) {
|
||||
range = this.aX().b(GenericAttributes.b);
|
||||
}
|
||||
range.setValue(Setting.DEFAULT_PATHFINDING_RANGE.asDouble());
|
||||
controllerJump = new PlayerControllerJump(this);
|
||||
controllerLook = new PlayerControllerLook(this);
|
||||
controllerMove = new PlayerControllerMove(this);
|
||||
navigation = new PlayerNavigation(this, world);
|
||||
}
|
||||
|
||||
public boolean isNavigating() {
|
||||
return npc.getNavigator().isNavigating();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void l_() {
|
||||
super.l_();
|
||||
public void h() {
|
||||
super.h();
|
||||
if (npc == null)
|
||||
return;
|
||||
boolean navigating = npc.getNavigator().isNavigating();
|
||||
@ -203,7 +155,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
// (onGround is normally updated by the client)
|
||||
}
|
||||
if (!npc.data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean())) {
|
||||
h();
|
||||
// h(); TODO
|
||||
}
|
||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||
motX = motY = motZ = 0;
|
||||
@ -224,6 +176,50 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void initialise(MinecraftServer minecraftServer) {
|
||||
Socket socket = new EmptySocket();
|
||||
NetworkManager conn = null;
|
||||
try {
|
||||
conn = new EmptyNetworkManager(false);
|
||||
playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
|
||||
conn.a(playerConnection);
|
||||
} catch (IOException e) {
|
||||
// swallow
|
||||
}
|
||||
|
||||
NMS.setStepHeight(this, 1);// stepHeight - must not stay as the default
|
||||
// 0 (breaks steps).
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException ex) {
|
||||
// swallow
|
||||
}
|
||||
|
||||
AttributeInstance range = this.getAttributeInstance(GenericAttributes.b);
|
||||
if (range == null) {
|
||||
range = this.bc().b(GenericAttributes.b);
|
||||
}
|
||||
range.setValue(Setting.DEFAULT_PATHFINDING_RANGE.asDouble());
|
||||
controllerJump = new PlayerControllerJump(this);
|
||||
controllerLook = new PlayerControllerLook(this);
|
||||
controllerMove = new PlayerControllerMove(this);
|
||||
navigation = new PlayerNavigation(this, world);
|
||||
}
|
||||
|
||||
public boolean isNavigating() {
|
||||
return npc.getNavigator().isNavigating();
|
||||
}
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
NMS.updateAI(this);
|
||||
// taken from EntityLiving update method
|
||||
@ -233,7 +229,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
motY += 0.04;
|
||||
} else //(handled elsewhere)*/
|
||||
if (onGround && jumpTicks == 0) {
|
||||
be();
|
||||
bj();
|
||||
jumpTicks = 10;
|
||||
}
|
||||
} else {
|
||||
@ -250,7 +246,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoveDestination(double x, double y, double z, float speed) {
|
||||
public void setMoveDestination(double x, double y, double z, double speed) {
|
||||
controllerMove.a(x, y, z, speed);
|
||||
}
|
||||
|
||||
@ -273,11 +269,11 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
Location current = getBukkitEntity().getLocation(packetLocationCache);
|
||||
Packet[] packets = new Packet[navigating ? 6 : 7];
|
||||
if (!navigating) {
|
||||
packets[6] = new Packet35EntityHeadRotation(id,
|
||||
packets[6] = new PacketPlayOutEntityHeadRotation(this,
|
||||
(byte) MathHelper.d(NMS.getHeadYaw(this) * 256.0F / 360.0F));
|
||||
}
|
||||
for (int i = 0; i < 5; i++) {
|
||||
packets[i] = new Packet5EntityEquipment(id, i, getEquipment(i));
|
||||
packets[i] = new PacketPlayOutEntityEquipment(getId(), i, getEquipment(i));
|
||||
}
|
||||
boolean removeFromPlayerList = Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean();
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(),
|
||||
@ -285,7 +281,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
int useListName = removeFromPlayerList ? 0 : 1;
|
||||
if (useListName != this.useListName || this.useListName == -1) {
|
||||
this.useListName = useListName;
|
||||
packets[5] = new Packet201PlayerInfo(getBukkitEntity().getPlayerListName(), !removeFromPlayerList,
|
||||
packets[5] = new PacketPlayOutPlayerInfo(getBukkitEntity().getPlayerListName(), !removeFromPlayerList,
|
||||
removeFromPlayerList ? 9999 : ping);
|
||||
}
|
||||
NMS.sendPacketsNearby(current, packets);
|
||||
|
@ -7,13 +7,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_6_R3.EntityGhast;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityGhast;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftGhast;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftGhast;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -43,28 +43,28 @@ public class GhastController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
} else
|
||||
super.bl();
|
||||
super.bq();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
|
@ -7,13 +7,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_6_R3.EntityGiantZombie;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityGiantZombie;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftGiant;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftGiant;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,22 +57,22 @@ public class GiantController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null) {
|
||||
super.bl();
|
||||
super.bq();
|
||||
} else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -80,7 +80,7 @@ public class GiantController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -89,9 +89,9 @@ public class GiantController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ 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_6_R3.EntityHorse;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityHorse;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftHorse;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftHorse;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -67,31 +67,20 @@ public class HorseController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc == null) {
|
||||
super.c();
|
||||
} else {
|
||||
NMS.setStepHeight(this, 1);
|
||||
updateAIWithMovement();
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,11 +90,13 @@ public class HorseController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
public void e() {
|
||||
if (npc == null) {
|
||||
super.e();
|
||||
} else {
|
||||
return false;
|
||||
NMS.setStepHeight(this, 1);
|
||||
updateAIWithMovement();
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +143,15 @@ public class HorseController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAIWithMovement() {
|
||||
NMS.updateAI(this);
|
||||
// taken from EntityLiving update method
|
||||
@ -161,7 +161,7 @@ public class HorseController extends MobEntityController {
|
||||
motY += 0.04;
|
||||
} else //(handled elsewhere)*/
|
||||
if (onGround && jumpTicks == 0) {
|
||||
be();
|
||||
bj();
|
||||
jumpTicks = 10;
|
||||
}
|
||||
} else {
|
||||
|
@ -1,26 +1,29 @@
|
||||
package net.citizensnpcs.npc.entity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.Colorizer;
|
||||
import net.citizensnpcs.npc.AbstractEntityController;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_6_R3.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_7_R1.WorldServer;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class HumanController extends AbstractEntityController {
|
||||
@Override
|
||||
protected Entity createEntity(final Location at, final NPC npc) {
|
||||
World ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||
final EntityHumanNPC handle = new EntityHumanNPC(ws.getServer().getServer(), ws, Colorizer.parseColors(npc
|
||||
.getFullName()), new PlayerInteractManager(ws), npc);
|
||||
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||
final EntityHumanNPC handle = new EntityHumanNPC(ws.getServer().getServer(), ws, new GameProfile(UUID
|
||||
.randomUUID().toString(), Colorizer.parseColors(npc.getFullName())), new PlayerInteractManager(ws), npc);
|
||||
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
|
@ -7,13 +7,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_6_R3.EntityIronGolem;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityIronGolem;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftIronGolem;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftIronGolem;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,27 +57,27 @@ public class IronGolemController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +86,9 @@ public class IronGolemController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityMagmaCube;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityMagmaCube;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftMagmaCube;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftMagmaCube;
|
||||
import org.bukkit.entity.MagmaCube;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -58,29 +58,29 @@ public class MagmaCubeController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null)
|
||||
super.bl();
|
||||
super.bq();
|
||||
else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -88,7 +88,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -97,9 +97,9 @@ public class MagmaCubeController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityMushroomCow;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityMushroomCow;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftMushroomCow;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftMushroomCow;
|
||||
import org.bukkit.entity.MushroomCow;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -58,27 +58,27 @@ public class MushroomCowController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +87,9 @@ public class MushroomCowController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityOcelot;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityOcelot;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftOcelot;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftOcelot;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -58,27 +58,27 @@ public class OcelotController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +87,9 @@ public class OcelotController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_6_R3.EntityLightning;
|
||||
import net.minecraft.server.v1_6_R3.EntityPig;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityLightning;
|
||||
import net.minecraft.server.v1_7_R1.EntityPig;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPig;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPig;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -64,27 +64,27 @@ public class PigController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -93,9 +93,9 @@ public class PigController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityPigZombie;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityPigZombie;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPigZombie;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPigZombie;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -58,29 +58,29 @@ public class PigZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null) {
|
||||
super.bl();
|
||||
super.bq();
|
||||
} else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -88,7 +88,7 @@ public class PigZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -97,9 +97,9 @@ public class PigZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntitySheep;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntitySheep;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSheep;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSheep;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -58,27 +58,27 @@ public class SheepController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +87,9 @@ public class SheepController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntitySilverfish;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntitySilverfish;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSilverfish;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSilverfish;
|
||||
import org.bukkit.entity.Silverfish;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,29 +57,29 @@ public class SilverfishController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null) {
|
||||
super.bl();
|
||||
super.bq();
|
||||
} else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -87,7 +87,7 @@ public class SilverfishController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +96,9 @@ public class SilverfishController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntitySkeleton;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntitySkeleton;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSkeleton;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,27 +57,27 @@ public class SkeletonController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +86,9 @@ public class SkeletonController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntitySlime;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntitySlime;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSlime;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSlime;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -59,29 +59,29 @@ public class SlimeController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null) {
|
||||
super.bl();
|
||||
super.bq();
|
||||
} else {
|
||||
npc.update();
|
||||
NMS.updateAI(this);
|
||||
@ -89,7 +89,7 @@ public class SlimeController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -98,9 +98,9 @@ public class SlimeController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntitySnowman;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntitySnowman;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSnowman;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSnowman;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,27 +57,27 @@ public class SnowmanController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +86,9 @@ public class SnowmanController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntitySpider;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntitySpider;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSpider;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSpider;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,29 +57,29 @@ public class SpiderController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc == null)
|
||||
super.bl();
|
||||
super.bq();
|
||||
else {
|
||||
NMS.updateAI(this);
|
||||
npc.update();
|
||||
@ -87,7 +87,7 @@ public class SpiderController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +96,9 @@ public class SpiderController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntitySquid;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntitySquid;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSquid;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSquid;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,28 +57,28 @@ public class SquidController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bl() {
|
||||
public void bq() {
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
} else
|
||||
super.bl();
|
||||
super.bq();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +87,9 @@ public class SquidController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ import net.citizensnpcs.npc.MobEntityController;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_6_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_6_R3.EntityVillager;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R1.EntityVillager;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftVillager;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftVillager;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -65,27 +65,27 @@ public class VillagerController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -94,9 +94,9 @@ public class VillagerController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityWitch;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityWitch;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWitch;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftWitch;
|
||||
import org.bukkit.entity.Witch;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,27 +57,27 @@ public class WitchController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +86,9 @@ public class WitchController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityWither;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityWither;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWither;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftWither;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -44,37 +44,28 @@ public class WitherController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc == null) {
|
||||
super.c();
|
||||
} else {
|
||||
updateAIWithMovement();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
@ -82,6 +73,15 @@ public class WitherController extends MobEntityController {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e() {
|
||||
if (npc == null) {
|
||||
super.e();
|
||||
} else {
|
||||
updateAIWithMovement();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
if (npc == null) {
|
||||
@ -125,7 +125,7 @@ public class WitherController extends MobEntityController {
|
||||
motY += 0.04;
|
||||
} else //(handled elsewhere)*/
|
||||
if (onGround && jumpTicks == 0) {
|
||||
be();
|
||||
bj();
|
||||
jumpTicks = 10;
|
||||
}
|
||||
} else {
|
||||
|
@ -7,13 +7,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_6_R3.EntityWolf;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityWolf;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftWolf;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,28 +57,28 @@ public class WolfController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +87,9 @@ public class WolfController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -7,13 +7,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_6_R3.EntityZombie;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.EntityZombie;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftZombie;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftZombie;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -57,28 +57,28 @@ public class ZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bH() {
|
||||
public boolean bL() {
|
||||
if (npc == null)
|
||||
return super.bH();
|
||||
return super.bL();
|
||||
boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault))
|
||||
return super.bH();
|
||||
if (super.bH()) {
|
||||
return super.bL();
|
||||
if (super.bL()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public void collide(net.minecraft.server.v1_7_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,9 +87,9 @@ public class ZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean e() {
|
||||
public boolean h_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
return super.e();
|
||||
return super.h_();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,75 +1,16 @@
|
||||
package net.citizensnpcs.npc.network;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_6_R3.NetworkManager;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet102WindowClick;
|
||||
import net.minecraft.server.v1_6_R3.Packet106Transaction;
|
||||
import net.minecraft.server.v1_6_R3.Packet10Flying;
|
||||
import net.minecraft.server.v1_6_R3.Packet130UpdateSign;
|
||||
import net.minecraft.server.v1_6_R3.Packet14BlockDig;
|
||||
import net.minecraft.server.v1_6_R3.Packet15Place;
|
||||
import net.minecraft.server.v1_6_R3.Packet16BlockItemSwitch;
|
||||
import net.minecraft.server.v1_6_R3.Packet255KickDisconnect;
|
||||
import net.minecraft.server.v1_6_R3.Packet28EntityVelocity;
|
||||
import net.minecraft.server.v1_6_R3.Packet3Chat;
|
||||
import net.minecraft.server.v1_6_R3.Packet51MapChunk;
|
||||
import net.minecraft.server.v1_6_R3.PlayerConnection;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_7_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PlayerConnection;
|
||||
|
||||
public class EmptyNetHandler extends PlayerConnection {
|
||||
public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer) {
|
||||
super(minecraftServer, networkManager, entityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet102WindowClick packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet106Transaction packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet10Flying packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet130UpdateSign packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet14BlockDig packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet15Place packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet16BlockItemSwitch packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet255KickDisconnect packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet28EntityVelocity packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet3Chat packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Packet51MapChunk packet) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(String string, Object[] objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacket(Packet packet) {
|
||||
}
|
||||
|
@ -1,48 +1,13 @@
|
||||
package net.citizensnpcs.npc.network;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.security.PrivateKey;
|
||||
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_6_R3.Connection;
|
||||
import net.minecraft.server.v1_6_R3.IConsoleLogManager;
|
||||
import net.minecraft.server.v1_6_R3.NetworkManager;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_7_R1.NetworkManager;
|
||||
|
||||
public class EmptyNetworkManager extends NetworkManager {
|
||||
public EmptyNetworkManager(IConsoleLogManager logManager, Socket socket, String string, Connection conn,
|
||||
PrivateKey key) throws IOException {
|
||||
super(logManager, socket, string, conn, key);
|
||||
public EmptyNetworkManager(boolean flag) throws IOException {
|
||||
super(flag);
|
||||
NMS.stopNetworkThreads(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Connection conn) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(String s, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void d() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int e() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queue(Packet packet) {
|
||||
}
|
||||
}
|
@ -14,12 +14,12 @@ 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_6_R3.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -76,7 +76,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
}
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_6_R3.Entity getHandle() {
|
||||
private net.minecraft.server.v1_7_R1.Entity getHandle() {
|
||||
return ((CraftEntity) npc.getEntity()).getHandle();
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private void setMountedYaw(net.minecraft.server.v1_6_R3.Entity handle) {
|
||||
private void setMountedYaw(net.minecraft.server.v1_7_R1.Entity handle) {
|
||||
if (handle instanceof EntityEnderDragon || !Setting.USE_BOAT_CONTROLS.asBoolean())
|
||||
return; // EnderDragon handles this separately
|
||||
double tX = handle.locX + handle.motX;
|
||||
@ -204,7 +204,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private double updateHorizontalSpeed(net.minecraft.server.v1_6_R3.Entity handle, double speed, float speedMod) {
|
||||
private double updateHorizontalSpeed(net.minecraft.server.v1_7_R1.Entity handle, double speed, float speedMod) {
|
||||
double oldSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
|
||||
double horizontal = ((EntityLiving) handle.passenger).bf;
|
||||
if (horizontal > 0.0D) {
|
||||
@ -250,7 +250,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
|
||||
@Override
|
||||
public void run(Player rider) {
|
||||
net.minecraft.server.v1_6_R3.Entity handle = getHandle();
|
||||
net.minecraft.server.v1_7_R1.Entity handle = getHandle();
|
||||
boolean onGround = handle.onGround;
|
||||
float speedMod = npc.getNavigator().getDefaultParameters()
|
||||
.modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED));
|
||||
@ -301,7 +301,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
}
|
||||
Vector dir = rider.getEyeLocation().getDirection();
|
||||
dir.multiply(npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
net.minecraft.server.v1_6_R3.Entity handle = getHandle();
|
||||
net.minecraft.server.v1_7_R1.Entity handle = getHandle();
|
||||
handle.motX = dir.getX();
|
||||
handle.motY = dir.getY();
|
||||
handle.motZ = dir.getZ();
|
||||
@ -344,7 +344,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
getHandle().motY = 0.001;
|
||||
return;
|
||||
}
|
||||
net.minecraft.server.v1_6_R3.Entity handle = getHandle();
|
||||
net.minecraft.server.v1_7_R1.Entity handle = getHandle();
|
||||
this.speed = updateHorizontalSpeed(handle, this.speed, 1F);
|
||||
boolean shouldJump = NMS.shouldJump(handle.passenger);
|
||||
if (shouldJump) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.citizensnpcs.trait.waypoint;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.DamageSource;
|
||||
import net.minecraft.server.v1_6_R3.EntityEnderSignal;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.DamageSource;
|
||||
import net.minecraft.server.v1_7_R1.EntityEnderSignal;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
public class EntityEnderSignalMarker extends EntityEnderSignal {
|
||||
public EntityEnderSignalMarker(World world) {
|
||||
@ -19,6 +19,6 @@ public class EntityEnderSignalMarker extends EntityEnderSignal {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void l_() {
|
||||
public void h() {
|
||||
}
|
||||
}
|
||||
|
@ -12,35 +12,35 @@ import java.util.WeakHashMap;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||
import net.minecraft.server.v1_6_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R3.Block;
|
||||
import net.minecraft.server.v1_6_R3.ControllerJump;
|
||||
import net.minecraft.server.v1_6_R3.DamageSource;
|
||||
import net.minecraft.server.v1_6_R3.EnchantmentManager;
|
||||
import net.minecraft.server.v1_6_R3.Entity;
|
||||
import net.minecraft.server.v1_6_R3.EntityHorse;
|
||||
import net.minecraft.server.v1_6_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_6_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_6_R3.GenericAttributes;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.MobEffectList;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_6_R3.NetworkManager;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R1.ControllerJump;
|
||||
import net.minecraft.server.v1_7_R1.DamageSource;
|
||||
import net.minecraft.server.v1_7_R1.EnchantmentManager;
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.EntityHorse;
|
||||
import net.minecraft.server.v1_7_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_7_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.MobEffectList;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.NetworkManager;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
import net.minecraft.util.io.netty.channel.Channel;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -121,13 +121,13 @@ public class NMS {
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
|
||||
if (entity.G()) {
|
||||
if (entity.M()) {
|
||||
entity.a(f, f1, 0.02F);
|
||||
entity.move(entity.motX, entity.motY, entity.motZ);
|
||||
entity.motX *= 0.800000011920929D;
|
||||
entity.motY *= 0.800000011920929D;
|
||||
entity.motZ *= 0.800000011920929D;
|
||||
} else if (entity.I()) {
|
||||
} else if (entity.P()) {
|
||||
entity.a(f, f1, 0.02F);
|
||||
entity.move(entity.motX, entity.motY, entity.motZ);
|
||||
entity.motX *= 0.5D;
|
||||
@ -137,13 +137,8 @@ public class NMS {
|
||||
float f2 = 0.91F;
|
||||
|
||||
if (entity.onGround) {
|
||||
f2 = 0.54600006F;
|
||||
int i = entity.world.getTypeId(MathHelper.floor(entity.locX),
|
||||
MathHelper.floor(entity.boundingBox.b) - 1, MathHelper.floor(entity.locZ));
|
||||
|
||||
if (i > 0) {
|
||||
f2 = Block.byId[i].frictionFactor * 0.91F;
|
||||
}
|
||||
f2 = entity.world.getType(MathHelper.floor(entity.locX), MathHelper.floor(entity.boundingBox.b) - 1,
|
||||
MathHelper.floor(entity.locZ)).frictionFactor * 0.91F;
|
||||
}
|
||||
|
||||
float f3 = 0.16277136F / (f2 * f2 * f2);
|
||||
@ -151,13 +146,8 @@ public class NMS {
|
||||
entity.a(f, f1, entity.onGround ? 0.1F * f3 : 0.02F);
|
||||
f2 = 0.91F;
|
||||
if (entity.onGround) {
|
||||
f2 = 0.54600006F;
|
||||
int j = entity.world.getTypeId(MathHelper.floor(entity.locX),
|
||||
MathHelper.floor(entity.boundingBox.b) - 1, MathHelper.floor(entity.locZ));
|
||||
|
||||
if (j > 0) {
|
||||
f2 = Block.byId[j].frictionFactor * 0.91F;
|
||||
}
|
||||
f2 = entity.world.getType(MathHelper.floor(entity.locX), MathHelper.floor(entity.boundingBox.b) - 1,
|
||||
MathHelper.floor(entity.locZ)).frictionFactor * 0.91F;
|
||||
}
|
||||
|
||||
entity.move(entity.motX, entity.motY, entity.motZ);
|
||||
@ -208,7 +198,7 @@ public class NMS {
|
||||
return ((CraftLivingEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
public static net.minecraft.server.v1_6_R3.Entity getHandle(org.bukkit.entity.Entity entity) {
|
||||
public static net.minecraft.server.v1_7_R1.Entity getHandle(org.bukkit.entity.Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
@ -232,7 +222,7 @@ public class NMS {
|
||||
|
||||
public static boolean inWater(org.bukkit.entity.Entity entity) {
|
||||
Entity mcEntity = getHandle(entity);
|
||||
return mcEntity.H() || mcEntity.J();
|
||||
return mcEntity.M() || mcEntity.P();
|
||||
}
|
||||
|
||||
public static boolean isNavigationFinished(Navigation navigation) {
|
||||
@ -245,7 +235,7 @@ public class NMS {
|
||||
|
||||
public static void look(EntityLiving handle, Entity target) {
|
||||
if (handle instanceof EntityInsentient) {
|
||||
((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).bp());
|
||||
((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).x());
|
||||
} else if (handle instanceof EntityHumanNPC) {
|
||||
((EntityHumanNPC) handle).setTargetLook(target, 10F, 40);
|
||||
}
|
||||
@ -376,7 +366,7 @@ public class NMS {
|
||||
}
|
||||
|
||||
public static void setStepHeight(EntityLiving entity, float height) {
|
||||
entity.Y = height;
|
||||
entity.X = height;
|
||||
}
|
||||
|
||||
public static void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||
@ -386,7 +376,7 @@ public class NMS {
|
||||
handle.bf = (float) d;
|
||||
}
|
||||
|
||||
public static boolean shouldJump(net.minecraft.server.v1_6_R3.Entity entity) {
|
||||
public static boolean shouldJump(net.minecraft.server.v1_7_R1.Entity entity) {
|
||||
if (JUMP_FIELD == null || !(entity instanceof EntityLiving))
|
||||
return false;
|
||||
try {
|
||||
@ -424,8 +414,8 @@ public class NMS {
|
||||
if (THREAD_STOPPER == null)
|
||||
return;
|
||||
try {
|
||||
THREAD_STOPPER.set(manager, false);
|
||||
THREAD_STOPPER_2.set(manager, true);
|
||||
Channel channel = (Channel) THREAD_STOPPER.get(manager);
|
||||
channel.close();
|
||||
} catch (Exception e) {
|
||||
Messaging.logTr(Messages.ERROR_STOPPING_NETWORK_THREADS, e.getMessage());
|
||||
}
|
||||
@ -502,7 +492,7 @@ public class NMS {
|
||||
private static Map<Class<?>, Integer> ENTITY_CLASS_TO_INT;
|
||||
private static final Map<Class<?>, Constructor<?>> ENTITY_CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>();
|
||||
private static Map<Integer, Class<?>> ENTITY_INT_TO_CLASS;
|
||||
private static Field GOAL_FIELD = getField(PathfinderGoalSelector.class, "a");
|
||||
private static Field GOAL_FIELD = getField(PathfinderGoalSelector.class, "b");
|
||||
private static final Field JUMP_FIELD = getField(EntityLiving.class, "bd");
|
||||
private static Map<Class<?>, Integer> MC_ENTITY_CLASS_TO_INT = null;
|
||||
private static Map<Integer, Class<?>> MC_ENTITY_INT_TO_CLASS = null;
|
||||
@ -510,8 +500,7 @@ public class NMS {
|
||||
private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
||||
private static Field PATHFINDING_RANGE = getField(Navigation.class, "e");
|
||||
private static final Random RANDOM = Util.getFastRandom();
|
||||
private static Field THREAD_STOPPER = getField(NetworkManager.class, "n");
|
||||
private static Field THREAD_STOPPER_2 = getField(NetworkManager.class, "t");
|
||||
private static Field THREAD_STOPPER = getField(NetworkManager.class, "k");
|
||||
// true field above false and three synchronised lists
|
||||
|
||||
static {
|
||||
|
@ -2,41 +2,41 @@ package net.citizensnpcs.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet17EntityLocationAction;
|
||||
import net.minecraft.server.v1_6_R3.Packet18ArmAnimation;
|
||||
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutBed;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum PlayerAnimation {
|
||||
ARM_SWING {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
Packet18ArmAnimation packet = new Packet18ArmAnimation(player, 1);
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 1);
|
||||
sendPacketNearby(packet, player, radius);
|
||||
}
|
||||
},
|
||||
CRIT {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
Packet18ArmAnimation packet = new Packet18ArmAnimation(player, 6);
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 6);
|
||||
sendPacketNearby(packet, player, radius);
|
||||
}
|
||||
},
|
||||
HURT {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
Packet18ArmAnimation packet = new Packet18ArmAnimation(player, 2);
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 2);
|
||||
sendPacketNearby(packet, player, radius);
|
||||
}
|
||||
},
|
||||
MAGIC_CRIT {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
Packet18ArmAnimation packet = new Packet18ArmAnimation(player, 7);
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 7);
|
||||
sendPacketNearby(packet, player, radius);
|
||||
}
|
||||
},
|
||||
@ -49,8 +49,8 @@ public enum PlayerAnimation {
|
||||
SLEEP {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
Packet17EntityLocationAction packet = new Packet17EntityLocationAction(player, 0, (int) player.locX,
|
||||
(int) player.locY, (int) player.locZ);
|
||||
PacketPlayOutBed packet = new PacketPlayOutBed(player, (int) player.locX, (int) player.locY,
|
||||
(int) player.locZ);
|
||||
sendPacketNearby(packet, player, radius);
|
||||
}
|
||||
},
|
||||
@ -58,7 +58,8 @@ public enum PlayerAnimation {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
player.getBukkitEntity().setSneaking(true);
|
||||
sendPacketNearby(new Packet40EntityMetadata(player.id, player.getDataWatcher(), true), player, radius);
|
||||
sendPacketNearby(new PacketPlayOutEntityMetadata(player.getId(), player.getDataWatcher(), true), player,
|
||||
radius);
|
||||
}
|
||||
},
|
||||
STOP_SITTING {
|
||||
@ -70,7 +71,7 @@ public enum PlayerAnimation {
|
||||
STOP_SLEEPING {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
Packet18ArmAnimation packet = new Packet18ArmAnimation(player, 3);
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 3);
|
||||
sendPacketNearby(packet, player, radius);
|
||||
}
|
||||
},
|
||||
@ -78,7 +79,8 @@ public enum PlayerAnimation {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
player.getBukkitEntity().setSneaking(false);
|
||||
sendPacketNearby(new Packet40EntityMetadata(player.id, player.getDataWatcher(), true), player, radius);
|
||||
sendPacketNearby(new PacketPlayOutEntityMetadata(player.getId(), player.getDataWatcher(), true), player,
|
||||
radius);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.citizensnpcs.util.nms;
|
||||
|
||||
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||
import net.minecraft.server.v1_6_R3.Entity;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
|
||||
public class PlayerControllerLook {
|
||||
private final EntityHumanNPC a;
|
||||
|
@ -2,9 +2,9 @@ package net.citizensnpcs.util.nms;
|
||||
|
||||
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_6_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R3.GenericAttributes;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
|
||||
public class PlayerControllerMove {
|
||||
private final EntityHumanNPC a;
|
||||
@ -61,8 +61,8 @@ public class PlayerControllerMove {
|
||||
double d2 = this.c - i;
|
||||
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
||||
|
||||
if (d3 >= 2.500000277905201E-7D) {
|
||||
float f = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
if (d3 >= 2.5D) {
|
||||
float f = (float) (Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
|
||||
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
||||
NMS.setHeadYaw(a, this.a.yaw);
|
||||
|
@ -1,19 +1,19 @@
|
||||
package net.citizensnpcs.util.nms;
|
||||
|
||||
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||
import net.minecraft.server.v1_6_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R3.Block;
|
||||
import net.minecraft.server.v1_6_R3.Entity;
|
||||
import net.minecraft.server.v1_6_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_6_R3.GenericAttributes;
|
||||
import net.minecraft.server.v1_6_R3.IBlockAccess;
|
||||
import net.minecraft.server.v1_6_R3.Material;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_6_R3.PathEntity;
|
||||
import net.minecraft.server.v1_6_R3.PathPoint;
|
||||
import net.minecraft.server.v1_6_R3.Vec3D;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_7_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R1.Block;
|
||||
import net.minecraft.server.v1_7_R1.Blocks;
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_7_R1.Material;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.PathEntity;
|
||||
import net.minecraft.server.v1_7_R1.PathPoint;
|
||||
import net.minecraft.server.v1_7_R1.Vec3D;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
public class PlayerNavigation extends Navigation {
|
||||
private final EntityHumanNPC a;
|
||||
@ -25,6 +25,7 @@ public class PlayerNavigation extends Navigation {
|
||||
private int g;
|
||||
private int h;
|
||||
private final Vec3D i = Vec3D.a(0.0D, 0.0D, 0.0D);
|
||||
|
||||
private boolean j = true;
|
||||
private boolean k;
|
||||
private boolean l;
|
||||
@ -43,192 +44,169 @@ public class PlayerNavigation extends Navigation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(boolean flag) {
|
||||
this.l = flag;
|
||||
public void a(boolean paramBoolean) {
|
||||
this.l = paramBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(double d0) {
|
||||
this.d = d0;
|
||||
public void a(double paramDouble) {
|
||||
this.d = paramDouble;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathEntity a(double d0, double d1, double d2) {
|
||||
return !this.l() ? null : this.b.a(this.a, MathHelper.floor(d0), (int) d1, MathHelper.floor(d2), this.d(),
|
||||
this.j, this.k, this.l, this.m);
|
||||
public PathEntity a(double paramDouble1, double paramDouble2, double paramDouble3) {
|
||||
if (!l())
|
||||
return null;
|
||||
return this.b.a(this.a, MathHelper.floor(paramDouble1), (int) paramDouble2, MathHelper.floor(paramDouble3),
|
||||
d(), this.j, this.k, this.l, this.m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(double d0, double d1, double d2, double d3) {
|
||||
PathEntity pathentity = this.a(MathHelper.floor(d0), ((int) d1), MathHelper.floor(d2));
|
||||
|
||||
return this.a(pathentity, d3);
|
||||
public boolean a(double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4) {
|
||||
PathEntity localPathEntity = a(MathHelper.floor(paramDouble1), (int) paramDouble2,
|
||||
MathHelper.floor(paramDouble3));
|
||||
return a(localPathEntity, paramDouble4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathEntity a(Entity entity) {
|
||||
return !this.l() ? null : this.b.findPath(this.a, entity, this.d(), this.j, this.k, this.l, this.m);
|
||||
public PathEntity a(Entity paramEntity) {
|
||||
if (!l())
|
||||
return null;
|
||||
return this.b.findPath(this.a, paramEntity, d(), this.j, this.k, this.l, this.m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(Entity entity, double d0) {
|
||||
PathEntity pathentity = this.a(entity);
|
||||
|
||||
return pathentity != null ? this.a(pathentity, d0) : false;
|
||||
public boolean a(Entity paramEntity, double paramDouble) {
|
||||
PathEntity localPathEntity = a(paramEntity);
|
||||
if (localPathEntity != null)
|
||||
return a(localPathEntity, paramDouble);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean a(int i, int j, int k, int l, int i1, int j1, Vec3D vec3d, double d0, double d1) {
|
||||
int k1 = i - l / 2;
|
||||
int l1 = k - j1 / 2;
|
||||
private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6,
|
||||
Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
|
||||
int n = paramInt1 - paramInt4 / 2;
|
||||
int i1 = paramInt3 - paramInt6 / 2;
|
||||
|
||||
if (!this.b(k1, j, l1, l, i1, j1, vec3d, d0, d1)) {
|
||||
if (!b(n, paramInt2, i1, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2))
|
||||
return false;
|
||||
} else {
|
||||
for (int i2 = k1; i2 < k1 + l; ++i2) {
|
||||
for (int j2 = l1; j2 < l1 + j1; ++j2) {
|
||||
double d2 = i2 + 0.5D - vec3d.c;
|
||||
double d3 = j2 + 0.5D - vec3d.e;
|
||||
|
||||
if (d2 * d0 + d3 * d1 >= 0.0D) {
|
||||
int k2 = this.b.getTypeId(i2, j - 1, j2);
|
||||
|
||||
if (k2 <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Material material = Block.byId[k2].material;
|
||||
|
||||
if (material == Material.WATER && !this.a.H()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (material == Material.LAVA) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int i2 = n; i2 < n + paramInt4; i2++) {
|
||||
for (int i3 = i1; i3 < i1 + paramInt6; i3++) {
|
||||
double d1 = i2 + 0.5D - paramVec3D.c;
|
||||
double d2 = i3 + 0.5D - paramVec3D.e;
|
||||
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
|
||||
Block localBlock = this.b.getType(i2, paramInt2 - 1, i3);
|
||||
Material localMaterial = localBlock.getMaterial();
|
||||
if (localMaterial == Material.AIR)
|
||||
return false;
|
||||
if ((localMaterial == Material.WATER) && (!this.a.M()))
|
||||
return false;
|
||||
if (localMaterial == Material.LAVA)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(PathEntity pathentity, double d0) {
|
||||
if (pathentity == null) {
|
||||
public boolean a(PathEntity paramPathEntity, double paramDouble) {
|
||||
if (paramPathEntity == null) {
|
||||
this.c = null;
|
||||
return false;
|
||||
} else {
|
||||
if (!pathentity.a(this.c)) {
|
||||
this.c = pathentity;
|
||||
}
|
||||
|
||||
if (this.f) {
|
||||
this.n();
|
||||
}
|
||||
|
||||
if (this.c.d() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
this.d = d0;
|
||||
Vec3D vec3d = this.j();
|
||||
|
||||
this.h = this.g;
|
||||
this.i.c = vec3d.c;
|
||||
this.i.d = vec3d.d;
|
||||
this.i.e = vec3d.e;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!paramPathEntity.a(this.c))
|
||||
this.c = paramPathEntity;
|
||||
if (this.f)
|
||||
n();
|
||||
if (this.c.d() == 0)
|
||||
return false;
|
||||
|
||||
this.d = paramDouble;
|
||||
Vec3D localVec3D = j();
|
||||
this.h = this.g;
|
||||
this.i.c = localVec3D.c;
|
||||
this.i.d = localVec3D.d;
|
||||
this.i.e = localVec3D.e;
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k) {
|
||||
int l = MathHelper.floor(vec3d.c);
|
||||
int i1 = MathHelper.floor(vec3d.e);
|
||||
double d0 = vec3d1.c - vec3d.c;
|
||||
double d1 = vec3d1.e - vec3d.e;
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
private boolean a(Vec3D paramVec3D1, Vec3D paramVec3D2, int paramInt1, int paramInt2, int paramInt3) {
|
||||
int n = MathHelper.floor(paramVec3D1.c);
|
||||
int i1 = MathHelper.floor(paramVec3D1.e);
|
||||
|
||||
if (d2 < 1.0E-8D) {
|
||||
double d1 = paramVec3D2.c - paramVec3D1.c;
|
||||
double d2 = paramVec3D2.e - paramVec3D1.e;
|
||||
double d3 = d1 * d1 + d2 * d2;
|
||||
if (d3 < 1.0E-008D)
|
||||
return false;
|
||||
} else {
|
||||
double d3 = 1.0D / Math.sqrt(d2);
|
||||
|
||||
d0 *= d3;
|
||||
d1 *= d3;
|
||||
i += 2;
|
||||
k += 2;
|
||||
if (!this.a(l, (int) vec3d.d, i1, i, j, k, vec3d, d0, d1)) {
|
||||
return false;
|
||||
double d4 = 1.0D / Math.sqrt(d3);
|
||||
d1 *= d4;
|
||||
d2 *= d4;
|
||||
|
||||
paramInt1 += 2;
|
||||
paramInt3 += 2;
|
||||
if (!a(n, (int) paramVec3D1.d, i1, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2))
|
||||
return false;
|
||||
paramInt1 -= 2;
|
||||
paramInt3 -= 2;
|
||||
|
||||
double d5 = 1.0D / Math.abs(d1);
|
||||
double d6 = 1.0D / Math.abs(d2);
|
||||
|
||||
double d7 = n * 1 - paramVec3D1.c;
|
||||
double d8 = i1 * 1 - paramVec3D1.e;
|
||||
if (d1 >= 0.0D)
|
||||
d7 += 1.0D;
|
||||
if (d2 >= 0.0D)
|
||||
d8 += 1.0D;
|
||||
d7 /= d1;
|
||||
d8 /= d2;
|
||||
|
||||
int i2 = d1 < 0.0D ? -1 : 1;
|
||||
int i3 = d2 < 0.0D ? -1 : 1;
|
||||
int i4 = MathHelper.floor(paramVec3D2.c);
|
||||
int i5 = MathHelper.floor(paramVec3D2.e);
|
||||
int i6 = i4 - n;
|
||||
int i7 = i5 - i1;
|
||||
while ((i6 * i2 > 0) || (i7 * i3 > 0)) {
|
||||
if (d7 < d8) {
|
||||
d7 += d5;
|
||||
n += i2;
|
||||
i6 = i4 - n;
|
||||
} else {
|
||||
i -= 2;
|
||||
k -= 2;
|
||||
double d4 = 1.0D / Math.abs(d0);
|
||||
double d5 = 1.0D / Math.abs(d1);
|
||||
double d6 = l * 1 - vec3d.c;
|
||||
double d7 = i1 * 1 - vec3d.e;
|
||||
|
||||
if (d0 >= 0.0D) {
|
||||
++d6;
|
||||
}
|
||||
|
||||
if (d1 >= 0.0D) {
|
||||
++d7;
|
||||
}
|
||||
|
||||
d6 /= d0;
|
||||
d7 /= d1;
|
||||
int j1 = d0 < 0.0D ? -1 : 1;
|
||||
int k1 = d1 < 0.0D ? -1 : 1;
|
||||
int l1 = MathHelper.floor(vec3d1.c);
|
||||
int i2 = MathHelper.floor(vec3d1.e);
|
||||
int j2 = l1 - l;
|
||||
int k2 = i2 - i1;
|
||||
|
||||
do {
|
||||
if (j2 * j1 <= 0 && k2 * k1 <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (d6 < d7) {
|
||||
d6 += d4;
|
||||
l += j1;
|
||||
j2 = l1 - l;
|
||||
} else {
|
||||
d7 += d5;
|
||||
i1 += k1;
|
||||
k2 = i2 - i1;
|
||||
}
|
||||
} while (this.a(l, (int) vec3d.d, i1, i, j, k, vec3d, d0, d1));
|
||||
|
||||
return false;
|
||||
d8 += d6;
|
||||
i1 += i3;
|
||||
i7 = i5 - i1;
|
||||
}
|
||||
|
||||
if (!a(n, (int) paramVec3D1.d, i1, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(boolean flag) {
|
||||
this.k = flag;
|
||||
public void b(boolean paramBoolean) {
|
||||
this.k = paramBoolean;
|
||||
}
|
||||
|
||||
private boolean b(int i, int j, int k, int l, int i1, int j1, Vec3D vec3d, double d0, double d1) {
|
||||
for (int k1 = i; k1 < i + l; ++k1) {
|
||||
for (int l1 = j; l1 < j + i1; ++l1) {
|
||||
for (int i2 = k; i2 < k + j1; ++i2) {
|
||||
double d2 = k1 + 0.5D - vec3d.c;
|
||||
double d3 = i2 + 0.5D - vec3d.e;
|
||||
|
||||
if (d2 * d0 + d3 * d1 >= 0.0D) {
|
||||
int j2 = this.b.getTypeId(k1, l1, i2);
|
||||
|
||||
if (j2 > 0 && !Block.byId[j2].b((IBlockAccess) this.b, k1, l1, i2)) {
|
||||
private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6,
|
||||
Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
|
||||
for (int n = paramInt1; n < paramInt1 + paramInt4; n++) {
|
||||
for (int i1 = paramInt2; i1 < paramInt2 + paramInt5; i1++)
|
||||
for (int i2 = paramInt3; i2 < paramInt3 + paramInt6; i2++) {
|
||||
double d1 = n + 0.5D - paramVec3D.c;
|
||||
double d2 = i2 + 0.5D - paramVec3D.e;
|
||||
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
|
||||
Block localBlock = this.b.getType(n, i1, i2);
|
||||
if (!localBlock.b(this.b, n, i1, i2))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -238,8 +216,8 @@ public class PlayerNavigation extends Navigation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(boolean flag) {
|
||||
this.j = flag;
|
||||
public void c(boolean paramBoolean) {
|
||||
this.j = paramBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -248,8 +226,8 @@ public class PlayerNavigation extends Navigation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void d(boolean flag) {
|
||||
this.f = flag;
|
||||
public void d(boolean paramBoolean) {
|
||||
this.f = paramBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -258,31 +236,31 @@ public class PlayerNavigation extends Navigation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(boolean flag) {
|
||||
this.m = flag;
|
||||
public void e(boolean paramBoolean) {
|
||||
this.m = paramBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f() {
|
||||
++this.g;
|
||||
if (!this.g()) {
|
||||
if (this.l()) {
|
||||
this.i();
|
||||
}
|
||||
this.g += 1;
|
||||
if (g())
|
||||
return;
|
||||
|
||||
if (!this.g()) {
|
||||
Vec3D vec3d = this.c.a(this.a);
|
||||
if (l())
|
||||
i();
|
||||
|
||||
if (vec3d != null) {
|
||||
this.a.setMoveDestination(vec3d.c, vec3d.d, vec3d.e, (float) this.d);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g())
|
||||
return;
|
||||
Vec3D localVec3D = this.c.a(this.a);
|
||||
if (localVec3D == null)
|
||||
return;
|
||||
|
||||
this.a.setMoveDestination(localVec3D.c, localVec3D.d, localVec3D.e, this.d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean g() {
|
||||
return this.c == null || this.c.b();
|
||||
return (this.c == null) || (this.c.b());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -291,105 +269,93 @@ public class PlayerNavigation extends Navigation {
|
||||
}
|
||||
|
||||
private void i() {
|
||||
Vec3D vec3d = this.j();
|
||||
int i = this.c.d();
|
||||
Vec3D localVec3D = j();
|
||||
|
||||
for (int j = this.c.e(); j < this.c.d(); ++j) {
|
||||
if (this.c.a(j).b != (int) vec3d.d) {
|
||||
i = j;
|
||||
int n = this.c.d();
|
||||
for (int i1 = this.c.e(); i1 < this.c.d(); i1++) {
|
||||
if (this.c.a(i1).b != (int) localVec3D.d) {
|
||||
n = i1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float f = this.a.width * this.a.width;
|
||||
|
||||
int k;
|
||||
|
||||
for (k = this.c.e(); k < i; ++k) {
|
||||
if (vec3d.distanceSquared(this.c.a(this.a, k)) < f) {
|
||||
this.c.c(k + 1);
|
||||
float f1 = this.a.width * this.a.width;
|
||||
for (int i2 = this.c.e(); i2 < n; i2++) {
|
||||
if (localVec3D.distanceSquared(this.c.a(this.a, i2)) < f1) {
|
||||
this.c.c(i2 + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
k = MathHelper.f(this.a.width);
|
||||
int l = (int) this.a.length + 1;
|
||||
int i1 = k;
|
||||
|
||||
for (int j1 = i - 1; j1 >= this.c.e(); --j1) {
|
||||
if (this.a(vec3d, this.c.a(this.a, j1), k, l, i1)) {
|
||||
this.c.c(j1);
|
||||
int i3 = (int) this.a.length + 1;
|
||||
int i4 = MathHelper.f(this.a.width);
|
||||
for (int i5 = n - 1; i5 >= this.c.e(); i5--) {
|
||||
if (a(localVec3D, this.c.a(this.a, i5), i4, i3, i4)) {
|
||||
this.c.c(i5);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.g - this.h > 100) {
|
||||
if (vec3d.distanceSquared(this.i) < 2.25D) {
|
||||
this.h();
|
||||
}
|
||||
|
||||
if (localVec3D.distanceSquared(this.i) < 2.25D)
|
||||
h();
|
||||
this.h = this.g;
|
||||
this.i.c = vec3d.c;
|
||||
this.i.d = vec3d.d;
|
||||
this.i.e = vec3d.e;
|
||||
this.i.c = localVec3D.c;
|
||||
this.i.d = localVec3D.d;
|
||||
this.i.e = localVec3D.e;
|
||||
}
|
||||
}
|
||||
|
||||
private Vec3D j() {
|
||||
return this.b.getVec3DPool().create(this.a.locX, this.k(), this.a.locZ);
|
||||
return this.b.getVec3DPool().create(this.a.locX, k(), this.a.locZ);
|
||||
}
|
||||
|
||||
private int k() {
|
||||
if (this.a.H() && this.m) {
|
||||
int i = (int) this.a.boundingBox.b;
|
||||
int j = this.b.getTypeId(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ));
|
||||
int k = 0;
|
||||
|
||||
do {
|
||||
if (j != Block.WATER.id && j != Block.STATIONARY_WATER.id) {
|
||||
return i;
|
||||
}
|
||||
|
||||
++i;
|
||||
j = this.b.getTypeId(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ));
|
||||
++k;
|
||||
} while (k <= 16);
|
||||
|
||||
return (int) this.a.boundingBox.b;
|
||||
} else {
|
||||
if ((!this.a.M()) || (!this.m))
|
||||
return (int) (this.a.boundingBox.b + 0.5D);
|
||||
|
||||
int n = (int) this.a.boundingBox.b;
|
||||
Block localBlock = this.b.getType(MathHelper.floor(this.a.locX), n, MathHelper.floor(this.a.locZ));
|
||||
int i1 = 0;
|
||||
while ((localBlock == Blocks.WATER) || (localBlock == Blocks.STATIONARY_WATER)) {
|
||||
n++;
|
||||
localBlock = this.b.getType(MathHelper.floor(this.a.locX), n, MathHelper.floor(this.a.locZ));
|
||||
i1++;
|
||||
if (i1 > 16)
|
||||
return (int) this.a.boundingBox.b;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
private boolean l() {
|
||||
return this.a.onGround || this.m && this.m();
|
||||
return (this.a.onGround) || ((this.m) && (m()));
|
||||
}
|
||||
|
||||
private boolean m() {
|
||||
return this.a.H() || this.a.J();
|
||||
return (this.a.M()) || (this.a.P());
|
||||
}
|
||||
|
||||
private void n() {
|
||||
if (!this.b
|
||||
.l(MathHelper.floor(this.a.locX), (int) (this.a.boundingBox.b + 0.5D), MathHelper.floor(this.a.locZ))) {
|
||||
for (int i = 0; i < this.c.d(); ++i) {
|
||||
PathPoint pathpoint = this.c.a(i);
|
||||
if (this.b.i(MathHelper.floor(this.a.locX), (int) (this.a.boundingBox.b + 0.5D), MathHelper.floor(this.a.locZ)))
|
||||
return;
|
||||
|
||||
if (this.b.l(pathpoint.a, pathpoint.b, pathpoint.c)) {
|
||||
this.c.b(i - 1);
|
||||
return;
|
||||
}
|
||||
for (int n = 0; n < this.c.d(); n++) {
|
||||
PathPoint localPathPoint = this.c.a(n);
|
||||
if (this.b.i(localPathPoint.a, localPathPoint.b, localPathPoint.c)) {
|
||||
this.c.b(n - 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setRange(float pathfindingRange) {
|
||||
if (this.e != null) {
|
||||
this.e.setValue(pathfindingRange);
|
||||
}
|
||||
this.e.setValue(pathfindingRange);
|
||||
}
|
||||
|
||||
private static EntityInsentient getDummyInsentient(EntityHumanNPC from) {
|
||||
return new EntityInsentient(null) {
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user