Update Bukkit for Minecraft 1.6.1

This commit is contained in:
Wesley Wolfe 2013-07-01 05:50:24 -05:00
parent fe3bca9131
commit 8de050ae87
13 changed files with 225 additions and 27 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.5.2-R1.1-SNAPSHOT</version> <version>1.6.1-R0.1-SNAPSHOT</version>
<name>Bukkit</name> <name>Bukkit</name>
<url>http://www.bukkit.org</url> <url>http://www.bukkit.org</url>
@ -45,8 +45,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version> <version>2.0.2</version>
<configuration> <configuration>
<source>1.5</source> <source>1.6</source>
<target>1.5</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -222,6 +222,11 @@ public enum Material {
QUARTZ_STAIRS(156, Stairs.class), QUARTZ_STAIRS(156, Stairs.class),
ACTIVATOR_RAIL(157, PoweredRail.class), ACTIVATOR_RAIL(157, PoweredRail.class),
DROPPER(158, Dispenser.class), DROPPER(158, Dispenser.class),
STAINED_CLAY(159),
HAY_BLOCK(170),
CARPET(171),
HARD_CLAY(172),
COAL_BLOCK(173),
// ----- Item Separator ----- // ----- Item Separator -----
IRON_SPADE(256, 1, 250), IRON_SPADE(256, 1, 250),
IRON_PICKAXE(257, 1, 250), IRON_PICKAXE(257, 1, 250),
@ -382,6 +387,11 @@ public enum Material {
QUARTZ(406), QUARTZ(406),
EXPLOSIVE_MINECART(407, 1), EXPLOSIVE_MINECART(407, 1),
HOPPER_MINECART(408, 1), HOPPER_MINECART(408, 1),
IRON_BARDING(417, 1),
GOLD_BARDING(418, 1),
DIAMOND_BARDING(419, 1),
LEASH(420),
NAME_TAG(421),
GOLD_RECORD(2256, 1), GOLD_RECORD(2256, 1),
GREEN_RECORD(2257, 1), GREEN_RECORD(2257, 1),
RECORD_3(2258, 1), RECORD_3(2258, 1),
@ -735,6 +745,10 @@ public enum Material {
case QUARTZ_BLOCK: case QUARTZ_BLOCK:
case QUARTZ_STAIRS: case QUARTZ_STAIRS:
case DROPPER: case DROPPER:
case STAINED_CLAY:
case HAY_BLOCK:
case HARD_CLAY:
case COAL_BLOCK:
return true; return true;
default: default:
return false; return false;
@ -793,6 +807,7 @@ public enum Material {
case REDSTONE_COMPARATOR_OFF: case REDSTONE_COMPARATOR_OFF:
case REDSTONE_COMPARATOR_ON: case REDSTONE_COMPARATOR_ON:
case ACTIVATOR_RAIL: case ACTIVATOR_RAIL:
case CARPET:
return true; return true;
default: default:
return false; return false;
@ -841,6 +856,7 @@ public enum Material {
case JUNGLE_WOOD_STAIRS: case JUNGLE_WOOD_STAIRS:
case TRAPPED_CHEST: case TRAPPED_CHEST:
case DAYLIGHT_DETECTOR: case DAYLIGHT_DETECTOR:
case CARPET:
return true; return true;
default: default:
return false; return false;
@ -872,6 +888,8 @@ public enum Material {
case SPRUCE_WOOD_STAIRS: case SPRUCE_WOOD_STAIRS:
case BIRCH_WOOD_STAIRS: case BIRCH_WOOD_STAIRS:
case JUNGLE_WOOD_STAIRS: case JUNGLE_WOOD_STAIRS:
case HAY_BLOCK:
case COAL_BLOCK:
return true; return true;
default: default:
return false; return false;
@ -948,6 +966,10 @@ public enum Material {
case QUARTZ_ORE: case QUARTZ_ORE:
case QUARTZ_BLOCK: case QUARTZ_BLOCK:
case DROPPER: case DROPPER:
case STAINED_CLAY:
case HAY_BLOCK:
case HARD_CLAY:
case COAL_BLOCK:
return true; return true;
default: default:
return false; return false;

View File

@ -9,7 +9,15 @@ public interface Damageable extends Entity {
* *
* @param amount Amount of damage to deal * @param amount Amount of damage to deal
*/ */
void damage(int amount); void damage(double amount);
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
void _INVALID_damage(int amount);
/** /**
* Deals the given amount of damage to this entity, from a specified entity. * Deals the given amount of damage to this entity, from a specified entity.
@ -17,14 +25,30 @@ public interface Damageable extends Entity {
* @param amount Amount of damage to deal * @param amount Amount of damage to deal
* @param source Entity which to attribute this damage from * @param source Entity which to attribute this damage from
*/ */
void damage(int amount, Entity source); void damage(double amount, Entity source);
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
void _INVALID_damage(int amount, Entity source);
/** /**
* Gets the entity's health from 0 to {@link #getMaxHealth()}, where 0 is dead. * Gets the entity's health from 0 to {@link #getMaxHealth()}, where 0 is dead.
* *
* @return Health represented from 0 to max * @return Health represented from 0 to max
*/ */
int getHealth(); double getHealth();
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
int _INVALID_getHealth();
/** /**
* Sets the entity's health from 0 to {@link #getMaxHealth()}, where 0 is dead. * Sets the entity's health from 0 to {@link #getMaxHealth()}, where 0 is dead.
@ -32,14 +56,30 @@ public interface Damageable extends Entity {
* @param health New health represented from 0 to max * @param health New health represented from 0 to max
* @throws IllegalArgumentException Thrown if the health is < 0 or > {@link #getMaxHealth()} * @throws IllegalArgumentException Thrown if the health is < 0 or > {@link #getMaxHealth()}
*/ */
void setHealth(int health); void setHealth(double health);
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
void _INVALID_setHealth(int health);
/** /**
* Gets the maximum health this entity has. * Gets the maximum health this entity has.
* *
* @return Maximum health * @return Maximum health
*/ */
int getMaxHealth(); double getMaxHealth();
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
int _INVALID_getMaxHealth();
/** /**
* Sets the maximum health this entity can have. * Sets the maximum health this entity can have.
@ -50,7 +90,15 @@ public interface Damageable extends Entity {
* *
* @param health amount of health to set the maximum to * @param health amount of health to set the maximum to
*/ */
void setMaxHealth(int health); void setMaxHealth(double health);
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
void _INVALID_setMaxHealth(int health);
/** /**
* Resets the max health to the original amount. * Resets the max health to the original amount.

View File

@ -130,6 +130,7 @@ public enum EntityType {
SNOWMAN("SnowMan", Snowman.class, 97), SNOWMAN("SnowMan", Snowman.class, 97),
OCELOT("Ozelot", Ocelot.class, 98), OCELOT("Ozelot", Ocelot.class, 98),
IRON_GOLEM("VillagerGolem", IronGolem.class, 99), IRON_GOLEM("VillagerGolem", IronGolem.class, 99),
HORSE("EntityHorse", Horse.class, 100),
VILLAGER("Villager", Villager.class, 120), VILLAGER("Villager", Villager.class, 120),
ENDER_CRYSTAL("EnderCrystal", EnderCrystal.class, 200), ENDER_CRYSTAL("EnderCrystal", EnderCrystal.class, 200),
// These don't have an entity ID in nms.EntityTypes. // These don't have an entity ID in nms.EntityTypes.

View File

@ -0,0 +1,6 @@
package org.bukkit.entity;
/**
* Represents a Horse.
*/
public interface Horse extends Animals, Vehicle {}

View File

@ -14,6 +14,7 @@ import org.bukkit.potion.PotionEffectType;
* Represents a living entity, such as a monster or player * Represents a living entity, such as a monster or player
*/ */
public interface LivingEntity extends Entity, Damageable { public interface LivingEntity extends Entity, Damageable {
/** /**
* Gets the height of the living entity's eyes above its Location. * Gets the height of the living entity's eyes above its Location.
* *
@ -170,14 +171,30 @@ public interface LivingEntity extends Entity, Damageable {
* *
* @return damage taken since the last no damage ticks time period * @return damage taken since the last no damage ticks time period
*/ */
public int getLastDamage(); public double getLastDamage();
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public int _INVALID_getLastDamage();
/** /**
* Sets the damage dealt within the current no damage ticks time period. * Sets the damage dealt within the current no damage ticks time period.
* *
* @param damage amount of damage * @param damage amount of damage
*/ */
public void setLastDamage(int damage); public void setLastDamage(double damage);
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public void _INVALID_setLastDamage(int damage);
/** /**
* Returns the living entity's current no damage ticks. * Returns the living entity's current no damage ticks.

View File

@ -7,19 +7,35 @@ import org.bukkit.util.Vector;
*/ */
public interface Minecart extends Vehicle { public interface Minecart extends Vehicle {
/**
* This method exists for legacy reasons to provide backwards compatibility.
* It will not exist at runtime and should not be used under any
* circumstances.
*/
@Deprecated
public void _INVALID_setDamage(int damage);
/** /**
* Sets a minecart's damage. * Sets a minecart's damage.
* *
* @param damage over 40 to "kill" a minecart * @param damage over 40 to "kill" a minecart
*/ */
public void setDamage(int damage); public void setDamage(double damage);
/**
* This method exists for legacy reasons to provide backwards compatibility.
* It will not exist at runtime and should not be used under any
* circumstances.
*/
@Deprecated
public int _INVALID_getDamage();
/** /**
* Gets a minecart's damage. * Gets a minecart's damage.
* *
* @return The damage * @return The damage
*/ */
public int getDamage(); public double getDamage();
/** /**
* Gets the maximum speed of a minecart. The speed is unrelated to the velocity. * Gets the maximum speed of a minecart. The speed is unrelated to the velocity.

View File

@ -9,7 +9,12 @@ import org.bukkit.entity.Entity;
public class EntityDamageByBlockEvent extends EntityDamageEvent { public class EntityDamageByBlockEvent extends EntityDamageEvent {
private final Block damager; private final Block damager;
@Deprecated
public EntityDamageByBlockEvent(final Block damager, final Entity damagee, final DamageCause cause, final int damage) { public EntityDamageByBlockEvent(final Block damager, final Entity damagee, final DamageCause cause, final int damage) {
this(damager, damagee, cause, (double) damage);
}
public EntityDamageByBlockEvent(final Block damager, final Entity damagee, final DamageCause cause, final double damage) {
super(damagee, cause, damage); super(damagee, cause, damage);
this.damager = damager; this.damager = damager;
} }

View File

@ -8,7 +8,12 @@ import org.bukkit.entity.Entity;
public class EntityDamageByEntityEvent extends EntityDamageEvent { public class EntityDamageByEntityEvent extends EntityDamageEvent {
private final Entity damager; private final Entity damager;
@Deprecated
public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final int damage) { public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final int damage) {
this(damager, damagee, cause, (double) damage);
}
public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final double damage) {
super(damagee, cause, damage); super(damagee, cause, damage);
this.damager = damager; this.damager = damager;
} }

View File

@ -3,17 +3,23 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.util.NumberConversions;
/** /**
* Stores data for damage events * Stores data for damage events
*/ */
public class EntityDamageEvent extends EntityEvent implements Cancellable { public class EntityDamageEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private int damage; private double damage;
private boolean cancelled; private boolean cancelled;
private final DamageCause cause; private final DamageCause cause;
@Deprecated
public EntityDamageEvent(final Entity damagee, final DamageCause cause, final int damage) { public EntityDamageEvent(final Entity damagee, final DamageCause cause, final int damage) {
this(damagee, cause, (double) damage);
}
public EntityDamageEvent(final Entity damagee, final DamageCause cause, final double damage) {
super(damagee); super(damagee);
this.cause = cause; this.cause = cause;
this.damage = damage; this.damage = damage;
@ -32,19 +38,39 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
* *
* @return The amount of damage caused by the event * @return The amount of damage caused by the event
*/ */
public int getDamage() { public double getDamage() {
return damage; return damage;
} }
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public int _INVALID_getDamage() {
return NumberConversions.ceil(getDamage());
}
/** /**
* Sets the amount of damage caused by the event * Sets the amount of damage caused by the event
* *
* @param damage The amount of damage caused by the event * @param damage The amount of damage caused by the event
*/ */
public void setDamage(int damage) { public void setDamage(double damage) {
this.damage = damage; this.damage = damage;
} }
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public void _INVALID_setDamage(int damage) {
setDamage(damage);
}
/** /**
* Gets the cause of the damage. * Gets the cause of the damage.
* *

View File

@ -3,6 +3,7 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.util.NumberConversions;
/** /**
* Stores data for health-regain events * Stores data for health-regain events
@ -10,10 +11,15 @@ import org.bukkit.event.HandlerList;
public class EntityRegainHealthEvent extends EntityEvent implements Cancellable { public class EntityRegainHealthEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private int amount; private double amount;
private final RegainReason regainReason; private final RegainReason regainReason;
@Deprecated
public EntityRegainHealthEvent(final Entity entity, final int amount, final RegainReason regainReason) { public EntityRegainHealthEvent(final Entity entity, final int amount, final RegainReason regainReason) {
this(entity, (double) amount, regainReason);
}
public EntityRegainHealthEvent(final Entity entity, final double amount, final RegainReason regainReason) {
super(entity); super(entity);
this.amount = amount; this.amount = amount;
this.regainReason = regainReason; this.regainReason = regainReason;
@ -24,19 +30,39 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
* *
* @return The amount of health regained * @return The amount of health regained
*/ */
public int getAmount() { public double getAmount() {
return amount; return amount;
} }
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public int _INVALID_getAmount() {
return NumberConversions.ceil(getAmount());
}
/** /**
* Sets the amount of regained health * Sets the amount of regained health
* *
* @param amount the amount of health the entity will regain * @param amount the amount of health the entity will regain
*/ */
public void setAmount(int amount) { public void setAmount(double amount) {
this.amount = amount; this.amount = amount;
} }
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public void _INVALID_setAmount(int amount) {
setAmount(amount);
}
public boolean isCancelled() { public boolean isCancelled() {
return cancelled; return cancelled;
} }

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.util.NumberConversions;
/** /**
* Raised when a vehicle receives damage. * Raised when a vehicle receives damage.
@ -11,10 +12,15 @@ import org.bukkit.event.HandlerList;
public class VehicleDamageEvent extends VehicleEvent implements Cancellable { public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final Entity attacker; private final Entity attacker;
private int damage; private double damage;
private boolean cancelled; private boolean cancelled;
@Deprecated
public VehicleDamageEvent(final Vehicle vehicle, final Entity attacker, final int damage) { public VehicleDamageEvent(final Vehicle vehicle, final Entity attacker, final int damage) {
this(vehicle, attacker, (double) damage);
}
public VehicleDamageEvent(final Vehicle vehicle, final Entity attacker, final double damage) {
super(vehicle); super(vehicle);
this.attacker = attacker; this.attacker = attacker;
this.damage = damage; this.damage = damage;
@ -34,19 +40,39 @@ public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
* *
* @return the damage done to the vehicle * @return the damage done to the vehicle
*/ */
public int getDamage() { public double getDamage() {
return damage; return damage;
} }
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public int _INVALID_getDamage() {
return NumberConversions.ceil(getDamage());
}
/** /**
* Sets the damage done to the vehicle * Sets the damage done to the vehicle
* *
* @param damage The damage * @param damage The damage
*/ */
public void setDamage(int damage) { public void setDamage(double damage) {
this.damage = damage; this.damage = damage;
} }
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated
public void _INVALID_setDamage(int damage) {
setDamage(damage);
}
public boolean isCancelled() { public boolean isCancelled() {
return cancelled; return cancelled;
} }

View File

@ -182,7 +182,7 @@ public abstract class PotionEffectType {
return "PotionEffectType[" + id + ", " + getName() + "]"; return "PotionEffectType[" + id + ", " + getName() + "]";
} }
private static final PotionEffectType[] byId = new PotionEffectType[21]; private static final PotionEffectType[] byId = new PotionEffectType[24];
private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>(); private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>();
// will break on updates. // will break on updates.
private static boolean acceptingNew = true; private static boolean acceptingNew = true;