diff --git a/paper-server/maps.yml b/paper-server/maps.yml new file mode 100644 index 0000000000..d52675af31 --- /dev/null +++ b/paper-server/maps.yml @@ -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 diff --git a/paper-server/pom.xml b/paper-server/pom.xml index 4ead01ee4b..7257f87170 100644 --- a/paper-server/pom.xml +++ b/paper-server/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.5.2-R1.1-SNAPSHOT + 1.6.1-R0.1-SNAPSHOT CraftBukkit http://www.bukkit.org @@ -12,8 +12,8 @@ UTF-8 unknown 4.11 - 1.5.2 - 1_5_R3 + 1.6.1 + 1_6_R1 @@ -206,7 +206,7 @@ - + org.apache.maven.plugins maven-shade-plugin @@ -278,8 +278,8 @@ maven-compiler-plugin 2.0.2 - 1.5 - 1.5 + 1.6 + 1.6 @@ -294,6 +294,24 @@ + + com.wolvereness + overmapped + 0.0.1 + + + package + + map + + + ${basedir}/maps.yml + ${basedir}/target/${project.artifactId}-${project.version}.jar + ${basedir}/target/unmapped-${project.artifactId}-${project.version}.jar + + + + diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java index c43773df11..dd6bcf9017 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -105,7 +105,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa public Player getPlayer() { for (Object obj : server.getHandle().players) { EntityPlayer player = (EntityPlayer) obj; - if (player.name.equalsIgnoreCase(getName())) { + if (player.getName().equalsIgnoreCase(getName())) { return (player.playerConnection != null) ? player.playerConnection.getPlayer() : null; } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 6c7f5709df..e06e23b4de 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -443,7 +443,7 @@ public class CraftWorld implements World { CraftPlayer cp = (CraftPlayer) p; if (cp.getHandle().playerConnection == null) continue; - cp.getHandle().playerConnection.sendPacket(new Packet4UpdateTime(cp.getHandle().world.getTime(), cp.getHandle().getPlayerTime())); + cp.getHandle().playerConnection.sendPacket(new Packet4UpdateTime(cp.getHandle().world.getTime(), cp.getHandle().getPlayerTime(), cp.getHandle().world.getGameRules().getBoolean("doDaylightCycle"))); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java index c68e27cac0..a7adb22c82 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java @@ -39,8 +39,8 @@ public class CraftCommandBlock extends CraftBlockState implements CommandBlock { boolean result = super.update(force, applyPhysics); if (result) { - commandBlock.b(command); - commandBlock.c(name); + commandBlock.a(command); + commandBlock.b(name); } return result; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/paper-server/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java index fec7feebde..c269e4deda 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.command; +import net.minecraft.server.ChatMessage; import net.minecraft.server.RemoteControlCommandListener; import org.bukkit.command.RemoteConsoleCommandSender; @@ -9,7 +10,7 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme } public void sendMessage(String message) { - RemoteControlCommandListener.instance.sendMessage(message + "\n"); // Send a newline after each message, to preserve formatting. + RemoteControlCommandListener.instance.sendMessage(ChatMessage.d(message + "\n")); // Send a newline after each message, to preserve formatting. } public void sendMessage(String[] messages) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java b/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java index 47c059c01b..08a07c1132 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java @@ -2,9 +2,11 @@ package org.bukkit.craftbukkit.command; import java.lang.reflect.Method; +import net.minecraft.server.ChatMessage; import net.minecraft.server.ChunkCoordinates; import net.minecraft.server.ICommandListener; import net.minecraft.server.LocaleLanguage; +import net.minecraft.server.World; import org.bukkit.command.CommandSender; @@ -18,8 +20,8 @@ public class ServerCommandListener implements ICommandListener { this.prefix = parts[parts.length - 1]; } - public void sendMessage(String msg) { - this.commandSender.sendMessage(msg); + public void sendMessage(ChatMessage chatmessage) { + this.commandSender.sendMessage(chatmessage.toString()); } public CommandSender getSender() { @@ -36,10 +38,6 @@ public class ServerCommandListener implements ICommandListener { return this.prefix; } - public String a(String s, Object... aobject) { - return LocaleLanguage.a().a(s, aobject); - } - public boolean a(int i, String s) { return true; } @@ -47,4 +45,8 @@ public class ServerCommandListener implements ICommandListener { public ChunkCoordinates b() { return new ChunkCoordinates(0, 0, 0); } + + public World f_() { + return null; + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java index fa0d63aea5..70f53fbbd2 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java @@ -11,6 +11,7 @@ import net.minecraft.server.EntityEnderDragon; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderDragon { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java index ce4a87c9d3..736a4602c6 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java @@ -5,6 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragonPart; import org.bukkit.entity.Entity; +import org.bukkit.util.NumberConversions; public class CraftEnderDragonPart extends CraftComplexPart implements EnderDragonPart { public CraftEnderDragonPart(CraftServer server, EntityComplexPart entity) { @@ -26,31 +27,61 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago return "CraftEnderDragonPart"; } - public void damage(int amount) { + public void damage(double amount) { getParent().damage(amount); } - public void damage(int amount, Entity source) { + public void damage(double amount, Entity source) { getParent().damage(amount, source); } - public int getHealth() { + public double getHealth() { return getParent().getHealth(); } - public void setHealth(int health) { + public void setHealth(double health) { getParent().setHealth(health); } - public int getMaxHealth() { + public double getMaxHealth() { return getParent().getMaxHealth(); } - public void setMaxHealth(int health) { + public void setMaxHealth(double health) { getParent().setMaxHealth(health); } public void resetMaxHealth() { getParent().resetMaxHealth(); } + + @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 void _INVALID_setHealth(int health) { + setHealth(health); + } + + @Deprecated + public int _INVALID_getMaxHealth() { + return NumberConversions.ceil(getMaxHealth()); + } + + @Deprecated + public void _INVALID_setMaxHealth(int health) { + setMaxHealth(health); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java new file mode 100644 index 0000000000..4dd771267c --- /dev/null +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java @@ -0,0 +1,23 @@ +package org.bukkit.craftbukkit.entity; + +import net.minecraft.server.EntityAnimal; + +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Horse; + +public class CraftHorse extends CraftAnimals implements Horse { + + public CraftHorse(CraftServer server, EntityAnimal entity) { + super(server, entity); + } + + @Override + public String toString() { + return "CraftHorse"; + } + + public EntityType getType() { + return EntityType.HORSE; + } +} diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index aca2e62e77..2b1040b763 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -52,7 +52,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } public String getName() { - return getHandle().name; + return getHandle().getName(); } public PlayerInventory getInventory() { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java index 08655ebaed..aa5b40e7b9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java @@ -21,7 +21,7 @@ public class CraftIronGolem extends CraftGolem implements IronGolem { } public boolean isPlayerCreated() { - return getHandle().p(); + return getHandle().bS(); } public void setPlayerCreated(boolean playerCreated) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java index 037ba207fe..ba8afa31bb 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -25,11 +25,11 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { } public org.bukkit.inventory.ItemStack getItem() { - return CraftItemStack.asBukkitCopy(getHandle().i()); + return CraftItemStack.asBukkitCopy(getHandle().h()); } public Rotation getRotation() { - return toBukkitRotation(getHandle().j()); + return toBukkitRotation(getHandle().i()); } Rotation toBukkitRotation(int value) { @@ -44,7 +44,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { case 3: return Rotation.COUNTER_CLOCKWISE; default: - throw new AssertionError("Unknown rotation " + getHandle().j() + " for " + getHandle()); + throw new AssertionError("Unknown rotation " + getHandle().i() + " for " + getHandle()); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 666d8e0918..bd00911b35 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -11,6 +11,7 @@ import net.minecraft.server.EntityArrow; import net.minecraft.server.EntityEgg; import net.minecraft.server.EntityEnderDragon; import net.minecraft.server.EntityEnderPearl; +import net.minecraft.server.EntityInsentient; import net.minecraft.server.EntityLargeFireball; import net.minecraft.server.EntityLiving; import net.minecraft.server.EntitySmallFireball; @@ -51,6 +52,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.BlockIterator; +import org.bukkit.util.NumberConversions; import org.bukkit.util.Vector; public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -59,16 +61,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public CraftLivingEntity(final CraftServer server, final EntityLiving entity) { super(server, entity); - if (!(this instanceof HumanEntity)) { + if (entity instanceof EntityInsentient) { equipment = new CraftEntityEquipment(this); } } - public int getHealth() { + public double getHealth() { return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth()); } - public void setHealth(int health) { + public void setHealth(double health) { if ((health < 0) || (health > getMaxHealth())) { throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth()); } @@ -77,17 +79,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { ((EntityPlayer) entity).die(DamageSource.GENERIC); } - getHandle().setHealth(health); + getHandle().setHealth((float) health); } - public int getMaxHealth() { + public double getMaxHealth() { return getHandle().maxHealth; } - public void setMaxHealth(int amount) { + public void setMaxHealth(double amount) { Validate.isTrue(amount > 0, "Max health must be greater than 0"); - getHandle().maxHealth = amount; + getHandle().maxHealth = (float) amount; if (getHealth() > amount) { setHealth(amount); @@ -176,11 +178,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { getHandle().maxAirTicks = ticks; } - public void damage(int amount) { + public void damage(double amount) { damage(amount, null); } - public void damage(int amount, org.bukkit.entity.Entity source) { + public void damage(double amount, org.bukkit.entity.Entity source) { DamageSource reason = DamageSource.GENERIC; if (source instanceof HumanEntity) { @@ -190,9 +192,9 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } if (entity instanceof EntityEnderDragon) { - ((EntityEnderDragon) entity).dealDamage(reason, amount); + ((EntityEnderDragon) entity).dealDamage(reason, (float) amount); } else { - entity.damageEntity(reason, amount); + entity.damageEntity(reason, (float) amount); } } @@ -210,12 +212,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { getHandle().maxNoDamageTicks = ticks; } - public int getLastDamage() { + public double getLastDamage() { return getHandle().lastDamage; } - public void setLastDamage(int damage) { - getHandle().lastDamage = damage; + public void setLastDamage(double damage) { + getHandle().lastDamage = (float) damage; } public int getNoDamageTicks() { @@ -332,15 +334,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public boolean hasLineOfSight(Entity other) { - return getHandle().getEntitySenses().canSee(((CraftEntity) other).getHandle()); + return getHandle() instanceof EntityInsentient && ((EntityInsentient) getHandle()).getEntitySenses().canSee(((CraftEntity) other).getHandle()); } public boolean getRemoveWhenFarAway() { - return !getHandle().persistent; + return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).persistent; } public void setRemoveWhenFarAway(boolean remove) { - getHandle().persistent = !remove; + if (getHandle() instanceof EntityInsentient) { + ((EntityInsentient) getHandle()).persistent = !remove; + } } public EntityEquipment getEquipment() { @@ -348,11 +352,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public void setCanPickupItems(boolean pickup) { - getHandle().canPickUpLoot = pickup; + if (getHandle() instanceof EntityInsentient) { + ((EntityInsentient) getHandle()).canPickUpLoot = pickup; + } } public boolean getCanPickupItems() { - return getHandle().canPickUpLoot; + return getHandle() instanceof EntityInsentient && ((EntityInsentient) getHandle()).canPickUpLoot; } @Override @@ -365,6 +371,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public void setCustomName(String name) { + if (!(getHandle() instanceof EntityInsentient)) { + return; + } + if (name == null) { name = ""; } @@ -374,11 +384,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { name = name.substring(0, 64); } - getHandle().setCustomName(name); + ((EntityInsentient) getHandle()).setCustomName(name); } public String getCustomName() { - String name = getHandle().getCustomName(); + if (!(getHandle() instanceof EntityInsentient)) { + return null; + } + + String name = ((EntityInsentient) getHandle()).getCustomName(); if (name == null || name.length() == 0) { return null; @@ -388,10 +402,52 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public void setCustomNameVisible(boolean flag) { - getHandle().setCustomNameVisible(flag); + if (getHandle() instanceof EntityInsentient) { + ((EntityInsentient) getHandle()).setCustomNameVisible(flag); + } } public boolean isCustomNameVisible() { - return getHandle().getCustomNameVisible(); + return getHandle() instanceof EntityInsentient && ((EntityInsentient) getHandle()).getCustomNameVisible(); + } + + @Deprecated + public int _INVALID_getLastDamage() { + return NumberConversions.ceil(getLastDamage()); + } + + @Deprecated + public void _INVALID_setLastDamage(int damage) { + setLastDamage(damage); + } + + @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 void _INVALID_setHealth(int health) { + setHealth(health); + } + + @Deprecated + public int _INVALID_getMaxHealth() { + return NumberConversions.ceil(getMaxHealth()); + } + + @Deprecated + public void _INVALID_setMaxHealth(int health) { + setMaxHealth(health); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index acbad192c6..daf6bb4284 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityMinecartAbstract; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Minecart; +import org.bukkit.util.NumberConversions; import org.bukkit.util.Vector; public abstract class CraftMinecart extends CraftVehicle implements Minecart { @@ -11,11 +12,11 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { super(server, entity); } - public void setDamage(int damage) { - getHandle().setDamage(damage); + public void setDamage(double damage) { + getHandle().setDamage((float) damage); } - public int getDamage() { + public double getDamage() { return getHandle().getDamage(); } @@ -57,4 +58,14 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { public EntityMinecartAbstract getHandle() { return (EntityMinecartAbstract) entity; } + + @Deprecated + public void _INVALID_setDamage(int damage) { + setDamage(damage); + } + + @Deprecated + public int _INVALID_getDamage() { + return NumberConversions.ceil(getDamage()); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 8c30bf5a52..583b99c980 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -89,7 +89,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public boolean isOnline() { for (Object obj : server.getHandle().players) { EntityPlayer player = (EntityPlayer) obj; - if (player.name.equalsIgnoreCase(getName())) { + if (player.getName().equalsIgnoreCase(getName())) { return true; } } @@ -128,7 +128,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void sendRawMessage(String message) { if (getHandle().playerConnection == null) return; - getHandle().playerConnection.sendPacket(new Packet3Chat(message)); + getHandle().playerConnection.sendPacket(new Packet3Chat(ChatMessage.d(message))); } public void sendMessage(String message) { @@ -859,10 +859,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } + @Override public EntityType getType() { return EntityType.PLAYER; } + @Override public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { server.getPlayerMetadata().setMetadata(this, metadataKey, newMetadataValue); } @@ -967,11 +969,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } - public void setMaxHealth(int amount) { + @Override + public void setMaxHealth(double amount) { super.setMaxHealth(amount); getHandle().triggerHealthUpdate(); } + @Override public void resetMaxHealth() { super.resetMaxHealth(); getHandle().triggerHealthUpdate(); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 2b56c75fae..9986b7ac7f 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -13,6 +13,7 @@ import net.minecraft.server.EntityArrow; import net.minecraft.server.EntityDamageSource; import net.minecraft.server.EntityDamageSourceIndirect; import net.minecraft.server.EntityHuman; +import net.minecraft.server.EntityInsentient; import net.minecraft.server.EntityItem; import net.minecraft.server.EntityLiving; import net.minecraft.server.EntityPlayer; @@ -243,7 +244,7 @@ public class CraftEventFactory { /** * EntityTameEvent */ - public static EntityTameEvent callEntityTameEvent(EntityLiving entity, EntityHuman tamer) { + public static EntityTameEvent callEntityTameEvent(EntityInsentient entity, EntityHuman tamer) { org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null); CraftServer craftServer = (CraftServer) bukkitEntity.getServer(); @@ -370,7 +371,7 @@ public class CraftEventFactory { /** * EntityDamage(ByEntityEvent) */ - public static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, int damage) { + public static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, double damage) { EntityDamageEvent event; if (damager != null) { event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, damage); @@ -387,7 +388,7 @@ public class CraftEventFactory { return event; } - public static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, int damage) { + public static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, float damage) { if (source instanceof EntityDamageSource) { Entity damager = source.getEntity(); DamageCause cause = DamageCause.ENTITY_ATTACK; @@ -443,7 +444,7 @@ public class CraftEventFactory { } // Non-Living Entities such as EntityEnderCrystal need to call this - public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, int damage) { + public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, float damage) { if (!(source instanceof EntityDamageSource)) { return false; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java index 6e9f69ffe6..2213482093 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java @@ -1,5 +1,7 @@ package org.bukkit.craftbukkit.inventory; +import net.minecraft.server.EntityInsentient; + import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.entity.Entity; import org.bukkit.inventory.EntityEquipment; @@ -133,10 +135,10 @@ public class CraftEntityEquipment implements EntityEquipment { } private void setDropChance(int slot, float chance) { - entity.getHandle().dropChances[slot] = chance - 0.1F; + ((EntityInsentient) entity.getHandle()).dropChances[slot] = chance - 0.1F; } private float getDropChance(int slot) { - return entity.getHandle().dropChances[slot] + 0.1F; + return ((EntityInsentient) entity.getHandle()).dropChances[slot] + 0.1F; } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java new file mode 100644 index 0000000000..bb5222eb4b --- /dev/null +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java @@ -0,0 +1,25 @@ +package org.bukkit.craftbukkit.inventory; + +import net.minecraft.server.IInventory; + +public class CraftInventoryHorse extends CraftInventory { + private final IInventory resultInventory = null; + + public CraftInventoryHorse(IInventory inventory) { + super(inventory); + } + + public IInventory getResultInventory() { + return resultInventory; + } + + public IInventory getIngredientsInventory() { + return inventory; + } + + @Override + public int getSize() { + //return getResultInventory().getSize() + getIngredientsInventory().getSize(); + return getIngredientsInventory().getSize(); + } +} diff --git a/paper-server/src/test/java/org/bukkit/DyeColorsTest.java b/paper-server/src/test/java/org/bukkit/DyeColorsTest.java index 8e252c0d49..0e3a7c7503 100644 --- a/paper-server/src/test/java/org/bukkit/DyeColorsTest.java +++ b/paper-server/src/test/java/org/bukkit/DyeColorsTest.java @@ -33,7 +33,7 @@ public class DyeColorsTest extends AbstractTestingBase { @Test public void checkColor() { Color color = dye.getColor(); - float[] nmsColorArray = EntitySheep.d[dye.getWoolData()]; + float[] nmsColorArray = EntitySheep.bp[dye.getWoolData()]; Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255)); assertThat(color, is(nmsColor)); }