Minecraft 1.12-pre2 API Changes

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2017-05-14 12:00:00 +10:00
parent 05d2efaa86
commit 75a18fd5ad
29 changed files with 785 additions and 36 deletions

View File

@ -62,20 +62,20 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
<version>21.0</version>
<scope>compile</scope>
</dependency>
<!-- bundled with Minecraft, should be kept in sync -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
<version>2.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.17</version>
<version>1.18</version>
<scope>compile</scope>
</dependency>
<!-- testing -->

View File

@ -41,6 +41,7 @@ import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.util.CachedServerIcon;
import com.google.common.collect.ImmutableList;
import org.bukkit.advancement.Advancement;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemFactory;
@ -533,6 +534,14 @@ public final class Bukkit {
server.reload();
}
/**
* Reload only the Minecraft data for the server. This includes custom
* advancements and loot tables.
*/
public static void reloadData() {
server.reloadData();
}
/**
* Returns the primary logger associated with this server instance.
*
@ -1125,6 +1134,16 @@ public final class Bukkit {
return server.getEntity(uuid);
}
/**
* Get the advancement specified by this key.
*
* @param key unique advancement key
* @return advancement or null if not exists
*/
public static Advancement getAdvancement(NamespacedKey key) {
return server.getAdvancement(key);
}
/**
* @see UnsafeValues
* @return the unsafe values instance

View File

@ -12,67 +12,67 @@ public enum DyeColor {
/**
* Represents white dye.
*/
WHITE(0x0, 0xF, Color.WHITE, Color.fromRGB(0xF0F0F0)),
WHITE(0x0, 0xF, Color.fromRGB(0xF9FFFE), Color.fromRGB(0xF0F0F0)),
/**
* Represents orange dye.
*/
ORANGE(0x1, 0xE, Color.fromRGB(0xD87F33), Color.fromRGB(0xEB8844)),
ORANGE(0x1, 0xE, Color.fromRGB(0xF9801D), Color.fromRGB(0xEB8844)),
/**
* Represents magenta dye.
*/
MAGENTA(0x2, 0xD, Color.fromRGB(0xB24CD8), Color.fromRGB(0xC354CD)),
MAGENTA(0x2, 0xD, Color.fromRGB(0xC74EBD), Color.fromRGB(0xC354CD)),
/**
* Represents light blue dye.
*/
LIGHT_BLUE(0x3, 0xC, Color.fromRGB(0x6699D8), Color.fromRGB(0x6689D3)),
LIGHT_BLUE(0x3, 0xC, Color.fromRGB(0x3AB3DA), Color.fromRGB(0x6689D3)),
/**
* Represents yellow dye.
*/
YELLOW(0x4, 0xB, Color.fromRGB(0xE5E533), Color.fromRGB(0xDECF2A)),
YELLOW(0x4, 0xB, Color.fromRGB(0xFED83D), Color.fromRGB(0xDECF2A)),
/**
* Represents lime dye.
*/
LIME(0x5, 0xA, Color.fromRGB(0x7FCC19), Color.fromRGB(0x41CD34)),
LIME(0x5, 0xA, Color.fromRGB(0x80C71F), Color.fromRGB(0x41CD34)),
/**
* Represents pink dye.
*/
PINK(0x6, 0x9, Color.fromRGB(0xF27FA5), Color.fromRGB(0xD88198)),
PINK(0x6, 0x9, Color.fromRGB(0xF38BAA), Color.fromRGB(0xD88198)),
/**
* Represents gray dye.
*/
GRAY(0x7, 0x8, Color.fromRGB(0x4C4C4C), Color.fromRGB(0x434343)),
GRAY(0x7, 0x8, Color.fromRGB(0x474F52), Color.fromRGB(0x434343)),
/**
* Represents silver dye.
*/
SILVER(0x8, 0x7, Color.fromRGB(0x999999), Color.fromRGB(0xABABAB)),
SILVER(0x8, 0x7, Color.fromRGB(0x9D9D97), Color.fromRGB(0xABABAB)),
/**
* Represents cyan dye.
*/
CYAN(0x9, 0x6, Color.fromRGB(0x4C7F99), Color.fromRGB(0x287697)),
CYAN(0x9, 0x6, Color.fromRGB(0x169C9C), Color.fromRGB(0x287697)),
/**
* Represents purple dye.
*/
PURPLE(0xA, 0x5, Color.fromRGB(0x7F3FB2), Color.fromRGB(0x7B2FBE)),
PURPLE(0xA, 0x5, Color.fromRGB(0x8932B8), Color.fromRGB(0x7B2FBE)),
/**
* Represents blue dye.
*/
BLUE(0xB, 0x4, Color.fromRGB(0x334CB2), Color.fromRGB(0x253192)),
BLUE(0xB, 0x4, Color.fromRGB(0x3C44AA), Color.fromRGB(0x253192)),
/**
* Represents brown dye.
*/
BROWN(0xC, 0x3, Color.fromRGB(0x664C33), Color.fromRGB(0x51301A)),
BROWN(0xC, 0x3, Color.fromRGB(0x835432), Color.fromRGB(0x51301A)),
/**
* Represents green dye.
*/
GREEN(0xD, 0x2, Color.fromRGB(0x667F33), Color.fromRGB(0x3B511A)),
GREEN(0xD, 0x2, Color.fromRGB(0x5E7C16), Color.fromRGB(0x3B511A)),
/**
* Represents red dye.
*/
RED(0xE, 0x1, Color.fromRGB(0x993333), Color.fromRGB(0xB3312C)),
RED(0xE, 0x1, Color.fromRGB(0xB02E26), Color.fromRGB(0xB3312C)),
/**
* Represents black dye.
*/
BLACK(0xF, 0x0, Color.fromRGB(0x191919), Color.fromRGB(0x1E1B1B));
BLACK(0xF, 0x0, Color.fromRGB(0x1D1D21), Color.fromRGB(0x1E1B1B));
private final byte woolData;
private final byte dyeData;

View File

@ -12,7 +12,7 @@ public enum Instrument {
PIANO(0x0),
/**
* Bass drum is normally played when a note block is on top of a
* stone-like block
* stone-like block.
*/
BASS_DRUM(0x1),
/**
@ -29,7 +29,28 @@ public enum Instrument {
* Bass guitar is normally played when a note block is on top of a wooden
* block.
*/
BASS_GUITAR(0x4);
BASS_GUITAR(0x4),
/**
* Flute is normally played when a note block is on top of a clay block.
*/
FLUTE(0x5),
/**
* Bell is normally played when a note block is on top of a gold block.
*/
BELL(0x6),
/**
* Guitar is normally played when a note block is on top of a woolen block.
*/
GUITAR(0x7),
/**
* Chime is normally played when a note block is on top of a packed ice
* block.
*/
CHIME(0x8),
/**
* Xylophone is normally played when a note block is on top of a bone block.
*/
XYLOPHONE(0x9);
private final byte type;
private final static Map<Byte, Instrument> BY_DATA = Maps.newHashMap();

View File

@ -0,0 +1,14 @@
package org.bukkit;
/**
* Represents an object which has a {@link NamespacedKey} attached to it.
*/
public interface Keyed {
/**
* Return the namespaced identifier for this object.
*
* @return this object's key
*/
NamespacedKey getKey();
}

View File

@ -304,6 +304,24 @@ public enum Material {
GREEN_SHULKER_BOX(232, 1),
RED_SHULKER_BOX(233, 1),
BLACK_SHULKER_BOX(234, 1),
WHITE_GLAZED_TERRACOTTA(235),
ORANGE_GLAZED_TERRACOTTA(236),
MAGENTA_GLAZED_TERRACOTTA(237),
LIGHT_BLUE_GLAZED_TERRACOTTA(238),
YELLOW_GLAZED_TERRACOTTA(239),
LIME_GLAZED_TERRACOTTA(240),
PINK_GLAZED_TERRACOTTA(241),
GRAY_GLAZED_TERRACOTTA(242),
SILVER_GLAZED_TERRACOTTA(243),
CYAN_GLAZED_TERRACOTTA(244),
PURPLE_GLAZED_TERRACOTTA(245),
BLUE_GLAZED_TERRACOTTA(246),
BROWN_GLAZED_TERRACOTTA(247),
GREEN_GLAZED_TERRACOTTA(248),
RED_GLAZED_TERRACOTTA(249),
BLACK_GLAZED_TERRACOTTA(250),
CONCRETE(251),
CONCRETE_POWDER(252),
STRUCTURE_BLOCK(255),
// ----- Item Separator -----
IRON_SPADE(256, 1, 250),
@ -505,6 +523,7 @@ public enum Material {
TOTEM(449, 1),
SHULKER_SHELL(450),
IRON_NUGGET(452),
KNOWLEDGE_BOOK(453, 1),
GOLD_RECORD(2256, 1),
GREEN_RECORD(2257, 1),
RECORD_3(2258, 1),
@ -946,6 +965,24 @@ public enum Material {
case GREEN_SHULKER_BOX:
case RED_SHULKER_BOX:
case BLACK_SHULKER_BOX:
case WHITE_GLAZED_TERRACOTTA:
case ORANGE_GLAZED_TERRACOTTA:
case MAGENTA_GLAZED_TERRACOTTA:
case LIGHT_BLUE_GLAZED_TERRACOTTA:
case YELLOW_GLAZED_TERRACOTTA:
case LIME_GLAZED_TERRACOTTA:
case PINK_GLAZED_TERRACOTTA:
case GRAY_GLAZED_TERRACOTTA:
case SILVER_GLAZED_TERRACOTTA:
case CYAN_GLAZED_TERRACOTTA:
case PURPLE_GLAZED_TERRACOTTA:
case BLUE_GLAZED_TERRACOTTA:
case BROWN_GLAZED_TERRACOTTA:
case GREEN_GLAZED_TERRACOTTA:
case RED_GLAZED_TERRACOTTA:
case BLACK_GLAZED_TERRACOTTA:
case CONCRETE:
case CONCRETE_POWDER:
return true;
default:
return false;
@ -1310,6 +1347,24 @@ public enum Material {
case NETHER_WART_BLOCK:
case RED_NETHER_BRICK:
case BONE_BLOCK:
case WHITE_GLAZED_TERRACOTTA:
case ORANGE_GLAZED_TERRACOTTA:
case MAGENTA_GLAZED_TERRACOTTA:
case LIGHT_BLUE_GLAZED_TERRACOTTA:
case YELLOW_GLAZED_TERRACOTTA:
case LIME_GLAZED_TERRACOTTA:
case PINK_GLAZED_TERRACOTTA:
case GRAY_GLAZED_TERRACOTTA:
case SILVER_GLAZED_TERRACOTTA:
case CYAN_GLAZED_TERRACOTTA:
case PURPLE_GLAZED_TERRACOTTA:
case BLUE_GLAZED_TERRACOTTA:
case BROWN_GLAZED_TERRACOTTA:
case GREEN_GLAZED_TERRACOTTA:
case RED_GLAZED_TERRACOTTA:
case BLACK_GLAZED_TERRACOTTA:
case CONCRETE:
case CONCRETE_POWDER:
return true;
default:
return false;
@ -1327,6 +1382,7 @@ public enum Material {
case SAND:
case GRAVEL:
case ANVIL:
case CONCRETE_POWDER:
return true;
default:
return false;

View File

@ -0,0 +1,120 @@
package org.bukkit;
import com.google.common.base.Preconditions;
import java.util.Locale;
import java.util.UUID;
import org.bukkit.plugin.Plugin;
/**
* Represents a String based key which consists of two components - a namespace
* and a key.
*/
public final class NamespacedKey {
/**
* The namespace representing all inbuilt keys.
*/
public static final String MINECRAFT = "minecraft";
/**
* The namespace representing all keys generated by Bukkit for backwards
* compatability measures.
*/
public static final String BUKKIT = "bukkit";
//
private final String namespace;
private final String key;
/**
* Create a key in a specific namespace.
*
* @param namespace
* @param key
* @deprecated should never be used by plugins, for internal use only!!
*/
@Deprecated
public NamespacedKey(String namespace, String key) {
Preconditions.checkArgument(namespace != null && !namespace.isEmpty(), "namespace");
Preconditions.checkArgument(key != null, "key");
this.namespace = namespace;
this.key = key;
String string = toString();
Preconditions.checkArgument(string.indexOf(' ') == -1, "NamespacedKey cannot contain spaces (%s)", string);
Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters", string);
}
/**
* Create a key in the plugin's namespace.
*
* @param plugin the plugin to use for the namespace
* @param key the key to create
*/
public NamespacedKey(Plugin plugin, String key) {
Preconditions.checkArgument(plugin != null, "plugin");
Preconditions.checkArgument(key != null, "key");
// Plugin names cannot have spaces anymore (SimplePluginManager)
Preconditions.checkArgument(key.indexOf(' ') == -1, "key cannot contain spaces (%s)", key);
this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
this.key = key.toLowerCase().toLowerCase(Locale.ROOT);
String string = toString();
Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters (%s)", string);
}
public String getNamespace() {
return namespace;
}
public String getKey() {
return key;
}
@Override
public int hashCode() {
int hash = 5;
hash = 47 * hash + this.namespace.hashCode();
hash = 47 * hash + this.key.hashCode();
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final NamespacedKey other = (NamespacedKey) obj;
return this.namespace.equals(other.namespace) && this.key.equals(other.key);
}
@Override
public String toString() {
return this.namespace + ":" + this.key;
}
/**
* Return a new random key in the {@link #BUKKIT} namespace.
*
* @return new key
* @deprecated should never be used by plugins, for internal use only!!
*/
@Deprecated
public static NamespacedKey randomKey() {
return new NamespacedKey(BUKKIT, UUID.randomUUID().toString());
}
/**
* Get a key in the Minecraft namespace.
*
* @param key the key to use
* @return new key in the Minecraft namespace
*/
public static NamespacedKey minecraft(String key) {
return new NamespacedKey(MINECRAFT, key);
}
}

View File

@ -42,6 +42,7 @@ import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.util.CachedServerIcon;
import com.google.common.collect.ImmutableList;
import org.bukkit.advancement.Advancement;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemFactory;
@ -439,6 +440,12 @@ public interface Server extends PluginMessageRecipient {
*/
public void reload();
/**
* Reload only the Minecraft data for the server. This includes custom
* advancements and loot tables.
*/
public void reloadData();
/**
* Returns the primary logger associated with this server instance.
*
@ -921,6 +928,14 @@ public interface Server extends PluginMessageRecipient {
*/
Entity getEntity(UUID uuid);
/**
* Get the advancement specified by this key.
*
* @param key unique advancement key
* @return advancement or null if not exists
*/
Advancement getAdvancement(NamespacedKey key);
/**
* @see UnsafeValues
* @return the unsafe values instance

View File

@ -37,6 +37,8 @@ public enum Sound {
BLOCK_ENDERCHEST_CLOSE,
BLOCK_ENDERCHEST_OPEN,
BLOCK_END_GATEWAY_SPAWN,
BLOCK_END_PORTAL_FRAME_FILL,
BLOCK_END_PORTAL_SPAWN,
BLOCK_FENCE_GATE_CLOSE,
BLOCK_FENCE_GATE_OPEN,
BLOCK_FIRE_AMBIENT,
@ -79,10 +81,15 @@ public enum Sound {
BLOCK_METAL_STEP,
BLOCK_NOTE_BASEDRUM,
BLOCK_NOTE_BASS,
BLOCK_NOTE_BELL,
BLOCK_NOTE_CHIME,
BLOCK_NOTE_FLUTE,
BLOCK_NOTE_GUITAR,
BLOCK_NOTE_HARP,
BLOCK_NOTE_HAT,
BLOCK_NOTE_PLING,
BLOCK_NOTE_SNARE,
BLOCK_NOTE_XYLOPHONE,
BLOCK_PISTON_CONTRACT,
BLOCK_PISTON_EXTEND,
BLOCK_PORTAL_AMBIENT,
@ -152,6 +159,9 @@ public enum Sound {
ENTITY_BLAZE_DEATH,
ENTITY_BLAZE_HURT,
ENTITY_BLAZE_SHOOT,
ENTITY_BOAT_PADDLE_LAND,
ENTITY_BOAT_PADDLE_WATER,
ENTITY_BOBBER_RETRIEVE,
ENTITY_BOBBER_SPLASH,
ENTITY_BOBBER_THROW,
ENTITY_CAT_AMBIENT,
@ -194,6 +204,7 @@ public enum Sound {
ENTITY_ENDERDRAGON_GROWL,
ENTITY_ENDERDRAGON_HURT,
ENTITY_ENDERDRAGON_SHOOT,
ENTITY_ENDEREYE_DEATH,
ENTITY_ENDEREYE_LAUNCH,
ENTITY_ENDERMEN_AMBIENT,
ENTITY_ENDERMEN_DEATH,
@ -272,6 +283,13 @@ public enum Sound {
ENTITY_HUSK_DEATH,
ENTITY_HUSK_HURT,
ENTITY_HUSK_STEP,
ENTITY_ILLUSION_ILLAGER_AMBIENT,
ENTITY_ILLUSION_ILLAGER_CAST_SPELL,
ENTITY_ILLUSION_ILLAGER_DEATH,
ENTITY_ILLUSION_ILLAGER_HURT,
ENTITY_ILLUSION_ILLAGER_MIRROR_MOVE,
ENTITY_ILLUSION_ILLAGER_PREPARE_BLINDNESS,
ENTITY_ILLUSION_ILLAGER_PREPARE_MIRROR,
ENTITY_IRONGOLEM_ATTACK,
ENTITY_IRONGOLEM_DEATH,
ENTITY_IRONGOLEM_HURT,
@ -310,6 +328,39 @@ public enum Sound {
ENTITY_MULE_HURT,
ENTITY_PAINTING_BREAK,
ENTITY_PAINTING_PLACE,
ENTITY_PARROT_AMBIENT,
ENTITY_PARROT_DEATH,
ENTITY_PARROT_EAT,
ENTITY_PARROT_FLY,
ENTITY_PARROT_HURT,
ENTITY_PARROT_IMITATE_BLAZE,
ENTITY_PARROT_IMITATE_CREEPER,
ENTITY_PARROT_IMITATE_ELDER_GUARDIAN,
ENTITY_PARROT_IMITATE_ENDERDRAGON,
ENTITY_PARROT_IMITATE_ENDERMAN,
ENTITY_PARROT_IMITATE_ENDERMITE,
ENTITY_PARROT_IMITATE_EVOCATION_ILLAGER,
ENTITY_PARROT_IMITATE_GHAST,
ENTITY_PARROT_IMITATE_HUSK,
ENTITY_PARROT_IMITATE_ILLUSION_ILLAGER,
ENTITY_PARROT_IMITATE_MAGMACUBE,
ENTITY_PARROT_IMITATE_POLAR_BEAR,
ENTITY_PARROT_IMITATE_SHULKER,
ENTITY_PARROT_IMITATE_SILVERFISH,
ENTITY_PARROT_IMITATE_SKELETON,
ENTITY_PARROT_IMITATE_SLIME,
ENTITY_PARROT_IMITATE_SPIDER,
ENTITY_PARROT_IMITATE_STRAY,
ENTITY_PARROT_IMITATE_VEX,
ENTITY_PARROT_IMITATE_VINDICATION_ILLAGER,
ENTITY_PARROT_IMITATE_WITCH,
ENTITY_PARROT_IMITATE_WITHER,
ENTITY_PARROT_IMITATE_WITHER_SKELETON,
ENTITY_PARROT_IMITATE_WOLF,
ENTITY_PARROT_IMITATE_ZOMBIE,
ENTITY_PARROT_IMITATE_ZOMBIE_PIGMAN,
ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER,
ENTITY_PARROT_STEP,
ENTITY_PIG_AMBIENT,
ENTITY_PIG_DEATH,
ENTITY_PIG_HURT,
@ -326,6 +377,8 @@ public enum Sound {
ENTITY_PLAYER_BURP,
ENTITY_PLAYER_DEATH,
ENTITY_PLAYER_HURT,
ENTITY_PLAYER_HURT_DROWN,
ENTITY_PLAYER_HURT_ON_FIRE,
ENTITY_PLAYER_LEVELUP,
ENTITY_PLAYER_SMALL_FALL,
ENTITY_PLAYER_SPLASH,

View File

@ -2,6 +2,7 @@ package org.bukkit;
import java.util.List;
import org.bukkit.advancement.Advancement;
import org.bukkit.inventory.ItemStack;
/**
@ -11,10 +12,6 @@ import org.bukkit.inventory.ItemStack;
* Their existence and behavior is not guaranteed across future versions. They
* may be poorly named, throw exceptions, have misleading parameters, or any
* other bad programming practice.
* <p>
* This interface is unsupported and only for internal use.
*
* @deprecated Unsupported {@literal &} internal use only
*/
@Deprecated
public interface UnsafeValues {
@ -30,4 +27,36 @@ public interface UnsafeValues {
Achievement getAchievementFromInternalName(String name);
List<String> tabCompleteInternalStatisticOrAchievementName(String token, List<String> completions);
/**
* Load an advancement represented by the specified string into the server.
* The advancement format is governed by Minecraft and has no specified
* layout.
* <br>
* It is currently a JSON object, as described by the Minecraft Wiki:
* http://minecraft.gamepedia.com/Advancements
* <br>
* Loaded advancements will be stored and persisted across server restarts
* and reloads.
* <br>
* Callers should be prepared for {@link Exception} to be thrown.
*
* @param key the unique advancement key
* @param advancement representation of the advancement
* @return the loaded advancement or null if an error occurred
*/
Advancement loadAdvancement(NamespacedKey key, String advancement);
/**
* Delete an advancement which was loaded and saved by
* {@link #loadAdvancement(org.bukkit.NamespacedKey, java.lang.String)}.
* <br>
* This method will only remove advancement from persistent storage. It
* should be accompanied by a call to {@link Server#reloadData()} in order
* to fully remove it from the running instance.
*
* @param key the unique advancement key
* @return true if a file matching this key was found and deleted
*/
boolean removeAdvancement(NamespacedKey key);
}

View File

@ -0,0 +1,18 @@
package org.bukkit.advancement;
import java.util.Collection;
import org.bukkit.Keyed;
/**
* Represents an advancement that may be awarded to a player. This class is not
* reference safe as the underlying advancement may be reloaded.
*/
public interface Advancement extends Keyed {
/**
* Get all the criteria present in this advancement.
*
* @return a unmodifiable copy of all criteria
*/
Collection<String> getCriteria();
}

View File

@ -0,0 +1,64 @@
package org.bukkit.advancement;
import java.util.Collection;
import java.util.Date;
/**
* The individual status of an advancement for a player. This class is not
* reference safe as the underlying advancement may be reloaded.
*/
public interface AdvancementProgress {
/**
* The advancement this progress is concerning.
*
* @return the relevant advancement
*/
Advancement getAdvancement();
/**
* Check if all criteria for this advancement have been met.
*
* @return true if this advancement is done
*/
boolean isDone();
/**
* Mark the specified criteria as awarded at the current time.
*
* @param criteria the criteria to mark
* @return true if awarded, false if criteria does not exist or already
* awarded.
*/
boolean awardCriteria(String criteria);
/**
* Mark the specified criteria as uncompleted.
*
* @param criteria the criteria to mark
* @return true if removed, false if criteria does not exist or not awarded
*/
boolean revokeCriteria(String criteria);
/**
* Get the date the specified critera was awarded.
*
* @param criteria the criteria to check
* @return date awarded or null if unawarded or criteria does not exist
*/
Date getDateAwarded(String criteria);
/**
* Get the criteria which have not been awarded.
*
* @return unmodifiable copy of criteria remaining
*/
Collection<String> getRemainingCriteria();
/**
* Gets the criteria which have been awarded.
*
* @return unmodifiable copy of criteria awarded
*/
Collection<String> getAwardedCriteria();
}

View File

@ -21,6 +21,10 @@ public enum Attribute {
* Movement speed of an Entity.
*/
GENERIC_MOVEMENT_SPEED,
/**
* Flying speed of an Entity.
*/
GENERIC_FLYING_SPEED,
/**
* Attack damage of an Entity.
*/

View File

@ -0,0 +1,8 @@
package org.bukkit.block;
import org.bukkit.material.Colorable;
/**
* Represents a bed.
*/
public interface Bed extends BlockState, Colorable { }

View File

@ -165,6 +165,10 @@ public enum EntityType {
* @see Vindicator
*/
VINDICATOR("vindication_illager", Vindicator.class, 36),
/**
* @see Illusioner
*/
ILLUSIONER("illusion_illager", Illusioner.class, 37),
/**
* @see CommandMinecart
*/
@ -232,6 +236,7 @@ public enum EntityType {
POLAR_BEAR("polar_bear", PolarBear.class, 102),
LLAMA("llama", Llama.class, 103),
LLAMA_SPIT("llama_spit", LlamaSpit.class, 104),
PARROT("parrot", Parrot.class, 105),
VILLAGER("villager", Villager.class, 120),
ENDER_CRYSTAL("ender_crystal", EnderCrystal.class, 200),
// These don't have an entity ID in nms.EntityTypes.

View File

@ -1,9 +1,9 @@
package org.bukkit.entity;
/**
* Represents an Evoker.
* Represents an Evoker "Illager".
*/
public interface Evoker extends Monster {
public interface Evoker extends Spellcaster {
/**
* Represents the current spell the Evoker is using.
@ -29,7 +29,15 @@ public interface Evoker extends Monster {
/**
* The "wololo" spell.
*/
WOLOLO;
WOLOLO,
/**
* The spell that makes the casting entity invisible.
*/
DISAPPEAR,
/**
* The spell that makes the target blind.
*/
BLINDNESS;
}
/**

View File

@ -255,4 +255,66 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv
* @return Experience required to level up
*/
public int getExpToLevel();
/**
* Gets the entity currently perched on the left shoulder or null if no
* entity.
* <br>
* The returned entity will not be spawned within the world, so most
* operations are invalid unless the entity is first spawned in.
*
* @return left shoulder entity
* @deprecated There are currently no well defined semantics regarding
* serialized entities in Bukkit. Use with care.
*/
@Deprecated
public Entity getShoulderEntityLeft();
/**
* Sets the entity currently perched on the left shoulder, or null to
* remove. This method will remove the entity from the world.
* <br>
* Note that only a copy of the entity will be set to display on the
* shoulder.
* <br>
* Also note that the client will currently only render {@link Parrot}
* entities.
*
* @param entity left shoulder entity
* @deprecated There are currently no well defined semantics regarding
* serialized entities in Bukkit. Use with care.
*/
@Deprecated
public void setShoulderEntityLeft(Entity entity);
/**
* Gets the entity currently perched on the right shoulder or null if no
* entity.
* <br>
* The returned entity will not be spawned within the world, so most
* operations are invalid unless the entity is first spawned in.
*
* @return right shoulder entity
* @deprecated There are currently no well defined semantics regarding
* serialized entities in Bukkit. Use with care.
*/
@Deprecated
public Entity getShoulderEntityRight();
/**
* Sets the entity currently perched on the right shoulder, or null to
* remove. This method will remove the entity from the world.
* <br>
* Note that only a copy of the entity will be set to display on the
* shoulder.
* <br>
* Also note that the client will currently only render {@link Parrot}
* entities.
*
* @param entity right shoulder entity
* @deprecated There are currently no well defined semantics regarding
* serialized entities in Bukkit. Use with care.
*/
@Deprecated
public void setShoulderEntityRight(Entity entity);
}

View File

@ -0,0 +1,6 @@
package org.bukkit.entity;
/**
* Represents a type of "Illager".
*/
public interface Illager extends Monster { }

View File

@ -0,0 +1,6 @@
package org.bukkit.entity;
/**
* Represents an Illusioner "Illager".
*/
public interface Illusioner extends Spellcaster { }

View File

@ -0,0 +1,47 @@
package org.bukkit.entity;
/**
* Represents a Parrot.
*/
public interface Parrot extends Animals, Tameable {
/**
* Get the variant of this parrot.
*
* @return parrot variant
*/
public Variant getVariant();
/**
* Set the variant of this parrot.
*
* @param variant parrot variant
*/
public void setVariant(Variant variant);
/**
* Represents the variant of a parrot - ie its color.
*/
public enum Variant {
/**
* Classic parrot - red with colored wingtips.
*/
RED,
/**
* Royal blue colored parrot.
*/
BLUE,
/**
* Green colored parrot.
*/
GREEN,
/**
* Cyan colored parrot.
*/
CYAN,
/**
* Gray colored parrot.
*/
GRAY;
}
}

View File

@ -16,6 +16,8 @@ import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.Statistic;
import org.bukkit.WeatherType;
import org.bukkit.advancement.Advancement;
import org.bukkit.advancement.AdvancementProgress;
import org.bukkit.command.CommandSender;
import org.bukkit.conversations.Conversable;
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
@ -1388,4 +1390,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
/**
* Return the player's progression on the specified advancement.
*
* @param advancement advancement
* @return object detailing the player's progress
*/
public AdvancementProgress getAdvancementProgress(Advancement advancement);
}

View File

@ -0,0 +1,52 @@
package org.bukkit.entity;
/**
* Represents a spell casting "Illager".
*/
public interface Spellcaster extends Illager {
/**
* Represents the current spell the entity is using.
*/
public enum Spell {
/**
* No spell is being used..
*/
NONE,
/**
* The spell that summons Vexes.
*/
SUMMON_VEX,
/**
* The spell that summons Fangs.
*/
FANGS,
/**
* The "wololo" spell.
*/
WOLOLO,
/**
* The spell that makes the casting entity invisible.
*/
DISAPPEAR,
/**
* The spell that makes the target blind.
*/
BLINDNESS;
}
/**
* Gets the {@link Spell} the entity is currently using.
*
* @return the current spell
*/
Spell getSpell();
/**
* Sets the {@link Spell} the entity is currently using.
*
* @param spell the spell the entity should be using
*/
void setSpell(Spell spell);
}

View File

@ -3,4 +3,4 @@ package org.bukkit.entity;
/**
* Represents a Vindicator.
*/
public interface Vindicator extends Monster { }
public interface Vindicator extends Illager { }

View File

@ -165,6 +165,11 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
* When an entity is spawned as a result of ender pearl usage
*/
ENDER_PEARL,
/**
* When an entity is spawned as a result of the entity it is being
* perched on jumping or being damaged
*/
SHOULDER_ENTITY,
/**
* When a creature is spawned by plugins
*/

View File

@ -0,0 +1,38 @@
package org.bukkit.event.player;
import org.bukkit.advancement.Advancement;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/**
* Called when a player has completed all criteria in an advancement.
*/
public class PlayerAdvancementDoneEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
//
private final Advancement advancement;
public PlayerAdvancementDoneEvent(Player who, Advancement advancement) {
super(who);
this.advancement = advancement;
}
/**
* Get the advancement which has been completed.
*
* @return completed advancement
*/
public Advancement getAdvancement() {
return advancement;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -1,33 +1,47 @@
package org.bukkit.inventory;
import com.google.common.base.Preconditions;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.Validate;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.material.MaterialData;
/**
* Represents a shaped (ie normal) crafting recipe.
*/
public class ShapedRecipe implements Recipe {
private ItemStack output;
public class ShapedRecipe implements Recipe, Keyed {
private final NamespacedKey key;
private final ItemStack output;
private String[] rows;
private Map<Character, ItemStack> ingredients = new HashMap<Character, ItemStack>();
@Deprecated
public ShapedRecipe(ItemStack result) {
this.key = NamespacedKey.randomKey();
this.output = new ItemStack(result);
}
/**
* Create a shaped recipe to craft the specified ItemStack. The
* constructor merely determines the result and type; to set the actual
* recipe, you'll need to call the appropriate methods.
*
* @param key the unique recipe key
* @param result The item you want the recipe to create.
* @see ShapedRecipe#shape(String...)
* @see ShapedRecipe#setIngredient(char, Material)
* @see ShapedRecipe#setIngredient(char, Material, int)
* @see ShapedRecipe#setIngredient(char, MaterialData)
*/
public ShapedRecipe(ItemStack result) {
public ShapedRecipe(NamespacedKey key, ItemStack result) {
Preconditions.checkArgument(key != null, "key");
this.key = key;
this.output = new ItemStack(result);
}
@ -149,4 +163,9 @@ public class ShapedRecipe implements Recipe {
public ItemStack getResult() {
return output.clone();
}
@Override
public NamespacedKey getKey() {
return key;
}
}

View File

@ -5,23 +5,33 @@ import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.Validate;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.material.MaterialData;
/**
* Represents a shapeless recipe, where the arrangement of the ingredients on
* the crafting grid does not matter.
*/
public class ShapelessRecipe implements Recipe {
private ItemStack output;
private List<ItemStack> ingredients = new ArrayList<ItemStack>();
public class ShapelessRecipe implements Recipe, Keyed {
private final NamespacedKey key;
private final ItemStack output;
private final List<ItemStack> ingredients = new ArrayList<ItemStack>();
@Deprecated
public ShapelessRecipe(ItemStack result) {
this.key = NamespacedKey.randomKey();
this.output = new ItemStack(result);
}
/**
* Create a shapeless recipe to craft the specified ItemStack. The
* constructor merely determines the result and type; to set the actual
* recipe, you'll need to call the appropriate methods.
*
* @param key the unique recipe key
* @param result The item you want the recipe to create.
* @see ShapelessRecipe#addIngredient(Material)
* @see ShapelessRecipe#addIngredient(MaterialData)
@ -30,7 +40,8 @@ public class ShapelessRecipe implements Recipe {
* @see ShapelessRecipe#addIngredient(int,MaterialData)
* @see ShapelessRecipe#addIngredient(int,Material,int)
*/
public ShapelessRecipe(ItemStack result) {
public ShapelessRecipe(NamespacedKey key, ItemStack result) {
this.key = key;
this.output = new ItemStack(result);
}
@ -223,4 +234,9 @@ public class ShapelessRecipe implements Recipe {
}
return result;
}
@Override
public NamespacedKey getKey() {
return key;
}
}

View File

@ -0,0 +1,39 @@
package org.bukkit.inventory.meta;
import java.util.List;
import org.bukkit.NamespacedKey;
public interface KnowledgeBookMeta extends ItemMeta {
/**
* Checks for the existence of recipes in the book.
*
* @return true if the book has recipes
*/
boolean hasRecipes();
/**
* Gets all the recipes in the book.
*
* @return list of all the recipes in the book
*/
List<NamespacedKey> getRecipes();
/**
* Clears the existing book recipes, and sets the book to use the provided
* recipes.
*
* @param recipes A list of recipes to set the book to use
*/
void setRecipes(List<NamespacedKey> recipes);
/**
* Adds new recipe to the end of the book.
*
* @param recipes A list of recipe keys
*/
void addRecipe(NamespacedKey... recipes);
@Override
KnowledgeBookMeta clone();
}

View File

@ -67,6 +67,22 @@ public final class MapPalette {
c(0, 153, 40), c(0, 187, 50), c(0, 217, 58), c(0, 114, 30),
c(91, 60, 34), c(111, 74, 42), c(129, 86, 49), c(68, 45, 25),
c(79, 1, 0), c(96, 1, 0), c(112, 2, 0), c(59, 1, 0),
c(147, 124, 113), c(180, 152, 138), c(209, 177, 161), c(110, 93, 85),
c(112, 57, 25), c(137, 70, 31), c(159, 82, 36), c(84, 43, 19),
c(105, 61, 76), c(128, 75, 93), c(149, 87, 108), c(78, 46, 57),
c(79, 76, 97), c(96, 93, 119), c(112, 108, 138), c(59, 57, 73),
c(131, 93, 25), c(160, 114, 31), c(186, 133, 36), c(98, 70, 19),
c(72, 82, 37), c(88, 100, 45), c(103, 117, 53), c(54, 61, 28),
c(112, 54, 55), c(138, 66, 67), c(160, 77, 78), c(84, 40, 41),
c(40, 28, 24), c(49, 35, 30), c(57, 41, 35), c(30, 21, 18),
c(95, 75, 69), c(116, 92, 84), c(135, 107, 98), c(71, 56, 51),
c(61, 64, 64), c(75, 79, 79), c(87, 92, 92), c(46, 48, 48),
c(86, 51, 62), c(105, 62, 75), c(122, 73, 88), c(64, 38, 46),
c(53, 43, 64), c(65, 53, 79), c(76, 62, 92), c(40, 32, 48),
c(53, 35, 24), c(65, 43, 30), c(76, 50, 35), c(40, 26, 18),
c(53, 57, 29), c(65, 70, 36), c(76, 82, 42), c(40, 43, 22),
c(100, 42, 32), c(122, 51, 39), c(142, 60, 46), c(75, 31, 24),
c(26, 15, 11), c(31, 18, 13), c(37, 22, 16), c(19, 11, 8)
};
// Interface