Let the entire bounding box for non-players be edited so sayth the lord

This commit is contained in:
libraryaddict 2013-12-29 20:36:30 +13:00
parent 631bc893f4
commit 62febe6d39

View File

@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
public class ReflectionManager {
@ -267,13 +268,17 @@ public class ReflectionManager {
z = field.getDouble(boundingBox);
break;
case 4:
if (entity.getType() != EntityType.PLAYER) {
field.setDouble(boundingBox, x + newBox.getX());
}
break;
case 5:
field.setDouble(boundingBox, y + newBox.getY());
break;
case 6:
if (entity.getType() != EntityType.PLAYER) {
field.setDouble(boundingBox, z + newBox.getZ());
}
break;
default:
throw new Exception("Error while setting the bounding box, more doubles than I thought??");
@ -289,8 +294,10 @@ public class ReflectionManager {
public static void setSize(Entity entity, float[] size) {
try {
getNmsClass("Entity").getField("length").setFloat(getNmsEntity(entity), size[0]);
// getNmsClass("Entity").getField("width").setFloat(getNmsEntity(entity), size[1]);
// getNmsClass("Entity").getField("height").setFloat(getNmsEntity(entity), size[2]);
if (entity.getType() != EntityType.PLAYER) {
getNmsClass("Entity").getField("width").setFloat(getNmsEntity(entity), size[1]);
getNmsClass("Entity").getField("height").setFloat(getNmsEntity(entity), size[2]);
}
} catch (Exception ex) {
ex.printStackTrace();
}