Preliminary update to MC 1.6.1: NOTE THAT PLAYER PATHFINDING DOES NOT WORK FULLY YET

This commit is contained in:
fullwall 2013-07-02 12:36:00 +08:00
parent 73ec77eaa0
commit df97053e91
56 changed files with 1751 additions and 699 deletions

27
pom.xml
View File

@ -6,13 +6,13 @@
<groupId>net.citizensnpcs</groupId>
<artifactId>citizens</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.9-SNAPSHOT</version>
<name>Citizens</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<craftbukkit.version>1.5.2-R0.1-SNAPSHOT</craftbukkit.version>
<citizensapi.version>2.0.8-SNAPSHOT</citizensapi.version>
<craftbukkit.version>LATEST</craftbukkit.version>
<citizensapi.version>2.0.9-SNAPSHOT</citizensapi.version>
<vault.version>1.2.19-SNAPSHOT</vault.version>
<powermock.version>1.4.12</powermock.version>
<build.number>Unknown</build.number>
@ -34,7 +34,21 @@
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bukkit-plugins</id>
<url>http://repo.bukkit.org/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>${craftbukkit.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
@ -97,7 +111,6 @@
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@ -112,6 +125,12 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<excludes>
<exclude>net.minecraft.server.*</exclude>
<exclude>org.bukkit.craftbukkit.*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>

View File

@ -431,5 +431,5 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
return false;
}
private static final String COMPATIBLE_MC_VERSION = "1.5.2";
private static final String COMPATIBLE_MC_VERSION = "1.6.1";
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2011 Tyler Blair. All rights reserved.
* Copyright 2011-2013 Tyler Blair. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@ -25,14 +25,14 @@
* authors and contributors and should not be interpreted as representing official policies,
* either expressed or implied, of anybody else.
*/
package net.citizensnpcs;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.Proxy;
import java.net.URL;
@ -45,6 +45,7 @@ import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
@ -53,22 +54,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
/**
* <p>
* The metrics class obtains data about a plugin and submits statistics about it
* to the metrics backend.
* </p>
* <p>
* Public methods provided by this class:
* </p>
* <code>
* Graph createGraph(String name); <br/>
* void addCustomData(Metrics.Plotter plotter); <br/>
* void start(); <br/>
* </code>
*/
public class Metrics {
/**
* The plugin configuration file
*/
@ -84,12 +70,6 @@ public class Metrics {
*/
private final boolean debug;
/**
* The default graph, used for addCustomData when you don't want a specific
* graph
*/
private final Graph defaultGraph = new Graph("Default");
/**
* All of the custom graphs to submit to metrics
*/
@ -142,27 +122,15 @@ public class Metrics {
debug = configuration.getBoolean("debug", false);
}
/**
* Adds a custom data plotter to the default graph
*
* @param plotter
* The plotter to use to plot custom data
*/
public void addCustomData(final Plotter plotter) {
if (plotter == null) {
throw new IllegalArgumentException("Plotter cannot be null");
}
// Add the plotter to the graph o/
defaultGraph.addPlotter(plotter);
// Ensure the default graph is included in the submitted graphs
graphs.add(defaultGraph);
public void addCustomData(Plotter plotter) {
Graph graph = new Graph(plotter.name);
graph.addPlotter(plotter);
addGraph(graph);
}
/**
* Add a Graph object to Metrics that represents data for the plugin that
* should be sent to the backend
* Add a Graph object to BukkitMetrics that represents data for the plugin
* that should be sent to the backend
*
* @param graph
* The name of the graph
@ -204,7 +172,7 @@ public class Metrics {
* Disables metrics for the server by setting "opt-out" to true in the
* config file and canceling the metrics task.
*
* @throws IOException
* @throws java.io.IOException
*/
public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the
@ -229,7 +197,7 @@ public class Metrics {
* Enables metrics for the server by setting "opt-out" to false in the
* config file and starting the metrics task.
*
* @throws IOException
* @throws java.io.IOException
*/
public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the
@ -326,15 +294,15 @@ public class Metrics {
// any code outside of this class / Java
// Construct the post data
final StringBuilder data = new StringBuilder();
StringBuilder json = new StringBuilder(1024);
json.append('{');
// The plugin's description file containg all of the plugin data such as
// name, version, author, etc
data.append(encode("guid")).append('=').append(encode(guid));
encodeDataPair(data, "version", pluginVersion);
encodeDataPair(data, "server", serverVersion);
encodeDataPair(data, "players", Integer.toString(playersOnline));
encodeDataPair(data, "revision", String.valueOf(REVISION));
appendJSONPair(json, "guid", guid);
appendJSONPair(json, "plugin_version", pluginVersion);
appendJSONPair(json, "server_version", serverVersion);
appendJSONPair(json, "players_online", Integer.toString(playersOnline));
// New data as of R6
String osname = System.getProperty("os.name");
@ -348,49 +316,63 @@ public class Metrics {
osarch = "x86_64";
}
encodeDataPair(data, "osname", osname);
encodeDataPair(data, "osarch", osarch);
encodeDataPair(data, "osversion", osversion);
encodeDataPair(data, "cores", Integer.toString(coreCount));
encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
encodeDataPair(data, "java_version", java_version);
appendJSONPair(json, "osname", osname);
appendJSONPair(json, "osarch", osarch);
appendJSONPair(json, "osversion", osversion);
appendJSONPair(json, "cores", Integer.toString(coreCount));
appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
appendJSONPair(json, "java_version", java_version);
// If we're pinging, append it
if (isPing) {
encodeDataPair(data, "ping", "true");
appendJSONPair(json, "ping", "1");
}
// Acquire a lock on the graphs, which lets us make the assumption we
// also lock everything
// inside of the graph (e.g plotters)
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
if (graphs.size() > 0) {
synchronized (graphs) {
json.append(',');
json.append('"');
json.append("graphs");
json.append('"');
json.append(':');
json.append('{');
while (iter.hasNext()) {
final Graph graph = iter.next();
boolean firstGraph = true;
for (Plotter plotter : graph.getPlotters()) {
// The key name to send to the metrics server
// The format is C-GRAPHNAME-PLOTTERNAME where separator -
// is defined at the top
// Legacy (R4) submitters use the format Custom%s, or
// CustomPLOTTERNAME
final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(),
CUSTOM_DATA_SEPARATOR, plotter.getColumnName());
final Iterator<Graph> iter = graphs.iterator();
// The value to send, which for the foreseeable future is
// just the string
// value of plotter.getValue()
final String value = Integer.toString(plotter.getValue());
while (iter.hasNext()) {
Graph graph = iter.next();
// Add it to the http post data :)
encodeDataPair(data, key, value);
StringBuilder graphJson = new StringBuilder();
graphJson.append('{');
for (Plotter plotter : graph.getPlotters()) {
appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
}
graphJson.append('}');
if (!firstGraph) {
json.append(',');
}
json.append(escapeJSON(graph.getName()));
json.append(':');
json.append(graphJson);
firstGraph = false;
}
json.append('}');
}
}
// close json
json.append('}');
// Create the url
URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(pluginName)));
URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
// Connect to the website
URLConnection connection;
@ -403,26 +385,48 @@ public class Metrics {
connection = url.openConnection();
}
byte[] uncompressed = json.toString().getBytes();
byte[] compressed = gzip(json.toString());
// Headers
connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
connection.addRequestProperty("Content-Type", "application/json");
connection.addRequestProperty("Content-Encoding", "gzip");
connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
connection.addRequestProperty("Accept", "application/json");
connection.addRequestProperty("Connection", "close");
connection.setDoOutput(true);
if (debug) {
System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length
+ " compressed=" + compressed.length);
}
// Write the data
final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(data.toString());
writer.flush();
OutputStream os = connection.getOutputStream();
os.write(compressed);
os.flush();
// Now read the response
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
final String response = reader.readLine();
String response = reader.readLine();
// close resources
writer.close();
os.close();
reader.close();
if (response == null || response.startsWith("ERR")) {
throw new IOException(response); // Throw the exception
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
if (response == null) {
response = "null";
} else if (response.startsWith("7")) {
response = response.substring(response.startsWith("7,") ? 2 : 1);
}
throw new IOException(response);
} else {
// Is this the first update this hour?
if (response.contains("OK This is your first update this hour")) {
if (response.equals("1") || response.contains("This is your first update this hour")) {
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
@ -556,7 +560,7 @@ public class Metrics {
/**
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
*
* @return an unmodifiable {@link Set} of the plotter objects
* @return an unmodifiable {@link java.util.Set} of the plotter objects
*/
public Set<Plotter> getPlotters() {
return Collections.unmodifiableSet(plotters);
@ -568,8 +572,8 @@ public class Metrics {
}
/**
* Called when the server owner decides to opt-out of Metrics while the
* server is running.
* Called when the server owner decides to opt-out of BukkitMetrics
* while the server is running.
*/
protected void onOptOut() {
}
@ -583,7 +587,6 @@ public class Metrics {
public void removePlotter(final Plotter plotter) {
plotters.remove(plotter);
}
}
/**
@ -654,34 +657,114 @@ public class Metrics {
*/
public void reset() {
}
}
/**
* The base url of the metrics domain
* Appends a json encoded key/value pair to the given string builder.
*
* @param json
* @param key
* @param value
* @throws UnsupportedEncodingException
*/
private static final String BASE_URL = "http://mcstats.org";
private static void appendJSONPair(StringBuilder json, String key, String value)
throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
}
} catch (NumberFormatException e) {
isValueNumeric = false;
}
if (json.charAt(json.length() - 1) != '{') {
json.append(',');
}
json.append(escapeJSON(key));
json.append(':');
if (isValueNumeric) {
json.append(value);
} else {
json.append(escapeJSON(value));
}
}
/**
* The separator to use for custom data. This MUST NOT change unless you are
* hosting your own version of metrics and want to change it.
* Escape a string to create a valid JSON string
*
* @param text
* @return
*/
private static final String CUSTOM_DATA_SEPARATOR = "~~";
private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
builder.append(chr);
break;
case '\b':
builder.append("\\b");
break;
case '\t':
builder.append("\\t");
break;
case '\n':
builder.append("\\n");
break;
case '\r':
builder.append("\\r");
break;
default:
if (chr < ' ') {
String t = "000" + Integer.toHexString(chr);
builder.append("\\u" + t.substring(t.length() - 4));
} else {
builder.append(chr);
}
break;
}
}
builder.append('"');
return builder.toString();
}
/**
* Interval of time to ping (in minutes)
* GZip compress a string of bytes
*
* @param input
* @return
*/
private static final int PING_INTERVAL = 10;
public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
/**
* The url used to report a server's status
*/
private static final String REPORT_URL = "/report/%s";
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
} catch (IOException e) {
e.printStackTrace();
} finally {
if (gzos != null)
try {
gzos.close();
} catch (IOException ignore) {
}
}
/**
* The current revision number
*/
private final static int REVISION = 6;
return baos.toByteArray();
}
/**
* Encode text as UTF-8
@ -690,31 +773,27 @@ public class Metrics {
* the text to encode
* @return the encoded text, as UTF-8
*/
private static String encode(final String text) throws UnsupportedEncodingException {
private static String urlEncode(final String text) throws UnsupportedEncodingException {
return URLEncoder.encode(text, "UTF-8");
}
/**
* <p>
* Encode a key/value data pair to be used in a HTTP post request. This
* INCLUDES a & so the first key/value pair MUST be included manually, e.g:
* </p>
* <code>
* StringBuffer data = new StringBuffer();
* data.append(encode("guid")).append('=').append(encode(guid));
* encodeDataPair(data, "version", description.getVersion());
* </code>
*
* @param buffer
* the stringbuilder to append the data pair onto
* @param key
* the key value
* @param value
* the value
* The base url of the metrics domain
*/
private static void encodeDataPair(final StringBuilder buffer, final String key, final String value)
throws UnsupportedEncodingException {
buffer.append('&').append(encode(key)).append('=').append(encode(value));
}
private static final String BASE_URL = "http://report.mcstats.org";
/**
* Interval of time to ping (in minutes)
*/
private static final int PING_INTERVAL = 15;
/**
* The url used to report a server's status
*/
private static final String REPORT_URL = "/plugin/%s";
/**
* The current revision number
*/
private final static int REVISION = 7;
}

View File

@ -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_5_R3.EntityLiving;
import net.minecraft.server.v1_6_R1.EntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;

View File

@ -12,6 +12,7 @@ import net.citizensnpcs.npc.entity.EnderDragonController;
import net.citizensnpcs.npc.entity.EndermanController;
import net.citizensnpcs.npc.entity.GhastController;
import net.citizensnpcs.npc.entity.GiantController;
import net.citizensnpcs.npc.entity.HorseController;
import net.citizensnpcs.npc.entity.HumanController;
import net.citizensnpcs.npc.entity.IronGolemController;
import net.citizensnpcs.npc.entity.MagmaCubeController;
@ -38,8 +39,6 @@ import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
public class EntityControllers {
private static final Map<EntityType, Class<? extends EntityController>> TYPES = Maps.newEnumMap(EntityType.class);
public static EntityController createForType(EntityType type) {
Class<? extends EntityController> controllerClass = TYPES.get(type);
if (controllerClass == null)
@ -56,6 +55,8 @@ public class EntityControllers {
TYPES.put(type, controller);
}
private static final Map<EntityType, Class<? extends EntityController>> TYPES = Maps.newEnumMap(EntityType.class);
static {
TYPES.put(EntityType.BAT, BatController.class);
TYPES.put(EntityType.BLAZE, BlazeController.class);
@ -67,6 +68,7 @@ public class EntityControllers {
TYPES.put(EntityType.ENDERMAN, EndermanController.class);
TYPES.put(EntityType.GHAST, GhastController.class);
TYPES.put(EntityType.GIANT, GiantController.class);
TYPES.put(EntityType.HORSE, HorseController.class);
TYPES.put(EntityType.IRON_GOLEM, IronGolemController.class);
TYPES.put(EntityType.MAGMA_CUBE, MagmaCubeController.class);
TYPES.put(EntityType.MUSHROOM_COW, MushroomCowController.class);

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_5_R3.EntityLiving;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityLiving;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
import org.bukkit.entity.LivingEntity;
import com.google.common.collect.Maps;

View File

@ -10,12 +10,9 @@ 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_5_R3.EntityLiving;
import net.minecraft.server.v1_6_R1.EntityLiving;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.util.Vector;
public class AStarNavigationStrategy extends AbstractPathStrategy {
@ -62,8 +59,6 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
return true;
}
vector = plan.getCurrentVector();
World world = npc.getBukkitEntity().getWorld();
world.playEffect(vector.toLocation(world), Effect.STEP_SOUND, Material.STONE.getId());
}
EntityLiving handle = NMS.getHandle(npc.getBukkitEntity());
double dX = vector.getBlockX() - handle.locX;

View File

@ -3,17 +3,17 @@ 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_5_R3.Block;
import net.minecraft.server.v1_5_R3.Enchantment;
import net.minecraft.server.v1_5_R3.EnchantmentManager;
import net.minecraft.server.v1_5_R3.EntityLiving;
import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_5_R3.ItemStack;
import net.minecraft.server.v1_5_R3.Material;
import net.minecraft.server.v1_5_R3.MobEffectList;
import net.minecraft.server.v1_6_R1.Block;
import net.minecraft.server.v1_6_R1.Enchantment;
import net.minecraft.server.v1_6_R1.EnchantmentManager;
import net.minecraft.server.v1_6_R1.EntityLiving;
import net.minecraft.server.v1_6_R1.EntityPlayer;
import net.minecraft.server.v1_6_R1.ItemStack;
import net.minecraft.server.v1_6_R1.Material;
import net.minecraft.server.v1_6_R1.MobEffectList;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_5_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R1.inventory.CraftItemStack;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -39,7 +39,7 @@ 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_5_R3.ItemStack getCurrentItem() {
private net.minecraft.server.v1_6_R1.ItemStack getCurrentItem() {
return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) : entity.getEquipment(0);
}

View File

@ -163,7 +163,7 @@ public class CitizensNavigator implements Navigator, Runnable {
}
localParams = defaultParams.clone();
PathStrategy newStrategy;
if (Setting.USE_NEW_PATHFINDER.asBoolean()) {
if (Setting.USE_NEW_PATHFINDER.asBoolean() || NMS.isSentient(npc.getBukkitEntity())) {
newStrategy = new AStarNavigationStrategy(npc, target, localParams);
} else
newStrategy = new MCNavigationStrategy(npc, target, localParams);

View File

@ -4,11 +4,11 @@ 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_5_R3.EntityLiving;
import net.minecraft.server.v1_5_R3.Navigation;
import net.minecraft.server.v1_6_R1.EntityInsentient;
import net.minecraft.server.v1_6_R1.Navigation;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
public class MCNavigationStrategy extends AbstractPathStrategy {
private final Navigation navigation;
@ -19,7 +19,7 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
super(TargetType.LOCATION);
this.target = dest;
this.parameters = params;
EntityLiving handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
EntityInsentient handle = (EntityInsentient) ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
handle.onGround = true;
// not sure of a better way around this - if onGround is false, then
// navigation won't execute, and calling entity.move doesn't
@ -27,7 +27,7 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
navigation = handle.getNavigation();
navigation.a(parameters.avoidWater());
navigation.a(dest.getX(), dest.getY(), dest.getZ(), parameters.speed());
if (navigation.f())
if (navigation.g())
setCancelReason(CancelReason.STUCK);
}
@ -57,6 +57,6 @@ public class MCNavigationStrategy extends AbstractPathStrategy {
return true;
navigation.a(parameters.avoidWater());
navigation.a(parameters.speed());
return navigation.f();
return navigation.g();
}
}

View File

@ -11,15 +11,16 @@ 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_5_R3.Entity;
import net.minecraft.server.v1_5_R3.EntityLiving;
import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_5_R3.Navigation;
import net.minecraft.server.v1_5_R3.PathEntity;
import net.minecraft.server.v1_6_R1.Entity;
import net.minecraft.server.v1_6_R1.EntityInsentient;
import net.minecraft.server.v1_6_R1.EntityLiving;
import net.minecraft.server.v1_6_R1.EntityPlayer;
import net.minecraft.server.v1_6_R1.Navigation;
import net.minecraft.server.v1_6_R1.PathEntity;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
public class MCTargetStrategy implements PathStrategy, EntityTarget {
@ -27,18 +28,19 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
private int attackTicks;
private CancelReason cancelReason;
private final EntityLiving handle;
private final Navigation navigation;
private final NPC npc;
private final NavigatorParameters parameters;
private final TargetNavigator targetNavigator;
private final Entity target;
private final NavigationFieldWrapper wrapper;
public MCTargetStrategy(NPC handle, org.bukkit.entity.Entity target, boolean aggro, NavigatorParameters params) {
this.handle = ((CraftLivingEntity) handle.getBukkitEntity()).getHandle();
public MCTargetStrategy(NPC npc, org.bukkit.entity.Entity target, boolean aggro, NavigatorParameters params) {
this.npc = npc;
this.handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
this.target = ((CraftEntity) target).getHandle();
this.navigation = this.handle.getNavigation();
this.targetNavigator = this.handle instanceof EntityInsentient ? new NavigationFieldWrapper(
((EntityInsentient) this.handle).getNavigation()) : new AStarTargeter();
this.aggro = aggro;
this.parameters = params;
this.wrapper = new NavigationFieldWrapper(this.navigation);
}
private boolean canAttack() {
@ -87,12 +89,12 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
}
private void setPath() {
navigation.a(wrapper.findPath(handle, target), parameters.speed());
targetNavigator.setPath();
}
@Override
public void stop() {
navigation.g();
targetNavigator.stop();
}
@Override
@ -112,7 +114,6 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
}
if (cancelReason != null)
return true;
navigation.a(parameters.avoidWater());
setPath();
NMS.look(handle, target);
if (aggro && canAttack()) {
@ -133,11 +134,31 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
return false;
}
private class NavigationFieldWrapper {
private class AStarTargeter implements TargetNavigator {
private AStarNavigationStrategy strategy = new AStarNavigationStrategy(npc, target.getBukkitEntity()
.getLocation(TARGET_LOCATION), parameters);
@Override
public void setPath() {
strategy = new AStarNavigationStrategy(npc, target.getBukkitEntity().getLocation(TARGET_LOCATION),
parameters);
strategy.update();
cancelReason = strategy.getCancelReason();
}
@Override
public void stop() {
strategy.stop();
}
}
private class NavigationFieldWrapper implements TargetNavigator {
float e;
boolean j = true, k, l, m;
private final Navigation navigation;
private NavigationFieldWrapper(Navigation navigation) {
this.navigation = navigation;
this.k = navigation.c();
this.l = navigation.a();
try {
@ -155,12 +176,28 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
public PathEntity findPath(Entity from, Entity to) {
return handle.world.findPath(from, to, e, j, k, l, m);
}
@Override
public void setPath() {
navigation.a(parameters.avoidWater());
navigation.a(findPath(handle, target), parameters.speed());
}
@Override
public void stop() {
navigation.g();
}
}
private static interface TargetNavigator {
void setPath();
void stop();
}
private static final int ATTACK_DELAY_TICKS = 20;
private static final Location HANDLE_LOCATION = new Location(null, 0, 0, 0);
private static Field NAV_E, NAV_J, NAV_M;
private static final Location TARGET_LOCATION = new Location(null, 0, 0, 0);
static {

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_5_R3.EntityBat;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityBat;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftBat;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftBat;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.Bat;
import org.bukkit.util.Vector;
@ -58,22 +58,22 @@ public class BatController extends MobEntityController {
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
@Override
public void bo() {
public void be() {
if (npc == null)
super.bo();
super.be();
else {
NMS.updateAI(this);
npc.update();
}
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityBlaze;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityBlaze;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftBlaze;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.Blaze;
import org.bukkit.util.Vector;
@ -56,23 +56,23 @@ public class BlazeController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bq() {
public void bh() {
if (npc != null) {
NMS.updateAI(this);
npc.update();
} else {
super.bq();
super.bh();
}
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityCaveSpider;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityCaveSpider;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftCaveSpider;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.CaveSpider;
import org.bukkit.util.Vector;
@ -58,21 +58,21 @@ public class CaveSpiderController extends MobEntityController {
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bq() {
public void bh() {
if (npc == null)
super.bq();
super.bh();
else {
NMS.updateAI(this);
npc.update();
@ -80,7 +80,7 @@ public class CaveSpiderController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityChicken;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityChicken;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftChicken;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.Chicken;
import org.bukkit.util.Vector;
@ -53,24 +53,23 @@ public class ChickenController extends MobEntityController {
this.npc = (CitizensNPC) npc;
if (npc != null) {
NMS.clearGoals(goalSelector, targetSelector);
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityCow;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityCow;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftCow;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftCow;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.Cow;
import org.bukkit.util.Vector;
@ -57,20 +57,21 @@ public class CowController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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,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_5_R3.EntityCreeper;
import net.minecraft.server.v1_5_R3.EntityLightning;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityCreeper;
import net.minecraft.server.v1_6_R1.EntityLightning;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.Creeper;
import org.bukkit.util.Vector;
@ -64,20 +64,20 @@ public class CreeperController extends MobEntityController {
super.a(entitylightning);
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityEnderDragon;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityEnderDragon;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.EnderDragon;
import org.bukkit.util.Vector;
@ -56,15 +56,16 @@ public class EnderDragonController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bq() {
if (npc == null)
super.bq();
public void bh() {
if (npc == null) {
super.bh();
}
}
@Override
@ -83,7 +84,7 @@ public class EnderDragonController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityEnderman;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityEnderman;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.Enderman;
import org.bukkit.util.Vector;
@ -56,22 +56,22 @@ public class EndermanController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void bq() {
public void bh() {
if (npc == null)
super.bq();
super.bh();
else {
NMS.updateAI(this);
npc.update();
@ -89,7 +89,7 @@ public class EndermanController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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,29 +13,36 @@ 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_5_R3.Connection;
import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_5_R3.EnumGamemode;
import net.minecraft.server.v1_5_R3.MathHelper;
import net.minecraft.server.v1_5_R3.MinecraftServer;
import net.minecraft.server.v1_5_R3.Navigation;
import net.minecraft.server.v1_5_R3.NetworkManager;
import net.minecraft.server.v1_5_R3.Packet;
import net.minecraft.server.v1_5_R3.Packet35EntityHeadRotation;
import net.minecraft.server.v1_5_R3.Packet5EntityEquipment;
import net.minecraft.server.v1_5_R3.PlayerInteractManager;
import net.minecraft.server.v1_5_R3.World;
import net.citizensnpcs.util.nms.PlayerControllerJump;
import net.citizensnpcs.util.nms.PlayerControllerLook;
import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.minecraft.server.v1_6_R1.Connection;
import net.minecraft.server.v1_6_R1.Entity;
import net.minecraft.server.v1_6_R1.EntityPlayer;
import net.minecraft.server.v1_6_R1.EnumGamemode;
import net.minecraft.server.v1_6_R1.MathHelper;
import net.minecraft.server.v1_6_R1.MinecraftServer;
import net.minecraft.server.v1_6_R1.NetworkManager;
import net.minecraft.server.v1_6_R1.Packet;
import net.minecraft.server.v1_6_R1.Packet35EntityHeadRotation;
import net.minecraft.server.v1_6_R1.Packet5EntityEquipment;
import net.minecraft.server.v1_6_R1.PlayerInteractManager;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.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 PlayerControllerJump controllerJump;
private PlayerControllerLook controllerLook;
private PlayerControllerMove controllerMove;
private boolean gravity = true;
private int jumpTicks = 0;
private final CitizensNPC npc;
private final Location packetLocationCache = new Location(null, 0, 0, 0);
private int packetUpdateCount;
@ -50,13 +57,13 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
initialise(minecraftServer);
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_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,6 +100,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
return super.getBukkitEntity();
}
public PlayerControllerJump getControllerJump() {
return controllerJump;
}
@Override
public NPC getNPC() {
return npc;
@ -102,19 +113,18 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
Socket socket = new EmptySocket();
NetworkManager conn = null;
try {
conn = new EmptyNetworkManager(server.getLogger(), socket, "npc mgr", new Connection() {
conn = new EmptyNetworkManager(minecraftServer.getLogger(), socket, "npc mgr", new Connection() {
@Override
public boolean a() {
return false;
}
}, server.F().getPrivate());
}, minecraftServer.H().getPrivate());
playerConnection = new EmptyNetHandler(minecraftServer, conn, this);
conn.a(playerConnection);
} catch (IOException e) {
// swallow
}
getNavigation().e(true);
Y = 1F; // stepHeight - must not stay as the default 0 (breaks steps).
// Check the EntityPlayer constructor for the new name.
@ -123,6 +133,13 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
} catch (IOException ex) {
// swallow
}
controllerJump = new PlayerControllerJump(this);
controllerLook = new PlayerControllerLook(this);
controllerMove = new PlayerControllerMove(this);
}
public boolean isNavigating() {
return npc.getNavigator().isNavigating();
}
@Override
@ -139,16 +156,15 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
// (onGround is normally updated by the client)
}
if (!npc.data().get("removefromplayerlist", true)) {
g();
h();
}
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
motX = motY = motZ = 0;
NMS.updateSenses(this);
if (navigating) {
Navigation navigation = getNavigation();
if (!navigation.f())
navigation.e();
// Navigation navigation = getNavigation();
// if (!navigation.g())
// navigation.e();
moveOnCurrentHeading();
} else if (motX != 0 || motZ != 0 || motY != 0) {
e(0, 0); // is this necessary? it does controllable but sometimes
@ -163,29 +179,44 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
private void moveOnCurrentHeading() {
NMS.updateAI(this);
// taken from EntityLiving update method
if (bG) {
if (bd) {
/* boolean inLiquid = G() || I();
if (inLiquid) {
motY += 0.04;
} else //(handled elsewhere)*/
if (onGround && bX == 0) {
bl();
bX = 10;
if (onGround && jumpTicks == 0) {
ba();
jumpTicks = 10;
}
} else
bX = 0;
jumpTicks = 0;
bD *= 0.98F;
bE *= 0.98F;
bF *= 0.9F;
be *= 0.98F;
bf *= 0.98F;
bg *= 0.9F;
float prev = aO;
aO *= bE();
e(bD, bE); // movement method
aO = prev;
e(be, bf); // movement method
NMS.setHeadYaw(this, yaw);
}
public void setMoveDestination(double x, double y, double z, float speed) {
controllerMove.a(x, y, z, speed);
}
public void setShouldJump() {
controllerJump.a();
}
public void setTargetLook(Entity target, float yawOffset, float renderOffset) {
controllerLook.a(target, yawOffset, renderOffset);
}
public void updateAI() {
controllerMove.c();
controllerLook.a();
controllerJump.b();
}
private void updatePackets(boolean navigating) {
if (++packetUpdateCount >= 30) {
Location current = getBukkitEntity().getLocation(packetLocationCache);
@ -203,16 +234,18 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
}
public static class PlayerNPC extends CraftPlayer implements NPCHolder {
private final CraftServer cserver;
private final CitizensNPC npc;
private PlayerNPC(EntityHumanNPC entity) {
super((CraftServer) Bukkit.getServer(), entity);
this.npc = entity.npc;
this.cserver = (CraftServer) Bukkit.getServer();
}
@Override
public List<MetadataValue> getMetadata(String metadataKey) {
return server.getEntityMetadata().getMetadata(this, metadataKey);
return cserver.getEntityMetadata().getMetadata(this, metadataKey);
}
@Override
@ -222,12 +255,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
@Override
public boolean hasMetadata(String metadataKey) {
return server.getEntityMetadata().hasMetadata(this, metadataKey);
return cserver.getEntityMetadata().hasMetadata(this, metadataKey);
}
@Override
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
cserver.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
}
public void setGravityEnabled(boolean enabled) {
@ -236,11 +269,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
server.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
cserver.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
}
private static final float EPSILON = 0.005F;
private static final Location LOADED_LOCATION = new Location(null, 0, 0, 0);
}

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_5_R3.EntityGhast;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityGhast;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftGhast;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftGhast;
import org.bukkit.entity.Ghast;
import org.bukkit.util.Vector;
@ -42,21 +42,21 @@ public class GhastController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bq() {
public void bh() {
if (npc != null) {
npc.update();
} else
super.bq();
super.bh();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityGiantZombie;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityGiantZombie;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftGiant;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftGiant;
import org.bukkit.entity.Giant;
import org.bukkit.util.Vector;
@ -42,15 +42,15 @@ public class GiantController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bq() {
public void bh() {
if (npc == null) {
super.bq();
super.bh();
} else {
NMS.updateAI(this);
npc.update();
@ -58,7 +58,7 @@ public class GiantController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_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,4 +114,5 @@ public class GiantController extends MobEntityController {
return npc;
}
}
}

View File

@ -0,0 +1,115 @@
package net.citizensnpcs.npc.entity;
import net.citizensnpcs.api.event.NPCPushEvent;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.MobEntityController;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_6_R1.EntityHorse;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftHorse;
import org.bukkit.entity.Horse;
import org.bukkit.util.Vector;
public class HorseController extends MobEntityController {
public HorseController() {
super(EntityHorseNPC.class);
}
@Override
public Horse getBukkitEntity() {
return (Horse) super.getBukkitEntity();
}
public static class EntityHorseNPC extends EntityHorse implements NPCHolder {
private final CitizensNPC npc;
public EntityHorseNPC(World world) {
this(world, null);
}
public EntityHorseNPC(World world, NPC npc) {
super(world);
this.npc = (CitizensNPC) npc;
if (npc != null) {
NMS.clearGoals(goalSelector, targetSelector);
}
}
/*@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void c() {
if (npc == null) {
super.c();
} else
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_6_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 g(double x, double y, double z) {
if (npc == null) {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
super.g(x, y, z);
return;
}
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.
}
@Override
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null && npc != null)
bukkitEntity = new HorseNPC(this);
return super.getBukkitEntity();
}
@Override
public NPC getNPC() {
return npc;
}
}
public static class HorseNPC extends CraftHorse implements NPCHolder {
private final CitizensNPC npc;
public HorseNPC(EntityHorseNPC entity) {
super((CraftServer) Bukkit.getServer(), entity);
this.npc = entity.npc;
}
@Override
public NPC getNPC() {
return npc;
}
}
}

View File

@ -6,12 +6,12 @@ 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_5_R3.PlayerInteractManager;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.PlayerInteractManager;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

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_5_R3.EntityIronGolem;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityIronGolem;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftIronGolem;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftIronGolem;
import org.bukkit.entity.IronGolem;
import org.bukkit.util.Vector;
@ -42,20 +42,20 @@ public class IronGolemController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityMagmaCube;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityMagmaCube;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftMagmaCube;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftMagmaCube;
import org.bukkit.entity.MagmaCube;
import org.bukkit.util.Vector;
@ -43,22 +43,22 @@ public class MagmaCubeController extends MobEntityController {
}
}
@Override
/*@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void bq() {
public void bh() {
if (npc == null)
super.bq();
super.bh();
else {
NMS.updateAI(this);
npc.update();
@ -66,7 +66,7 @@ public class MagmaCubeController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityMushroomCow;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityMushroomCow;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftMushroomCow;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftMushroomCow;
import org.bukkit.entity.MushroomCow;
import org.bukkit.util.Vector;
@ -43,20 +43,20 @@ public class MushroomCowController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityOcelot;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityOcelot;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftOcelot;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftOcelot;
import org.bukkit.entity.Ocelot;
import org.bukkit.util.Vector;
@ -43,20 +43,20 @@ public class OcelotController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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,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_5_R3.EntityLightning;
import net.minecraft.server.v1_5_R3.EntityPig;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityLightning;
import net.minecraft.server.v1_6_R1.EntityPig;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPig;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPig;
import org.bukkit.entity.Pig;
import org.bukkit.util.Vector;
@ -49,20 +49,21 @@ public class PigController extends MobEntityController {
super.a(entitylightning);
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityPigZombie;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityPigZombie;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPigZombie;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPigZombie;
import org.bukkit.entity.PigZombie;
import org.bukkit.util.Vector;
@ -43,22 +43,22 @@ public class PigZombieController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void bq() {
public void bh() {
if (npc == null) {
super.bq();
super.bh();
} else {
NMS.updateAI(this);
npc.update();
@ -66,7 +66,7 @@ public class PigZombieController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntitySheep;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntitySheep;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSheep;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSheep;
import org.bukkit.entity.Sheep;
import org.bukkit.util.Vector;
@ -43,20 +43,20 @@ public class SheepController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntitySilverfish;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntitySilverfish;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSilverfish;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSilverfish;
import org.bukkit.entity.Silverfish;
import org.bukkit.util.Vector;
@ -43,22 +43,22 @@ public class SilverfishController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void bq() {
public void bh() {
if (npc == null) {
super.bq();
super.bh();
} else {
NMS.updateAI(this);
npc.update();
@ -66,7 +66,7 @@ public class SilverfishController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntitySkeleton;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntitySkeleton;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSkeleton;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSkeleton;
import org.bukkit.entity.Skeleton;
import org.bukkit.util.Vector;
@ -42,20 +42,20 @@ public class SkeletonController extends MobEntityController {
}
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
*/
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntitySlime;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntitySlime;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSlime;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSlime;
import org.bukkit.entity.Slime;
import org.bukkit.util.Vector;
@ -44,22 +44,22 @@ public class SlimeController extends MobEntityController {
}
}
@Override
/*@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void bq() {
public void bh() {
if (npc == null) {
super.bq();
super.bh();
} else {
npc.update();
NMS.updateAI(this);
@ -67,7 +67,7 @@ public class SlimeController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntitySnowman;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntitySnowman;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSnowman;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSnowman;
import org.bukkit.entity.Snowman;
import org.bukkit.util.Vector;
@ -42,20 +42,20 @@ public class SnowmanController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntitySpider;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntitySpider;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSpider;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSpider;
import org.bukkit.entity.Spider;
import org.bukkit.util.Vector;
@ -42,22 +42,22 @@ public class SpiderController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void bq() {
public void bh() {
if (npc == null)
super.bq();
super.bh();
else {
NMS.updateAI(this);
npc.update();
@ -65,7 +65,7 @@ public class SpiderController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntitySquid;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntitySquid;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftSquid;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftSquid;
import org.bukkit.entity.Squid;
import org.bukkit.util.Vector;
@ -42,21 +42,21 @@ public class SquidController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bq() {
public void bh() {
if (npc != null) {
npc.update();
} else
super.bq();
super.bh();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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,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_5_R3.EntityHuman;
import net.minecraft.server.v1_5_R3.EntityVillager;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityHuman;
import net.minecraft.server.v1_6_R1.EntityVillager;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftVillager;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftVillager;
import org.bukkit.entity.Villager;
import org.bukkit.util.Vector;
@ -45,25 +45,25 @@ public class VillagerController extends MobEntityController {
}
@Override
public boolean a_(EntityHuman entityhuman) {
return npc == null || !blockTrades ? super.a_(entityhuman) : false; // block
// trades
public boolean a(EntityHuman entityhuman) {
return npc == null || !blockTrades ? super.a(entityhuman) : false; // block
// trades
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityWitch;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityWitch;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftWitch;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftWitch;
import org.bukkit.entity.Witch;
import org.bukkit.util.Vector;
@ -43,19 +43,19 @@ public class WitchController extends MobEntityController {
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityWither;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityWither;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftWither;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftWither;
import org.bukkit.entity.Wither;
import org.bukkit.util.Vector;
@ -42,14 +42,14 @@ public class WitherController extends MobEntityController {
}
}
@Override
/*@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@ -61,7 +61,7 @@ public class WitherController extends MobEntityController {
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityWolf;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityWolf;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftWolf;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftWolf;
import org.bukkit.entity.Wolf;
import org.bukkit.util.Vector;
@ -42,20 +42,20 @@ public class WolfController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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_5_R3.EntityZombie;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.EntityZombie;
import net.minecraft.server.v1_6_R1.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftZombie;
import org.bukkit.entity.Zombie;
import org.bukkit.util.Vector;
@ -42,20 +42,20 @@ public class ZombieController extends MobEntityController {
}
}
@Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}
/* @Override
public float bE() {
return NMS.modifiedSpeed(super.bE(), npc);
}*/
@Override
public void bo() {
super.bo();
public void be() {
super.be();
if (npc != null)
npc.update();
}
@Override
public void collide(net.minecraft.server.v1_5_R3.Entity entity) {
public void collide(net.minecraft.server.v1_6_R1.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,21 +1,21 @@
package net.citizensnpcs.npc.network;
import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_5_R3.MinecraftServer;
import net.minecraft.server.v1_5_R3.NetworkManager;
import net.minecraft.server.v1_5_R3.Packet;
import net.minecraft.server.v1_5_R3.Packet102WindowClick;
import net.minecraft.server.v1_5_R3.Packet106Transaction;
import net.minecraft.server.v1_5_R3.Packet10Flying;
import net.minecraft.server.v1_5_R3.Packet130UpdateSign;
import net.minecraft.server.v1_5_R3.Packet14BlockDig;
import net.minecraft.server.v1_5_R3.Packet15Place;
import net.minecraft.server.v1_5_R3.Packet16BlockItemSwitch;
import net.minecraft.server.v1_5_R3.Packet255KickDisconnect;
import net.minecraft.server.v1_5_R3.Packet28EntityVelocity;
import net.minecraft.server.v1_5_R3.Packet3Chat;
import net.minecraft.server.v1_5_R3.Packet51MapChunk;
import net.minecraft.server.v1_5_R3.PlayerConnection;
import net.minecraft.server.v1_6_R1.EntityPlayer;
import net.minecraft.server.v1_6_R1.MinecraftServer;
import net.minecraft.server.v1_6_R1.NetworkManager;
import net.minecraft.server.v1_6_R1.Packet;
import net.minecraft.server.v1_6_R1.Packet102WindowClick;
import net.minecraft.server.v1_6_R1.Packet106Transaction;
import net.minecraft.server.v1_6_R1.Packet10Flying;
import net.minecraft.server.v1_6_R1.Packet130UpdateSign;
import net.minecraft.server.v1_6_R1.Packet14BlockDig;
import net.minecraft.server.v1_6_R1.Packet15Place;
import net.minecraft.server.v1_6_R1.Packet16BlockItemSwitch;
import net.minecraft.server.v1_6_R1.Packet255KickDisconnect;
import net.minecraft.server.v1_6_R1.Packet28EntityVelocity;
import net.minecraft.server.v1_6_R1.Packet3Chat;
import net.minecraft.server.v1_6_R1.Packet51MapChunk;
import net.minecraft.server.v1_6_R1.PlayerConnection;
public class EmptyNetHandler extends PlayerConnection {
public EmptyNetHandler(MinecraftServer minecraftServer, NetworkManager networkManager, EntityPlayer entityPlayer) {

View File

@ -5,10 +5,10 @@ import java.net.Socket;
import java.security.PrivateKey;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_5_R3.Connection;
import net.minecraft.server.v1_5_R3.IConsoleLogManager;
import net.minecraft.server.v1_5_R3.NetworkManager;
import net.minecraft.server.v1_5_R3.Packet;
import net.minecraft.server.v1_6_R1.Connection;
import net.minecraft.server.v1_6_R1.IConsoleLogManager;
import net.minecraft.server.v1_6_R1.NetworkManager;
import net.minecraft.server.v1_6_R1.Packet;
public class EmptyNetworkManager extends NetworkManager {
public EmptyNetworkManager(IConsoleLogManager logManager, Socket socket, String string, Connection conn,

View File

@ -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_5_R3.EntityEnderDragon;
import net.minecraft.server.v1_5_R3.EntityLiving;
import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_6_R1.EntityEnderDragon;
import net.minecraft.server.v1_6_R1.EntityLiving;
import net.minecraft.server.v1_6_R1.EntityPlayer;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@ -226,6 +226,8 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
}
public class GroundController implements MovementController {
private double speed = 0.07D;
private void jump() {
boolean allowed = getHandle().onGround;
if (!allowed)
@ -253,9 +255,36 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
boolean onGround = handle.onGround;
float speedMod = npc.getNavigator().getDefaultParameters()
.modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED));
updateSpeed(handle, speedMod);
setMountedYaw(handle);
}
private void updateSpeed(EntityLiving handle, float speedMod) {
double oldSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
double horizontal = ((EntityLiving) handle.passenger).bf;
if (horizontal > 0.0D) {
double dXcos = -Math.sin(handle.passenger.yaw * Math.PI / 180.0F);
double dXsin = Math.cos(handle.passenger.yaw * Math.PI / 180.0F);
handle.motX += dXcos * this.speed * 0.05;
handle.motZ += dXsin * this.speed * 0.05;
}
handle.motX += handle.passenger.motX * speedMod;
handle.motZ += handle.passenger.motZ * speedMod;
setMountedYaw(handle);
double newSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ);
if (newSpeed > 0.35D) {
double movementFactor = 0.35D / newSpeed;
handle.motX *= movementFactor;
handle.motZ *= movementFactor;
newSpeed = 0.35D;
}
if (newSpeed > oldSpeed && this.speed < 0.35D) {
this.speed = Math.min(0.35D, (this.speed + ((0.35D - this.speed) / 35.0D)));
} else {
this.speed = Math.max(0.07D, (this.speed - ((this.speed - 0.07D) / 35.0D)));
}
}
private static final float AIR_SPEED = 1.5F;

View File

@ -1,8 +1,8 @@
package net.citizensnpcs.trait.waypoint;
import net.minecraft.server.v1_5_R3.DamageSource;
import net.minecraft.server.v1_5_R3.EntityEnderCrystal;
import net.minecraft.server.v1_5_R3.World;
import net.minecraft.server.v1_6_R1.DamageSource;
import net.minecraft.server.v1_6_R1.EntityEnderCrystal;
import net.minecraft.server.v1_6_R1.World;
public class EntityEnderCrystalMarker extends EntityEnderCrystal {
public EntityEnderCrystalMarker(World world) {
@ -10,16 +10,16 @@ public class EntityEnderCrystalMarker extends EntityEnderCrystal {
}
@Override
public boolean damageEntity(DamageSource damagesource, int i) {
public boolean damageEntity(DamageSource damagesource, float i) {
return false;
}
@Override
public void l_() {
}
@Override
public boolean K() {
return false;
}
@Override
public void l_() {
}
}

View File

@ -382,8 +382,9 @@ public class LinearWaypointProvider implements WaypointProvider {
public void onProviderChanged() {
itr = waypoints.iterator();
if (currentDestination != null)
if (currentDestination != null) {
selector.finish();
}
}
@Override
@ -394,13 +395,15 @@ public class LinearWaypointProvider implements WaypointProvider {
@Override
public void run(GoalSelector selector) {
if (!getNavigator().isNavigating())
if (!getNavigator().isNavigating()) {
selector.finish();
}
}
public void setPaused(boolean pause) {
if (pause && currentDestination != null)
if (pause && currentDestination != null) {
selector.finish();
}
paused = pause;
}
@ -417,7 +420,9 @@ public class LinearWaypointProvider implements WaypointProvider {
this.selector = selector;
Waypoint next = itr.next();
Location npcLoc = npc.getBukkitEntity().getLocation(cachedLocation);
if (npcLoc.getWorld() != next.getLocation().getWorld() || npcLoc.distanceSquared(next.getLocation()) < 3) {
if (npcLoc.getWorld() != next.getLocation().getWorld()
|| npcLoc.distanceSquared(next.getLocation()) < npc.getNavigator().getLocalParameters()
.distanceMargin()) {
return false;
}
currentDestination = next;

View File

@ -134,9 +134,9 @@ public class ByIdArray<T> implements Iterable<T> {
private int idx;
{
if (size > 0) {
if (highest == Integer.MIN_VALUE || elementData[highest] == null)
if (highest == Integer.MIN_VALUE || highest >= elementData.length || elementData[highest] == null)
recalcHighest();
if (lowest == Integer.MAX_VALUE || elementData[lowest] == null)
if (lowest >= elementData.length || elementData[lowest] == null)
recalcLowest();
idx = lowest - 1;
}

View File

@ -11,31 +11,33 @@ import java.util.WeakHashMap;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Messaging;
import net.minecraft.server.v1_5_R3.ControllerJump;
import net.minecraft.server.v1_5_R3.DamageSource;
import net.minecraft.server.v1_5_R3.EnchantmentManager;
import net.minecraft.server.v1_5_R3.Entity;
import net.minecraft.server.v1_5_R3.EntityHuman;
import net.minecraft.server.v1_5_R3.EntityLiving;
import net.minecraft.server.v1_5_R3.EntityMonster;
import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_5_R3.EntityTypes;
import net.minecraft.server.v1_5_R3.MathHelper;
import net.minecraft.server.v1_5_R3.MobEffectList;
import net.minecraft.server.v1_5_R3.Navigation;
import net.minecraft.server.v1_5_R3.NetworkManager;
import net.minecraft.server.v1_5_R3.Packet;
import net.minecraft.server.v1_5_R3.PathfinderGoalSelector;
import net.minecraft.server.v1_5_R3.World;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.minecraft.server.v1_6_R1.ControllerJump;
import net.minecraft.server.v1_6_R1.DamageSource;
import net.minecraft.server.v1_6_R1.EnchantmentManager;
import net.minecraft.server.v1_6_R1.Entity;
import net.minecraft.server.v1_6_R1.EntityHuman;
import net.minecraft.server.v1_6_R1.EntityInsentient;
import net.minecraft.server.v1_6_R1.EntityLiving;
import net.minecraft.server.v1_6_R1.EntityPlayer;
import net.minecraft.server.v1_6_R1.EntityTypes;
import net.minecraft.server.v1_6_R1.GenericAttributes;
import net.minecraft.server.v1_6_R1.MathHelper;
import net.minecraft.server.v1_6_R1.MobEffectList;
import net.minecraft.server.v1_6_R1.Navigation;
import net.minecraft.server.v1_6_R1.NetworkManager;
import net.minecraft.server.v1_6_R1.Packet;
import net.minecraft.server.v1_6_R1.PathfinderGoalSelector;
import net.minecraft.server.v1_6_R1.World;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -49,20 +51,6 @@ public class NMS {
// util class
}
private static final float DEFAULT_SPEED = 0.4F;
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;
private static Field LAND_SPEED_MODIFIER_FIELD;
private static final Map<EntityType, Float> MOVEMENT_SPEEDS = Maps.newEnumMap(EntityType.class);
private static Field NAVIGATION_WORLD_FIELD;
private static final Location packetCacheLocation = new Location(null, 0, 0, 0);
private static Field PATHFINDING_RANGE;
private static final Random RANDOM = Util.getFastRandom();
private static Field SPEED_FIELD;
private static Field THREAD_STOPPER;
public static void addOrRemoveFromPlayerList(LivingEntity bukkitEntity, boolean remove) {
if (bukkitEntity == null)
return;
@ -77,7 +65,7 @@ public class NMS {
}
public static void attack(EntityLiving handle, Entity target) {
int damage = handle instanceof EntityMonster ? ((EntityMonster) handle).c(target) : 2;
float damage = (float) handle.a(GenericAttributes.e).e();
if (handle.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
damage += 3 << handle.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
@ -179,12 +167,20 @@ public class NMS {
return mcEntity.G() || mcEntity.I();
}
public static boolean isSentient(LivingEntity entity) {
return !(((CraftLivingEntity) entity).getHandle() instanceof EntityInsentient);
}
public static void loadPlugins() {
((CraftServer) Bukkit.getServer()).enablePlugins(PluginLoadOrder.POSTWORLD);
}
public static void look(EntityLiving handle, Entity target) {
handle.getControllerLook().a(target, 10.0F, handle.bs());
if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerLook().a(target, 10.0F, ((EntityInsentient) handle).bl());
} else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setTargetLook(target, 10F, 40);
}
}
public static void look(LivingEntity bukkitEntity, float yaw, float pitch) {
@ -237,7 +233,7 @@ public class NMS {
if (ply == null || world != ply.getWorld()) {
continue;
}
if (location.distanceSquared(ply.getLocation(packetCacheLocation)) > radius) {
if (location.distanceSquared(ply.getLocation(PACKET_CACHE_LOCATION)) > radius) {
continue;
}
for (Packet packet : packets) {
@ -262,7 +258,12 @@ public class NMS {
}
public static void setDestination(LivingEntity bukkitEntity, double x, double y, double z, float speed) {
((CraftLivingEntity) bukkitEntity).getHandle().getControllerMove().a(x, y, z, speed);
EntityLiving handle = ((CraftLivingEntity) bukkitEntity).getHandle();
if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerMove().a(x, y, z, speed);
} else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setMoveDestination(x, y, z, speed);
}
}
public static void setHeadYaw(EntityLiving handle, float yaw) {
@ -273,10 +274,10 @@ public class NMS {
while (yaw >= 180.0F) {
yaw -= 360.0F;
}
handle.aA = yaw;
handle.aP = yaw;
if (!(handle instanceof EntityHuman))
handle.ay = yaw;
handle.aB = yaw;
handle.aN = yaw;
handle.aQ = yaw;
}
public static void setLandSpeedModifier(EntityLiving handle, float speed) {
@ -290,8 +291,13 @@ public class NMS {
}
public static void setShouldJump(LivingEntity entity) {
ControllerJump controller = getHandle(entity).getControllerJump();
controller.a();
EntityLiving handle = getHandle(entity);
if (handle instanceof EntityInsentient) {
ControllerJump controller = ((EntityInsentient) handle).getControllerJump();
controller.a();
} else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setShouldJump();
}
}
public static org.bukkit.entity.Entity spawnCustomEntity(org.bukkit.World world, Location at,
@ -332,17 +338,25 @@ public class NMS {
}
public static void updateAI(EntityLiving entity) {
updateSenses(entity);
entity.getNavigation().e();
entity.getControllerMove().c();
entity.getControllerLook().a();
entity.getControllerJump().b();
if (entity instanceof EntityInsentient) {
EntityInsentient handle = (EntityInsentient) entity;
handle.getEntitySenses().a();
handle.getNavigation().e();
handle.getControllerMove().c();
handle.getControllerLook().a();
handle.getControllerJump().b();
} else if (entity instanceof EntityHumanNPC) {
((EntityHumanNPC) entity).updateAI();
}
}
public static void updateNavigationWorld(LivingEntity entity, org.bukkit.World world) {
if (NAVIGATION_WORLD_FIELD == null)
return;
EntityLiving handle = ((CraftLivingEntity) entity).getHandle();
EntityLiving en = ((CraftLivingEntity) entity).getHandle();
if (!(en instanceof EntityInsentient))
return;
EntityInsentient handle = (EntityInsentient) en;
World worldHandle = ((CraftWorld) world).getHandle();
try {
NAVIGATION_WORLD_FIELD.set(handle.getNavigation(), worldHandle);
@ -352,9 +366,13 @@ public class NMS {
}
public static void updatePathfindingRange(NPC npc, float pathfindingRange) {
if (PATHFINDING_RANGE == null)
if (PATHFINDING_RANGE == null || !npc.isSpawned())
return;
Navigation navigation = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle().getNavigation();
EntityLiving en = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
if (!(en instanceof EntityInsentient))
return;
EntityInsentient handle = (EntityInsentient) en;
Navigation navigation = handle.getNavigation();
try {
PATHFINDING_RANGE.set(navigation, pathfindingRange);
} catch (Exception e) {
@ -362,31 +380,43 @@ public class NMS {
}
}
public static void updateSenses(EntityLiving entity) {
entity.getEntitySenses().a();
}
private static final float DEFAULT_SPEED = 1F;
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;
private static Field LAND_SPEED_MODIFIER_FIELD;
private static final Map<EntityType, Float> MOVEMENT_SPEEDS = Maps.newEnumMap(EntityType.class);
private static Field NAVIGATION_WORLD_FIELD;
private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
private static Field PATHFINDING_RANGE;
private static final Random RANDOM = Util.getFastRandom();
private static Field SPEED_FIELD;
private static Field THREAD_STOPPER;
static {
// TODO: speed fields are all wrong - need to use attributes
// true field above false and three synchronised lists
THREAD_STOPPER = getField(NetworkManager.class, "n");
// constants taken from source code
MOVEMENT_SPEEDS.put(EntityType.CHICKEN, 0.25F);
MOVEMENT_SPEEDS.put(EntityType.COW, 0.2F);
MOVEMENT_SPEEDS.put(EntityType.CREEPER, 0.3F);
MOVEMENT_SPEEDS.put(EntityType.IRON_GOLEM, 0.15F);
MOVEMENT_SPEEDS.put(EntityType.MUSHROOM_COW, 0.2F);
MOVEMENT_SPEEDS.put(EntityType.OCELOT, 0.23F);
MOVEMENT_SPEEDS.put(EntityType.SHEEP, 0.25F);
MOVEMENT_SPEEDS.put(EntityType.SNOWMAN, 0.25F);
MOVEMENT_SPEEDS.put(EntityType.PIG, 0.27F);
MOVEMENT_SPEEDS.put(EntityType.CHICKEN, 1F);
MOVEMENT_SPEEDS.put(EntityType.COW, 1F);
MOVEMENT_SPEEDS.put(EntityType.CREEPER, 1F);
MOVEMENT_SPEEDS.put(EntityType.IRON_GOLEM, 1F);
MOVEMENT_SPEEDS.put(EntityType.MUSHROOM_COW, 1F);
MOVEMENT_SPEEDS.put(EntityType.OCELOT, 1F);
MOVEMENT_SPEEDS.put(EntityType.SHEEP, 1F);
MOVEMENT_SPEEDS.put(EntityType.SNOWMAN, 1F);
MOVEMENT_SPEEDS.put(EntityType.PIG, 1F);
MOVEMENT_SPEEDS.put(EntityType.PLAYER, 1F);
MOVEMENT_SPEEDS.put(EntityType.VILLAGER, 0.3F);
LAND_SPEED_MODIFIER_FIELD = getField(EntityLiving.class, "bQ");
MOVEMENT_SPEEDS.put(EntityType.VILLAGER, 1F);
LAND_SPEED_MODIFIER_FIELD = getField(EntityLiving.class, "bs");
SPEED_FIELD = getField(EntityLiving.class, "bI");
NAVIGATION_WORLD_FIELD = getField(Navigation.class, "b");
PATHFINDING_RANGE = getField(Navigation.class, "e");
PATHFINDING_RANGE = getField(Navigation.class, "d");
GOAL_FIELD = getField(PathfinderGoalSelector.class, "a");
try {

View File

@ -2,13 +2,13 @@ package net.citizensnpcs.util;
import java.util.Arrays;
import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_5_R3.Packet;
import net.minecraft.server.v1_5_R3.Packet17EntityLocationAction;
import net.minecraft.server.v1_5_R3.Packet18ArmAnimation;
import net.minecraft.server.v1_5_R3.Packet40EntityMetadata;
import net.minecraft.server.v1_6_R1.EntityPlayer;
import net.minecraft.server.v1_6_R1.Packet;
import net.minecraft.server.v1_6_R1.Packet17EntityLocationAction;
import net.minecraft.server.v1_6_R1.Packet18ArmAnimation;
import net.minecraft.server.v1_6_R1.Packet40EntityMetadata;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
public enum PlayerAnimation {

View File

@ -0,0 +1,21 @@
package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
public class PlayerControllerJump {
private final EntityHumanNPC a;
private boolean b;
public PlayerControllerJump(EntityHumanNPC entityinsentient) {
this.a = entityinsentient;
}
public void a() {
this.b = true;
}
public void b() {
this.a.f(this.b);
this.b = false;
}
}

View File

@ -0,0 +1,87 @@
package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.minecraft.server.v1_6_R1.Entity;
import net.minecraft.server.v1_6_R1.EntityLiving;
import net.minecraft.server.v1_6_R1.MathHelper;
public class PlayerControllerLook {
private final EntityHumanNPC a;
private float b;
private float c;
private boolean d;
private double e;
private double f;
private double g;
public PlayerControllerLook(EntityHumanNPC entityinsentient) {
this.a = entityinsentient;
}
public void a() {
this.a.pitch = 0.0F;
if (this.d) {
this.d = false;
double d0 = this.e - this.a.locX;
double d1 = this.f - (this.a.locY + this.a.getHeadHeight());
double d2 = this.g - this.a.locZ;
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
float f = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
float f1 = (float) (-(Math.atan2(d1, d3) * 180.0D / 3.1415927410125732D));
this.a.pitch = this.a(this.a.pitch, f1, this.c);
this.a.aP = this.a(this.a.aP, f, this.b);
} else {
this.a.aP = this.a(this.a.aP, this.a.aN, 10.0F);
}
float f2 = MathHelper.g(this.a.aP - this.a.aN);
if (!this.a.isNavigating()) {
if (f2 < -75.0F) {
this.a.aP = this.a.aN - 75.0F;
}
if (f2 > 75.0F) {
this.a.aP = this.a.aN + 75.0F;
}
}
}
public void a(double d0, double d1, double d2, float f, float f1) {
this.e = d0;
this.f = d1;
this.g = d2;
this.b = f;
this.c = f1;
this.d = true;
}
public void a(Entity entity, float f, float f1) {
this.e = entity.locX;
if (entity instanceof EntityLiving) {
this.f = entity.locY + entity.getHeadHeight();
} else {
this.f = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D;
}
this.g = entity.locZ;
this.b = f;
this.c = f1;
this.d = true;
}
private float a(float f, float f1, float f2) {
float f3 = MathHelper.g(f1 - f);
if (f3 > f2) {
f3 = f2;
}
if (f3 < -f2) {
f3 = -f2;
}
return f + f3;
}
}

View File

@ -0,0 +1,77 @@
package net.citizensnpcs.util.nms;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_6_R1.GenericAttributes;
import net.minecraft.server.v1_6_R1.MathHelper;
public class PlayerControllerMove {
private final EntityHumanNPC a;
private double b;
private double c;
private double d;
private double e;
private boolean f;
public PlayerControllerMove(EntityHumanNPC entityinsentient) {
this.a = entityinsentient;
this.b = entityinsentient.locX;
this.c = entityinsentient.locY;
this.d = entityinsentient.locZ;
}
public boolean a() {
return this.f;
}
public void a(double d0, double d1, double d2, double d3) {
this.b = d0;
this.c = d1;
this.d = d2;
this.e = d3;
this.f = true;
}
private float a(float f, float f1, float f2) {
float f3 = MathHelper.g(f1 - f);
if (f3 > f2) {
f3 = f2;
}
if (f3 < -f2) {
f3 = -f2;
}
return f + f3;
}
public double b() {
return this.e;
}
public void c() {
this.a.bf = 0F;
if (this.f) {
this.f = false;
int i = MathHelper.floor(this.a.boundingBox.b + 0.5D);
double d0 = this.b - this.a.locX;
double d1 = this.d - this.a.locZ;
double d2 = this.c - i;
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
if (d3 >= 2.500000277905201E-7D) {
float f = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
NMS.setHeadYaw(a, this.a.yaw);
float movement = (float) (this.e * this.a.a(GenericAttributes.d).e()) * 10;
this.a.i(movement);
this.a.bf = movement;
if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) {
this.a.getControllerJump().a();
}
}
}
}
}

View File

@ -0,0 +1,9 @@
package org.bukkit.craftbukkit.v1_6_R1.entity;
import org.bukkit.entity.Entity;
public abstract class CraftEntity implements Entity {
public net.minecraft.server.v1_6_R1.Entity getHandle() {
return null;
}
}

View File

@ -0,0 +1,497 @@
package org.bukkit.craftbukkit.v1_6_R1.entity;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import net.minecraft.server.v1_6_R1.EntityLiving;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.NumberConversions;
import org.bukkit.util.Vector;
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Deprecated
public void _INVALID_damage(int amount) {
damage(amount);
}
@Deprecated
public void _INVALID_damage(int amount, Entity source) {
damage(amount, source);
}
@Deprecated
public int _INVALID_getHealth() {
return NumberConversions.ceil(getHealth());
}
@Deprecated
public int _INVALID_getLastDamage() {
return NumberConversions.ceil(getLastDamage());
}
@Deprecated
public int _INVALID_getMaxHealth() {
return NumberConversions.ceil(getMaxHealth());
}
@Deprecated
public void _INVALID_setHealth(int health) {
setHealth(health);
}
@Deprecated
public void _INVALID_setLastDamage(int damage) {
setLastDamage(damage);
}
@Deprecated
public void _INVALID_setMaxHealth(int health) {
setMaxHealth(health);
}
public boolean addPotionEffect(PotionEffect effect) {
return false;
}
public boolean addPotionEffect(PotionEffect effect, boolean force) {
return false;
}
public boolean addPotionEffects(Collection<PotionEffect> effects) {
return false;
}
public void damage(double amount) {
}
public void damage(double amount, Entity source) {
}
@Deprecated
public void damage(int arg0) {
}
@Deprecated
public void damage(int arg0, Entity arg1) {
}
public boolean eject() {
return false;
}
public Collection<PotionEffect> getActivePotionEffects() {
return null;
}
public boolean getCanPickupItems() {
return false;
}
public String getCustomName() {
return null;
}
public int getEntityId() {
return 0;
}
public EntityEquipment getEquipment() {
return null;
}
public double getEyeHeight() {
return 0;
}
public double getEyeHeight(boolean ignoreSneaking) {
return 0;
}
public Location getEyeLocation() {
return null;
}
public float getFallDistance() {
return 0;
}
public int getFireTicks() {
return 0;
}
public EntityLiving getHandle() {
return null;
}
public double getHealth() {
return 0;
}
public Player getKiller() {
return null;
}
public double getLastDamage() {
return 0;
}
public EntityDamageEvent getLastDamageCause() {
return null;
}
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance) {
return null;
}
public List<Block> getLineOfSight(HashSet<Byte> transparent, int maxDistance) {
return null;
}
public Location getLocation() {
return null;
}
public Location getLocation(Location loc) {
return null;
}
public int getMaxFireTicks() {
return 0;
}
public double getMaxHealth() {
return 0;
}
public int getMaximumAir() {
return 0;
}
public int getMaximumNoDamageTicks() {
return 0;
}
public List<MetadataValue> getMetadata(String metadataKey) {
return null;
}
public List<Entity> getNearbyEntities(double x, double y, double z) {
return null;
}
public int getNoDamageTicks() {
return 0;
}
public Entity getPassenger() {
return null;
}
public int getRemainingAir() {
return 0;
}
public boolean getRemoveWhenFarAway() {
return false;
}
public Server getServer() {
return null;
}
public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance) {
return null;
}
public int getTicksLived() {
return 0;
}
public EntityType getType() {
return null;
}
public UUID getUniqueId() {
return null;
}
public Entity getVehicle() {
return null;
}
public Vector getVelocity() {
return null;
}
public World getWorld() {
return null;
}
public boolean hasLineOfSight(Entity other) {
return false;
}
public boolean hasMetadata(String metadataKey) {
return false;
}
public boolean hasPotionEffect(PotionEffectType type) {
return false;
}
public boolean isCustomNameVisible() {
return false;
}
public boolean isDead() {
return false;
}
public boolean isEmpty() {
return false;
}
public boolean isInsideVehicle() {
return false;
}
public boolean isOnGround() {
return false;
}
public boolean isValid() {
return false;
}
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile) {
return null;
}
public boolean leaveVehicle() {
return false;
}
public void playEffect(EntityEffect type) {
}
public void remove() {
}
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
}
public void removePotionEffect(PotionEffectType type) {
}
public void resetMaxHealth() {
}
public void setCanPickupItems(boolean pickup) {
}
public void setCustomName(String name) {
}
public void setCustomNameVisible(boolean flag) {
}
public void setFallDistance(float distance) {
}
public void setFireTicks(int ticks) {
}
public void setHealth(double health) {
}
@Deprecated
public void setHealth(int arg0) {
}
public void setLastDamage(double damage) {
}
@Deprecated
public void setLastDamage(int arg0) {
}
public void setLastDamageCause(EntityDamageEvent event) {
}
public void setMaxHealth(double health) {
}
@Deprecated
public void setMaxHealth(int arg0) {
}
public void setMaximumAir(int ticks) {
}
public void setMaximumNoDamageTicks(int ticks) {
}
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
}
public void setNoDamageTicks(int ticks) {
}
public boolean setPassenger(Entity passenger) {
return false;
}
public void setRemainingAir(int ticks) {
}
public void setRemoveWhenFarAway(boolean remove) {
}
public void setTicksLived(int value) {
}
public void setVelocity(Vector velocity) {
}
@Deprecated
public Arrow shootArrow() {
return null;
}
public boolean teleport(Entity destination) {
return false;
}
public boolean teleport(Entity destination, TeleportCause cause) {
return false;
}
public boolean teleport(Location location) {
return false;
}
public boolean teleport(Location location, TeleportCause cause) {
return false;
}
@Deprecated
public Egg throwEgg() {
return null;
}
@Deprecated
public Snowball throwSnowball() {
return null;
}
}

View File

@ -0,0 +1,15 @@
members:
"org/bukkit/entity/Damageable _INVALID_damage (I)V": damage
"org/bukkit/entity/Damageable _INVALID_damage (ILorg/bukkit/entity/Entity;)V": damage
"org/bukkit/entity/Damageable _INVALID_getHealth ()I": getHealth
"org/bukkit/entity/Damageable _INVALID_setHealth (I)V": setHealth
"org/bukkit/entity/Damageable _INVALID_getMaxHealth ()I": getMaxHealth
"org/bukkit/entity/Damageable _INVALID_setMaxHealth (I)V": setMaxHealth
"org/bukkit/entity/LivingEntity _INVALID_getLastDamage ()I": getLastDamage
"org/bukkit/entity/LivingEntity _INVALID_setLastDamage (I)V": setLastDamage
"org/bukkit/event/entity/EntityDamageEvent _INVALID_getDamage ()I": getDamage
"org/bukkit/event/entity/EntityDamageEvent _INVALID_setDamage (I)V": setDamage
"org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_getDamage ()I": getDamage
"org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_setDamage (I)V": setDamage
"org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_getAmount ()I": getAmount
"org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_setAmount (I)V": setAmount