Added new 1.1 items, enchantments. Added WorldType, and a method to set/get the type of a world at creation.

By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2012-01-12 22:16:31 +00:00
parent bc02c87c2a
commit ae73f553fc
5 changed files with 93 additions and 1 deletions

View File

@ -263,6 +263,7 @@ public enum Material {
CAULDRON_ITEM(380),
EYE_OF_ENDER(381),
SPECKLED_MELON(382),
MONSTER_EGG(383, 1),
GOLD_RECORD(2256, 1),
GREEN_RECORD(2257, 1),
RECORD_3(2258, 1),

View File

@ -13,6 +13,7 @@ public class WorldCreator {
private long seed;
private World.Environment environment = World.Environment.NORMAL;
private ChunkGenerator generator = null;
private WorldType type = WorldType.NORMAL;
/**
* Creates an empty WorldCreationOptions for the given world name
@ -115,6 +116,27 @@ public class WorldCreator {
return this;
}
/**
* Gets the type of the world that will be created or loaded
*
* @return World type
*/
public WorldType type() {
return type;
}
/**
* Sets the type of the world that will be created or loaded
*
* @param type World type
* @return This object, for chaining
*/
public WorldCreator type(WorldType type) {
this.type = type;
return this;
}
/**
* Gets the generator that will be used to create or load the world.
* <p>

View File

@ -0,0 +1,44 @@
package org.bukkit;
import java.util.HashMap;
import java.util.Map;
/**
* Represents various types of worlds that may exist
*/
public enum WorldType {
NORMAL("normal"),
FLAT("flat");
private final static Map<String, WorldType> lookup = new HashMap<String, WorldType>();
private final String name;
static {
for (WorldType type : values()) {
lookup.put(type.getName(), type);
}
}
private WorldType(String name) {
this.name = name;
}
/**
* Gets the name of this WorldType
*
* @return Name of this type
*/
public String getName() {
return name;
}
/**
* Gets a Worldtype by its name
*
* @param name Name of the WorldType to get
* @return Requested WorldType, or null if not found
*/
public static WorldType getByName(String name) {
return lookup.get(name.toUpperCase());
}
}

View File

@ -93,6 +93,26 @@ public abstract class Enchantment {
*/
public static final Enchantment LOOT_BONUS_BLOCKS = new EnchantmentWrapper(35);
/**
* Provides extra damage when shooting arrows from bows
*/
public static final Enchantment ARROW_DAMAGE = new EnchantmentWrapper(48);
/**
* Provides a knockback when an entity is hit by an arrow from a bow
*/
public static final Enchantment ARROW_KNOCKBACK = new EnchantmentWrapper(49);
/**
* Sets entities on fire when hit by arrows shot from a bow
*/
public static final Enchantment ARROW_FIRE = new EnchantmentWrapper(50);
/**
* Provides infinite arrows when shooting a bow
*/
public static final Enchantment ARROW_INFINITE = new EnchantmentWrapper(51);
private static final Map<Integer, Enchantment> byId = new HashMap<Integer, Enchantment>();
private static final Map<String, Enchantment> byName = new HashMap<String, Enchantment>();
private static boolean acceptingNew = true;

View File

@ -42,5 +42,10 @@ public enum EnchantmentTarget {
/**
* Allows the Enchantment to be placed on tools (spades, pickaxe, hoes, axes)
*/
TOOL;
TOOL,
/**
* Allows the Enchantment to be placed on bows.
*/
BOW;
}