Merge master into speech for 1.4.6 support.

This commit is contained in:
Jeremy Schroeder 2012-12-25 20:40:11 -05:00
commit fc7571ec3a
44 changed files with 505 additions and 504 deletions

View File

@ -11,7 +11,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<craftbukkit.version>1.4.5-R1.0</craftbukkit.version>
<craftbukkit.version>LATEST</craftbukkit.version>
<citizensapi.version>2.0.6-SNAPSHOT</citizensapi.version>
<vault.version>1.2.19-SNAPSHOT</vault.version>
<powermock.version>1.4.12</powermock.version>

View File

@ -358,6 +358,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
return false;
}
private static final String COMPATIBLE_MC_VERSION = "1.4";
private static final String COMPATIBLE_MC_VERSION = "1.4.6";
}

View File

@ -25,13 +25,13 @@ import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_4_5.EntityPlayer;
import net.minecraft.server.v1_4_6.EntityPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View File

@ -1,246 +1,247 @@
package net.citizensnpcs.npc;
import java.util.List;
import javax.annotation.Nullable;
import net.citizensnpcs.EventListen;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.ai.Navigator;
import net.citizensnpcs.api.event.DespawnReason;
import net.citizensnpcs.api.event.NPCDespawnEvent;
import net.citizensnpcs.api.event.NPCSpawnEvent;
import net.citizensnpcs.api.npc.AbstractNPC;
import net.citizensnpcs.api.persistence.PersistenceLoader;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.trait.Spawned;
import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.npc.ai.CitizensNavigator;
import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.metadata.FixedMetadataValue;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
public class CitizensNPC extends AbstractNPC {
private EntityController entityController;
private final CitizensNavigator navigator = new CitizensNavigator(this);
private final List<String> removedTraits = Lists.newArrayList();
public CitizensNPC(int id, String name, EntityController entityController) {
super(id, name);
Preconditions.checkNotNull(entityController);
this.entityController = entityController;
}
@Override
public boolean despawn(DespawnReason reason) {
if (!isSpawned())
return false;
NPCDespawnEvent event = new NPCDespawnEvent(this, reason);
if (reason == DespawnReason.CHUNK_UNLOAD)
event.setCancelled(Setting.KEEP_CHUNKS_LOADED.asBoolean());
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
getBukkitEntity().getLocation().getChunk();
// ensure that we are in a loaded chunk.
return false;
}
boolean keepSelected = getTrait(Spawned.class).shouldSpawn();
if (!keepSelected)
data().remove("selectors");
for (Trait trait : traits.values())
trait.onDespawn();
entityController.remove();
return true;
}
@Override
public LivingEntity getBukkitEntity() {
return entityController.getBukkitEntity();
}
@Deprecated
public EntityLiving getHandle() {
return ((CraftLivingEntity) getBukkitEntity()).getHandle();
}
@Override
public Navigator getNavigator() {
return navigator;
}
@Override
public boolean isSpawned() {
return getBukkitEntity() != null;
}
public void load(final DataKey root) {
metadata.loadFrom(root.getRelative("metadata"));
// Load traits
String traitNames = root.getString("traitnames");
Iterable<DataKey> keys = traitNames.isEmpty() ? root.getRelative("traits").getSubKeys() : Iterables
.transform(Splitter.on(',').split(traitNames), new Function<String, DataKey>() {
@Override
public DataKey apply(@Nullable String input) {
return root.getRelative("traits." + input);
}
});
for (DataKey traitKey : keys) {
if (traitKey.keyExists("enabled") && !traitKey.getBoolean("enabled"))
continue;
Class<? extends Trait> clazz = CitizensAPI.getTraitFactory().getTraitClass(traitKey.name());
Trait trait;
if (hasTrait(clazz)) {
trait = getTrait(clazz);
} else {
trait = CitizensAPI.getTraitFactory().getTrait(clazz);
if (trait == null) {
Messaging.severeTr(Messages.SKIPPING_BROKEN_TRAIT, traitKey.name(), getId());
continue;
}
addTrait(trait);
}
loadTrait(trait, traitKey);
}
// Spawn the NPC
CurrentLocation spawnLocation = getTrait(CurrentLocation.class);
if (getTrait(Spawned.class).shouldSpawn() && spawnLocation.getLocation() != null)
spawn(spawnLocation.getLocation());
navigator.load(root.getRelative("navigator"));
}
private void loadTrait(Trait trait, DataKey traitKey) {
try {
trait.load(traitKey);
PersistenceLoader.load(trait, traitKey);
} catch (Throwable ex) {
Messaging.logTr(Messages.TRAIT_LOAD_FAILED, traitKey.name(), getId());
}
}
@Override
public void removeTrait(Class<? extends Trait> clazz) {
Trait present = traits.get(clazz);
if (present != null)
removedTraits.add(present.getName());
super.removeTrait(clazz);
}
private void removeTraitData(DataKey root) {
for (String name : removedTraits) {
root.removeKey("traits." + name);
}
removedTraits.clear();
}
public void save(DataKey root) {
root.setString("name", getFullName());
metadata.saveTo(root.getRelative("metadata"));
navigator.save(root.getRelative("navigator"));
// Save all existing traits
StringBuilder traitNames = new StringBuilder();
for (Trait trait : traits.values()) {
DataKey traitKey = root.getRelative("traits." + trait.getName());
trait.save(traitKey);
PersistenceLoader.save(trait, traitKey);
removedTraits.remove(trait.getName());
traitNames.append(trait.getName() + ",");
}
if (traitNames.length() > 0) {
root.setString("traitnames", traitNames.substring(0, traitNames.length() - 1));
}
removeTraitData(root);
}
public void setEntityController(EntityController newController) {
Preconditions.checkNotNull(newController);
boolean wasSpawned = isSpawned();
Location prev = null;
if (wasSpawned) {
prev = getBukkitEntity().getLocation();
despawn();
}
entityController = newController;
if (wasSpawned)
spawn(prev);
}
@Override
public boolean spawn(Location at) {
Preconditions.checkNotNull(at, "location cannot be null");
if (isSpawned())
return false;
entityController.spawn(at, this);
EntityLiving mcEntity = getHandle();
boolean couldSpawn = !Util.isLoaded(at) ? false : mcEntity.world.addEntity(mcEntity,
SpawnReason.CUSTOM);
if (!couldSpawn) {
// we need to wait for a chunk load before trying to spawn
mcEntity = null;
EventListen.addForRespawn(at, getId());
return true;
}
NPCSpawnEvent spawnEvent = new NPCSpawnEvent(this, at);
Bukkit.getPluginManager().callEvent(spawnEvent);
if (spawnEvent.isCancelled()) {
mcEntity = null;
return false;
}
NMS.setHeadYaw(mcEntity, at.getYaw());
getBukkitEntity().setMetadata(NPC_METADATA_MARKER,
new FixedMetadataValue(CitizensAPI.getPlugin(), true));
// Set the spawned state
getTrait(CurrentLocation.class).setLocation(at);
getTrait(Spawned.class).setSpawned(true);
navigator.onSpawn();
// Modify NPC using traits after the entity has been created
for (Trait trait : traits.values())
trait.onSpawn();
getBukkitEntity().setRemoveWhenFarAway(false);
return true;
}
@Override
public void update() {
try {
super.update();
if (isSpawned()) {
NMS.trySwim(getBukkitEntity());
navigator.run();
}
} catch (Exception ex) {
Messaging.logTr(Messages.EXCEPTION_UPDATING_NPC, getId(), ex.getMessage());
ex.printStackTrace();
}
}
private static final String NPC_METADATA_MARKER = "NPC";
package net.citizensnpcs.npc;
import java.util.List;
import javax.annotation.Nullable;
import net.citizensnpcs.EventListen;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.ai.Navigator;
import net.citizensnpcs.api.event.DespawnReason;
import net.citizensnpcs.api.event.NPCDespawnEvent;
import net.citizensnpcs.api.event.NPCSpawnEvent;
import net.citizensnpcs.api.npc.AbstractNPC;
import net.citizensnpcs.api.persistence.PersistenceLoader;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.trait.Spawned;
import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.npc.ai.CitizensNavigator;
import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_6.EntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.metadata.FixedMetadataValue;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
public class CitizensNPC extends AbstractNPC {
private EntityController entityController;
private final CitizensNavigator navigator = new CitizensNavigator(this);
private final List<String> removedTraits = Lists.newArrayList();
public CitizensNPC(int id, String name, EntityController entityController) {
super(id, name);
Preconditions.checkNotNull(entityController);
this.entityController = entityController;
}
@Override
public boolean despawn(DespawnReason reason) {
if (!isSpawned())
return false;
NPCDespawnEvent event = new NPCDespawnEvent(this, reason);
if (reason == DespawnReason.CHUNK_UNLOAD)
event.setCancelled(Setting.KEEP_CHUNKS_LOADED.asBoolean());
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
getBukkitEntity().getLocation().getChunk();
// ensure that we are in a loaded chunk.
return false;
}
boolean keepSelected = getTrait(Spawned.class).shouldSpawn();
if (!keepSelected)
data().remove("selectors");
for (Trait trait : traits.values())
trait.onDespawn();
entityController.remove();
return true;
}
@Override
public LivingEntity getBukkitEntity() {
return entityController.getBukkitEntity();
}
@Deprecated
public EntityLiving getHandle() {
return ((CraftLivingEntity) getBukkitEntity()).getHandle();
}
@Override
public Navigator getNavigator() {
return navigator;
}
@Override
public boolean isSpawned() {
return getBukkitEntity() != null;
}
public void load(final DataKey root) {
metadata.loadFrom(root.getRelative("metadata"));
// Load traits
String traitNames = root.getString("traitnames");
Iterable<DataKey> keys = traitNames.isEmpty() ? root.getRelative("traits").getSubKeys() : Iterables
.transform(Splitter.on(',').split(traitNames), new Function<String, DataKey>() {
@Override
public DataKey apply(@Nullable String input) {
return root.getRelative("traits." + input);
}
});
for (DataKey traitKey : keys) {
if (traitKey.keyExists("enabled") && !traitKey.getBoolean("enabled"))
continue;
Class<? extends Trait> clazz = CitizensAPI.getTraitFactory().getTraitClass(traitKey.name());
Trait trait;
if (hasTrait(clazz)) {
trait = getTrait(clazz);
} else {
trait = CitizensAPI.getTraitFactory().getTrait(clazz);
if (trait == null) {
Messaging.severeTr(Messages.SKIPPING_BROKEN_TRAIT, traitKey.name(), getId());
continue;
}
addTrait(trait);
}
loadTrait(trait, traitKey);
}
// Spawn the NPC
CurrentLocation spawnLocation = getTrait(CurrentLocation.class);
if (getTrait(Spawned.class).shouldSpawn() && spawnLocation.getLocation() != null)
spawn(spawnLocation.getLocation());
navigator.load(root.getRelative("navigator"));
}
private void loadTrait(Trait trait, DataKey traitKey) {
try {
trait.load(traitKey);
PersistenceLoader.load(trait, traitKey);
} catch (Throwable ex) {
Messaging.logTr(Messages.TRAIT_LOAD_FAILED, traitKey.name(), getId());
}
}
@Override
public void removeTrait(Class<? extends Trait> clazz) {
Trait present = traits.get(clazz);
if (present != null)
removedTraits.add(present.getName());
super.removeTrait(clazz);
}
private void removeTraitData(DataKey root) {
for (String name : removedTraits) {
root.removeKey("traits." + name);
}
removedTraits.clear();
}
public void save(DataKey root) {
root.setString("name", getFullName());
metadata.saveTo(root.getRelative("metadata"));
navigator.save(root.getRelative("navigator"));
// Save all existing traits
StringBuilder traitNames = new StringBuilder();
for (Trait trait : traits.values()) {
DataKey traitKey = root.getRelative("traits." + trait.getName());
trait.save(traitKey);
PersistenceLoader.save(trait, traitKey);
removedTraits.remove(trait.getName());
traitNames.append(trait.getName() + ",");
}
if (traitNames.length() > 0) {
root.setString("traitnames", traitNames.substring(0, traitNames.length() - 1));
}
removeTraitData(root);
}
public void setEntityController(EntityController newController) {
Preconditions.checkNotNull(newController);
boolean wasSpawned = isSpawned();
Location prev = null;
if (wasSpawned) {
prev = getBukkitEntity().getLocation();
despawn();
}
entityController = newController;
if (wasSpawned)
spawn(prev);
}
@Override
public boolean spawn(Location at) {
Preconditions.checkNotNull(at, "location cannot be null");
if (isSpawned())
return false;
entityController.spawn(at, this);
EntityLiving mcEntity = getHandle();
boolean couldSpawn = !Util.isLoaded(at) ? false : mcEntity.world.addEntity(mcEntity,
SpawnReason.CUSTOM);
if (!couldSpawn) {
// we need to wait for a chunk load before trying to spawn
mcEntity = null;
EventListen.addForRespawn(at, getId());
return true;
}
NPCSpawnEvent spawnEvent = new NPCSpawnEvent(this, at);
Bukkit.getPluginManager().callEvent(spawnEvent);
if (spawnEvent.isCancelled()) {
mcEntity = null;
return false;
}
NMS.setHeadYaw(mcEntity, at.getYaw());
getBukkitEntity().setMetadata(NPC_METADATA_MARKER,
new FixedMetadataValue(CitizensAPI.getPlugin(), true));
// Set the spawned state
getTrait(CurrentLocation.class).setLocation(at);
getTrait(Spawned.class).setSpawned(true);
navigator.onSpawn();
// Modify NPC using traits after the entity has been created
for (Trait trait : traits.values())
trait.onSpawn();
getBukkitEntity().setRemoveWhenFarAway(false);
return true;
}
@Override
public void update() {
try {
super.update();
if (isSpawned()) {
NMS.trySwim(getBukkitEntity());
navigator.run();
}
} catch (Exception ex) {
Messaging.logTr(Messages.EXCEPTION_UPDATING_NPC, getId(), ex.getMessage());
ex.printStackTrace();
}
}
private static final String NPC_METADATA_MARKER = "NPC";
}

View File

@ -5,12 +5,12 @@ import java.util.Map;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_4_5.EntityLiving;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityLiving;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_4_5.CraftWorld;
import org.bukkit.craftbukkit.v1_4_6.CraftWorld;
import org.bukkit.entity.LivingEntity;
import com.google.common.collect.Maps;

View File

@ -10,7 +10,7 @@ import net.citizensnpcs.api.astar.pathfinder.VectorGoal;
import net.citizensnpcs.api.astar.pathfinder.VectorNode;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_4_5.EntityLiving;
import net.minecraft.server.v1_4_6.EntityLiving;
import org.bukkit.Effect;
import org.bukkit.Location;

View File

@ -4,12 +4,12 @@ import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.ai.TargetType;
import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC;
import net.minecraft.server.v1_4_5.EntityHuman;
import net.minecraft.server.v1_4_5.EntityLiving;
import net.minecraft.server.v1_4_5.Navigation;
import net.minecraft.server.v1_4_6.EntityHuman;
import net.minecraft.server.v1_4_6.EntityLiving;
import net.minecraft.server.v1_4_6.Navigation;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftLivingEntity;
public class MCNavigationStrategy extends AbstractPathStrategy {
private final Navigation navigation;

View File

@ -8,12 +8,12 @@ import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.PlayerAnimation;
import net.minecraft.server.v1_4_5.EntityLiving;
import net.minecraft.server.v1_4_5.EntityPlayer;
import net.minecraft.server.v1_4_5.Navigation;
import net.minecraft.server.v1_4_6.EntityLiving;
import net.minecraft.server.v1_4_6.EntityPlayer;
import net.minecraft.server.v1_4_6.Navigation;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
public class MCTargetStrategy implements PathStrategy, EntityTarget {

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityBat;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityBat;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftBat;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftBat;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -68,7 +68,7 @@ public class BatController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityBlaze;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityBlaze;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftBlaze;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -66,7 +66,7 @@ public class BlazeController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityCaveSpider;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityCaveSpider;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftCaveSpider;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -75,7 +75,7 @@ public class CaveSpiderController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityChicken;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityChicken;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftChicken;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -65,7 +65,7 @@ public class ChickenController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityCow;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityCow;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftCow;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftCow;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -65,7 +65,7 @@ public class CowController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -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_4_5.EntityCreeper;
import net.minecraft.server.v1_4_5.EntityLightning;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityCreeper;
import net.minecraft.server.v1_4_6.EntityLightning;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftCreeper;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -72,7 +72,7 @@ public class CreeperController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityEnderDragon;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityEnderDragon;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftEnderDragon;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -72,7 +72,7 @@ public class EnderDragonController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityEnderman;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityEnderman;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftEnderman;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
@ -85,7 +85,7 @@ public class EndermanController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -13,34 +13,34 @@ import net.citizensnpcs.npc.network.EmptyNetworkManager;
import net.citizensnpcs.npc.network.EmptySocket;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityPlayer;
import net.minecraft.server.v1_4_5.EnumGamemode;
import net.minecraft.server.v1_4_5.ItemInWorldManager;
import net.minecraft.server.v1_4_5.MathHelper;
import net.minecraft.server.v1_4_5.MinecraftServer;
import net.minecraft.server.v1_4_5.Navigation;
import net.minecraft.server.v1_4_5.NetHandler;
import net.minecraft.server.v1_4_5.NetworkManager;
import net.minecraft.server.v1_4_5.Packet32EntityLook;
import net.minecraft.server.v1_4_5.Packet5EntityEquipment;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityPlayer;
import net.minecraft.server.v1_4_6.EnumGamemode;
import net.minecraft.server.v1_4_6.PlayerInteractManager;
import net.minecraft.server.v1_4_6.MathHelper;
import net.minecraft.server.v1_4_6.MinecraftServer;
import net.minecraft.server.v1_4_6.Navigation;
import net.minecraft.server.v1_4_6.Connection;
import net.minecraft.server.v1_4_6.NetworkManager;
import net.minecraft.server.v1_4_6.Packet32EntityLook;
import net.minecraft.server.v1_4_6.Packet5EntityEquipment;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPlayer;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
private final CitizensNPC npc;
private final net.minecraft.server.v1_4_5.ItemStack[] previousEquipment = { null, null, null, null, null };
private final net.minecraft.server.v1_4_6.ItemStack[] previousEquipment = { null, null, null, null, null };
public EntityHumanNPC(MinecraftServer minecraftServer, World world, String string,
ItemInWorldManager itemInWorldManager, NPC npc) {
super(minecraftServer, world, string, itemInWorldManager);
itemInWorldManager.setGameMode(EnumGamemode.SURVIVAL);
PlayerInteractManager playerInteractManager, NPC npc) {
super(minecraftServer, world, string, playerInteractManager);
playerInteractManager.setGameMode(EnumGamemode.SURVIVAL);
this.npc = (CitizensNPC) npc;
if (npc != null)
@ -53,7 +53,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
@ -97,16 +97,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
private void initialise(MinecraftServer minecraftServer) {
Socket socket = new EmptySocket();
NetworkManager netMgr = null;
NetworkManager conn = null;
try {
netMgr = new EmptyNetworkManager(socket, "npc mgr", new NetHandler() {
conn = new EmptyNetworkManager(socket, "npc mgr", new Connection() {
@Override
public boolean a() {
return false;
}
}, server.F().getPrivate());
netServerHandler = new EmptyNetHandler(minecraftServer, netMgr, this);
netMgr.a(netServerHandler);
playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
conn.a(playerConnection);
} catch (IOException e) {
// swallow
}
@ -161,33 +161,33 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
private void moveOnCurrentHeading() {
NMS.updateAI(this);
// taken from EntityLiving update method
if (bE) {
if (bF) {
/* boolean inLiquid = H() || J();
if (inLiquid) {
motY += 0.04;
} else //(handled elsewhere)*/
if (onGround && bU == 0) {
if (onGround && bV == 0) {
bi();
bU = 10;
bV = 10;
}
} else
bU = 0;
bV = 0;
bB *= 0.98F;
bC *= 0.98F;
bD *= 0.9F;
bD *= 0.98F;
bE *= 0.9F;
float prev = aM;
aM *= bB();
e(bB, bC); // movement method
aM = prev;
float prev = aN;
aN *= bB();
e(bC, bD); // movement method
aN = prev;
NMS.setHeadYaw(this, yaw);
}
private void updateEquipment() {
for (int i = 0; i < previousEquipment.length; i++) {
net.minecraft.server.v1_4_5.ItemStack previous = previousEquipment[i];
net.minecraft.server.v1_4_5.ItemStack current = getEquipment(i);
net.minecraft.server.v1_4_6.ItemStack previous = previousEquipment[i];
net.minecraft.server.v1_4_6.ItemStack current = getEquipment(i);
if (previous != current) {
NMS.sendPacketNearby(getBukkitEntity().getLocation(), new Packet5EntityEquipment(id, i,
current));

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityGhast;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityGhast;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftGhast;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftGhast;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ghast;
import org.bukkit.util.Vector;
@ -52,7 +52,7 @@ public class GhastController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityGiantZombie;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityGiantZombie;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftGiant;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftGiant;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Giant;
import org.bukkit.util.Vector;
@ -52,7 +52,7 @@ public class GiantController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -6,12 +6,12 @@ import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.StringHelper;
import net.minecraft.server.v1_4_5.ItemInWorldManager;
import net.minecraft.server.v1_4_5.WorldServer;
import net.minecraft.server.v1_4_6.PlayerInteractManager;
import net.minecraft.server.v1_4_6.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_4_5.CraftWorld;
import org.bukkit.craftbukkit.v1_4_6.CraftWorld;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -20,7 +20,7 @@ public class HumanController extends AbstractEntityController {
protected LivingEntity createEntity(final Location at, final NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
final EntityHumanNPC handle = new EntityHumanNPC(ws.getServer().getServer(), ws,
StringHelper.parseColors(npc.getFullName()), new ItemInWorldManager(ws), npc);
StringHelper.parseColors(npc.getFullName()), new PlayerInteractManager(ws), npc);
handle.getBukkitEntity().teleport(at);
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityIronGolem;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityIronGolem;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftIronGolem;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftIronGolem;
import org.bukkit.entity.Entity;
import org.bukkit.entity.IronGolem;
import org.bukkit.util.Vector;
@ -50,7 +50,7 @@ public class IronGolemController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityMagmaCube;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityMagmaCube;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftMagmaCube;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftMagmaCube;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.util.Vector;
@ -62,7 +62,7 @@ public class MagmaCubeController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityMushroomCow;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityMushroomCow;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftMushroomCow;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftMushroomCow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MushroomCow;
import org.bukkit.util.Vector;
@ -52,7 +52,7 @@ public class MushroomCowController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityOcelot;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityOcelot;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftOcelot;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftOcelot;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ocelot;
import org.bukkit.util.Vector;
@ -51,7 +51,7 @@ public class OcelotController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -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_4_5.EntityLightning;
import net.minecraft.server.v1_4_5.EntityPig;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityLightning;
import net.minecraft.server.v1_4_6.EntityPig;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPig;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPig;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Pig;
import org.bukkit.util.Vector;
@ -58,7 +58,7 @@ public class PigController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityPigZombie;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityPigZombie;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPigZombie;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPigZombie;
import org.bukkit.entity.Entity;
import org.bukkit.entity.PigZombie;
import org.bukkit.util.Vector;
@ -62,7 +62,7 @@ public class PigZombieController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntitySheep;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntitySheep;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftSheep;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSheep;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Sheep;
import org.bukkit.util.Vector;
@ -51,7 +51,7 @@ public class SheepController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntitySilverfish;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntitySilverfish;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftSilverfish;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSilverfish;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Silverfish;
import org.bukkit.util.Vector;
@ -61,7 +61,7 @@ public class SilverfishController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntitySkeleton;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntitySkeleton;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftSkeleton;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSkeleton;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Skeleton;
import org.bukkit.util.Vector;
@ -51,7 +51,7 @@ public class SkeletonController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntitySlime;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntitySlime;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftSlime;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSlime;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Slime;
import org.bukkit.util.Vector;
@ -63,7 +63,7 @@ public class SlimeController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntitySnowman;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntitySnowman;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftSnowman;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSnowman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Snowman;
import org.bukkit.util.Vector;
@ -51,7 +51,7 @@ public class SnowmanController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntitySpider;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntitySpider;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftSpider;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSpider;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Spider;
import org.bukkit.util.Vector;
@ -61,7 +61,7 @@ public class SpiderController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntitySquid;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntitySquid;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftSquid;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSquid;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Squid;
import org.bukkit.util.Vector;
@ -52,7 +52,7 @@ public class SquidController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -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_4_5.EntityHuman;
import net.minecraft.server.v1_4_5.EntityVillager;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityHuman;
import net.minecraft.server.v1_4_6.EntityVillager;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftVillager;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftVillager;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Villager;
import org.bukkit.util.Vector;
@ -59,7 +59,7 @@ public class VillagerController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityWitch;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityWitch;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftWitch;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftWitch;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Witch;
import org.bukkit.util.Vector;
@ -51,7 +51,7 @@ public class WitchController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityWither;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityWither;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftWither;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftWither;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Wither;
import org.bukkit.util.Vector;
@ -57,7 +57,7 @@ public class WitherController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityWolf;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityWolf;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftWolf;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftWolf;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Wolf;
import org.bukkit.util.Vector;
@ -51,7 +51,7 @@ public class WolfController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -7,12 +7,12 @@ import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityZombie;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.EntityZombie;
import net.minecraft.server.v1_4_6.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftZombie;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Zombie;
import org.bukkit.util.Vector;
@ -51,7 +51,7 @@ public class ZombieController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_4_5.Entity entity) {
public void collide(net.minecraft.server.v1_4_6.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);

View File

@ -1,23 +1,23 @@
package net.citizensnpcs.npc.network;
import net.minecraft.server.v1_4_5.EntityPlayer;
import net.minecraft.server.v1_4_5.MinecraftServer;
import net.minecraft.server.v1_4_5.NetServerHandler;
import net.minecraft.server.v1_4_5.NetworkManager;
import net.minecraft.server.v1_4_5.Packet;
import net.minecraft.server.v1_4_5.Packet102WindowClick;
import net.minecraft.server.v1_4_5.Packet106Transaction;
import net.minecraft.server.v1_4_5.Packet10Flying;
import net.minecraft.server.v1_4_5.Packet130UpdateSign;
import net.minecraft.server.v1_4_5.Packet14BlockDig;
import net.minecraft.server.v1_4_5.Packet15Place;
import net.minecraft.server.v1_4_5.Packet16BlockItemSwitch;
import net.minecraft.server.v1_4_5.Packet255KickDisconnect;
import net.minecraft.server.v1_4_5.Packet28EntityVelocity;
import net.minecraft.server.v1_4_5.Packet3Chat;
import net.minecraft.server.v1_4_5.Packet51MapChunk;
import net.minecraft.server.v1_4_6.EntityPlayer;
import net.minecraft.server.v1_4_6.MinecraftServer;
import net.minecraft.server.v1_4_6.PlayerConnection;
import net.minecraft.server.v1_4_6.NetworkManager;
import net.minecraft.server.v1_4_6.Packet;
import net.minecraft.server.v1_4_6.Packet102WindowClick;
import net.minecraft.server.v1_4_6.Packet106Transaction;
import net.minecraft.server.v1_4_6.Packet10Flying;
import net.minecraft.server.v1_4_6.Packet130UpdateSign;
import net.minecraft.server.v1_4_6.Packet14BlockDig;
import net.minecraft.server.v1_4_6.Packet15Place;
import net.minecraft.server.v1_4_6.Packet16BlockItemSwitch;
import net.minecraft.server.v1_4_6.Packet255KickDisconnect;
import net.minecraft.server.v1_4_6.Packet28EntityVelocity;
import net.minecraft.server.v1_4_6.Packet3Chat;
import net.minecraft.server.v1_4_6.Packet51MapChunk;
public class EmptyNetHandler extends NetServerHandler {
public class EmptyNetHandler extends PlayerConnection {
public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager,
EntityPlayer entityPlayer) {
super(minecraftServer, networkManager, entityPlayer);

View File

@ -5,15 +5,15 @@ import java.net.Socket;
import java.security.PrivateKey;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_4_5.NetHandler;
import net.minecraft.server.v1_4_5.NetworkManager;
import net.minecraft.server.v1_4_5.Packet;
import net.minecraft.server.v1_4_6.Connection;
import net.minecraft.server.v1_4_6.NetworkManager;
import net.minecraft.server.v1_4_6.Packet;
public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(Socket socket, String string, NetHandler netHandler, PrivateKey key)
public EmptyNetworkManager(Socket socket, String string, Connection conn, PrivateKey key)
throws IOException {
super(socket, string, netHandler, key);
super(socket, string, conn, key);
NMS.stopNetworkThreads(this);
}
@ -23,7 +23,7 @@ public class EmptyNetworkManager extends NetworkManager {
}
@Override
public void a(NetHandler netHandler) {
public void a(Connection conn) {
}
@Override

View File

@ -12,11 +12,11 @@ import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.command.CommandConfigurable;
import net.citizensnpcs.command.CommandContext;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_4_5.EntityLiving;
import net.minecraft.server.v1_4_5.EntityPlayer;
import net.minecraft.server.v1_4_6.EntityLiving;
import net.minecraft.server.v1_4_6.EntityPlayer;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;

View File

@ -1,8 +1,8 @@
package net.citizensnpcs.trait.waypoint;
import net.minecraft.server.v1_4_5.DamageSource;
import net.minecraft.server.v1_4_5.EntityEnderCrystal;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.DamageSource;
import net.minecraft.server.v1_4_6.EntityEnderCrystal;
import net.minecraft.server.v1_4_6.World;
public class EntityEnderCrystalMarker extends EntityEnderCrystal {
public EntityEnderCrystalMarker(World world) {

View File

@ -9,31 +9,31 @@ import java.util.Set;
import java.util.WeakHashMap;
import net.citizensnpcs.api.npc.NPC;
import net.minecraft.server.v1_4_5.ControllerJump;
import net.minecraft.server.v1_4_5.ControllerLook;
import net.minecraft.server.v1_4_5.DamageSource;
import net.minecraft.server.v1_4_5.EnchantmentManager;
import net.minecraft.server.v1_4_5.Entity;
import net.minecraft.server.v1_4_5.EntityLiving;
import net.minecraft.server.v1_4_5.EntityMonster;
import net.minecraft.server.v1_4_5.EntityTypes;
import net.minecraft.server.v1_4_5.MathHelper;
import net.minecraft.server.v1_4_5.MobEffectList;
import net.minecraft.server.v1_4_5.Navigation;
import net.minecraft.server.v1_4_5.NetworkManager;
import net.minecraft.server.v1_4_5.Packet;
import net.minecraft.server.v1_4_5.PathfinderGoalSelector;
import net.minecraft.server.v1_4_5.World;
import net.minecraft.server.v1_4_6.ControllerJump;
import net.minecraft.server.v1_4_6.ControllerLook;
import net.minecraft.server.v1_4_6.DamageSource;
import net.minecraft.server.v1_4_6.EnchantmentManager;
import net.minecraft.server.v1_4_6.Entity;
import net.minecraft.server.v1_4_6.EntityLiving;
import net.minecraft.server.v1_4_6.EntityMonster;
import net.minecraft.server.v1_4_6.EntityTypes;
import net.minecraft.server.v1_4_6.MathHelper;
import net.minecraft.server.v1_4_6.MobEffectList;
import net.minecraft.server.v1_4_6.Navigation;
import net.minecraft.server.v1_4_6.NetworkManager;
import net.minecraft.server.v1_4_6.Packet;
import net.minecraft.server.v1_4_6.PathfinderGoalSelector;
import net.minecraft.server.v1_4_6.World;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
import org.bukkit.craftbukkit.v1_4_5.CraftWorld;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
import org.bukkit.craftbukkit.v1_4_6.CraftWorld;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -218,7 +218,7 @@ public class NMS {
public static void look(LivingEntity bukkitEntity, float yaw, float pitch) {
EntityLiving handle = getHandle(bukkitEntity);
handle.yaw = handle.ay = yaw;
handle.yaw = handle.az = yaw;
handle.pitch = pitch;
}
@ -238,7 +238,7 @@ public class NMS {
}
public static void sendPacket(Player player, Packet packet) {
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(packet);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
public static void setDestination(LivingEntity bukkitEntity, double x, double y, double z, float speed) {
@ -246,7 +246,7 @@ public class NMS {
}
public static void setHeadYaw(EntityLiving handle, float yaw) {
handle.ay = yaw;
handle.az = yaw;
}
public static void setLandSpeedModifier(EntityLiving handle, float speed) {
@ -353,8 +353,8 @@ public class NMS {
MOVEMENT_SPEEDS.put(EntityType.PLAYER, 1F);
MOVEMENT_SPEEDS.put(EntityType.VILLAGER, 0.3F);
LAND_SPEED_MODIFIER_FIELD = getField(EntityLiving.class, "bO");
SPEED_FIELD = getField(EntityLiving.class, "bG");
LAND_SPEED_MODIFIER_FIELD = getField(EntityLiving.class, "bP");
SPEED_FIELD = getField(EntityLiving.class, "bH");
NAVIGATION_WORLD_FIELD = getField(Navigation.class, "b");
PATHFINDING_RANGE = getField(Navigation.class, "e");
GOAL_FIELD = getField(PathfinderGoalSelector.class, "a");

View File

@ -1,12 +1,12 @@
package net.citizensnpcs.util;
import net.minecraft.server.v1_4_5.EntityPlayer;
import net.minecraft.server.v1_4_5.Packet;
import net.minecraft.server.v1_4_5.Packet17EntityLocationAction;
import net.minecraft.server.v1_4_5.Packet18ArmAnimation;
import net.minecraft.server.v1_4_5.Packet40EntityMetadata;
import net.minecraft.server.v1_4_6.EntityPlayer;
import net.minecraft.server.v1_4_6.Packet;
import net.minecraft.server.v1_4_6.Packet17EntityLocationAction;
import net.minecraft.server.v1_4_6.Packet18ArmAnimation;
import net.minecraft.server.v1_4_6.Packet40EntityMetadata;
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPlayer;
import org.bukkit.entity.Player;
public enum PlayerAnimation {