@@ -25,48 +25,28 @@
*/
package org.spout.vanilla.material.block;

import org.spout.api.material.SubMaterial;
import org.spout.vanilla.material.Plant;
import org.spout.vanilla.material.attachable.GroundAttachable;

public class Sapling extends GroundAttachable implements Plant, SubMaterial {
public final Sapling DEFAULT;
public final Sapling SPRUCE;
public final Sapling BIRCH;
public final Sapling JUNGLE;

private final Sapling parent;
private final short data;
public class Sapling extends GroundAttachable implements Plant {
public static final Sapling PARENT = new Sapling("Sapling");
public static final Sapling DEFAULT = PARENT;
public static final Sapling SPRUCE = new Sapling("Spruce Sapling", 1, PARENT);
public static final Sapling BIRCH = new Sapling("Birch Sapling", 2, PARENT);
public static final Sapling JUNGLE = new Sapling("Jungle Sapling", 3, PARENT);

private void setDefault() {
this.setHardness(0.0F).setResistance(0.0F);
}

private Sapling(String name, int data, Sapling parent) {
super(name, 6);
super(name, 6, data, parent);
this.setDefault();
this.parent = parent;
this.data = (short) data;
parent.registerSubMaterial(this);
this.register();

this.DEFAULT = parent.DEFAULT;
this.SPRUCE = parent.SPRUCE;
this.BIRCH = parent.BIRCH;
this.JUNGLE = parent.JUNGLE;
}

public Sapling(String name) {
super(name, 6);
this.setDefault();
this.parent = this;
this.data = 0;
this.register();

this.DEFAULT = new Sapling("Default Sapling", 0, this);
this.SPRUCE = new Sapling("Spruce Sapling", 1, this);
this.BIRCH = new Sapling("Birch Sapling", 2, this);
this.JUNGLE = new Sapling("Jungle Sapling", 3, this);
}

@Override
@@ -83,14 +63,4 @@ public int getNumGrowthStages() {
public int getMinimumLightToGrow() {
return 8;
}

@Override
public short getData() {
return this.data;
}

@Override
public Sapling getParentMaterial() {
return this.parent;
}
}
@@ -29,63 +29,40 @@
import org.spout.api.geo.World;
import org.spout.api.geo.cuboid.Block;
import org.spout.api.material.Material;
import org.spout.api.material.SubMaterial;
import org.spout.api.material.block.BlockFace;
import org.spout.vanilla.VanillaMaterials;
import org.spout.vanilla.material.MovingBlock;
import org.spout.vanilla.material.generic.GenericBlock;

public class Slab extends GenericBlock implements MovingBlock, SubMaterial {
public final Slab STONE;
public final Slab SANDSTONE;
public final Slab WOOD;
public final Slab COBBLESTONE;
public final Slab BRICK;
public final Slab STONE_BRICK;

private final Slab parent;
private final short data;
public class Slab extends GenericBlock implements MovingBlock {
public static final Slab PARENT = new Slab("Stone Slab");
public final Slab STONE = PARENT;
public final Slab SANDSTONE = new Slab("Sandstone Slab", 1, PARENT);
public final Slab WOOD = new Slab("Wooden Slab", 2, PARENT);
public final Slab COBBLESTONE = new Slab("Cobblestone Slab", 3, PARENT);
public final Slab BRICK = new Slab("Brick Slab", 4, PARENT);
public final Slab STONE_BRICK = new Slab("Stone Brick Slab", 5, PARENT);

private DoubleSlab doubletype = VanillaMaterials.DOUBLE_SLABS;

private void setDefault() {
this.setHardness(2.0F).setResistance(10.0F);
}

private Slab(String name, int data, Slab parent) {
super(name, 32);
this.setDefault();
this.parent = parent;
this.data = (short) data;
parent.registerSubMaterial(this);
this.register();

this.STONE = parent.STONE;
this.SANDSTONE = parent.SANDSTONE;
this.WOOD = parent.WOOD;
this.COBBLESTONE = parent.COBBLESTONE;
this.BRICK = parent.BRICK;
this.STONE_BRICK = parent.STONE_BRICK;
}

public Slab(String name) {
super(name, 44);
this.setDefault();
this.parent = this;
this.data = 0;
this.register();
}

private Slab(String name, int data, Slab parent) {
super(name, 44, data, parent);
this.setDefault();
}

this.STONE = new Slab("Stone Slab", 0, this);
this.SANDSTONE = new Slab("Sandstone Slab", 1, this);
this.WOOD = new Slab("Wooden Slab", 2, this);
this.COBBLESTONE = new Slab("Cobblestone Slab", 3, this);
this.BRICK = new Slab("Brick Slab", 4, this);
this.STONE_BRICK = new Slab("Stone Brick Slab", 5, this);
private void setDefault() {
this.setHardness(2.0F).setResistance(10.0F);
}

public void setDoubleSlabMaterial(DoubleSlab material) {
this.doubletype = material;
}

@Override
public boolean onPlacement(World world, int x, int y, int z, short data, BlockFace against, Source source) {
if (against == BlockFace.BOTTOM) {
@@ -107,14 +84,4 @@ public boolean onPlacement(World world, int x, int y, int z, short data, BlockFa
public boolean isMoving() {
return false;
}

@Override
public short getData() {
return this.data;
}

@Override
public Slab getParentMaterial() {
return this.parent;
}
}
@@ -27,6 +27,7 @@

import org.spout.api.geo.World;
import org.spout.api.geo.discrete.Point;
import org.spout.api.material.Material;
import org.spout.vanilla.VanillaMaterials;
import org.spout.vanilla.entity.object.falling.FallingBlock;
import org.spout.vanilla.material.MovingBlock;
@@ -45,6 +46,16 @@ public Solid(String name, int id) {
moving = false;
}

public Solid(String name, int id, int data, Material parent) {
super(name, id, data, parent);
moving = false;
}

public Solid(String name, int id, int data, Material parent, boolean falling) {
super(name, id, data, parent);
moving = falling;
}

@Override
public boolean isMoving() {
return moving;
@@ -25,55 +25,26 @@
*/
package org.spout.vanilla.material.block;

import org.spout.api.material.Material;
import org.spout.api.material.SubMaterial;
import org.spout.vanilla.material.generic.GenericBlock;

public class StoneBrick extends GenericBlock implements SubMaterial {
public final StoneBrick STONE;
public final StoneBrick MOSSY_STONE;
public final StoneBrick CRACKED_STONE;

private final StoneBrick parent;
private final short data;

private void setDefault() {
this.setHardness(1.5F);
this.setResistance(10.0F);
}
public class StoneBrick extends GenericBlock {
public static final StoneBrick PARENT = new StoneBrick("Stone Brick");
public final StoneBrick STONE = PARENT;
public final StoneBrick MOSSY_STONE = new StoneBrick("Mossy Stone Brick", 1, PARENT);
public final StoneBrick CRACKED_STONE = new StoneBrick("Cracked Stone Brick", 2, PARENT);

private StoneBrick(String name, int data, StoneBrick parent) {
super(name, 98);
super(name, 98, data, parent);
this.setDefault();
this.parent = parent;
this.data = (short) data;
this.register();
parent.registerSubMaterial(this);

this.STONE = parent.STONE;
this.MOSSY_STONE = parent.MOSSY_STONE;
this.CRACKED_STONE = parent.CRACKED_STONE;
}

public StoneBrick(String name) {
super(name, 98);
this.setDefault();
this.parent = this;
this.data = 0;
this.register();

this.STONE = new StoneBrick("Stone Brick", 0, this);
this.MOSSY_STONE = new StoneBrick("Mossy Stone Brick", 1, this);
this.CRACKED_STONE = new StoneBrick("Cracked Stone Brick", 2, this);
}

@Override
public short getData() {
return this.data;
}

@Override
public Material getParentMaterial() {
return this.parent;
private void setDefault() {
this.setHardness(1.5F);
this.setResistance(10.0F);
}
}
@@ -25,52 +25,23 @@
*/
package org.spout.vanilla.material.block;

import org.spout.api.material.SubMaterial;
public class TallGrass extends LongGrass {
public static final TallGrass PARENT = new TallGrass("Dead Grass");
public static final TallGrass DEAD_GRASS = PARENT;
public static final TallGrass TALL_GRASS = new TallGrass("Tall Grass", 1, PARENT);
public static final TallGrass FERN = new TallGrass("Fern", 2, PARENT);

public class TallGrass extends LongGrass implements SubMaterial {
public final TallGrass DEAD_GRASS;
public final TallGrass TALL_GRASS;
public final TallGrass FERN;

private final TallGrass parent;
private final short data;

private void setDefault() {
this.setHardness(0.0F).setResistance(0.0F);
}

private TallGrass(String name, int data, TallGrass parent) {
super(name, 31);
this.setDefault();
this.parent = parent;
this.data = (short) data;
parent.registerSubMaterial(this);
this.register();

this.DEAD_GRASS = parent.DEAD_GRASS;
this.TALL_GRASS = parent.TALL_GRASS;
this.FERN = parent.FERN;
}

public TallGrass(String name) {
super(name, 31);
this.setDefault();
this.parent = this;
this.data = 0;
this.register();

this.DEAD_GRASS = new TallGrass("Dead Grass", 0, this);
this.TALL_GRASS = new TallGrass("Tall Grass", 1, this);
this.FERN = new TallGrass("Fern", 2, this);
}

@Override
public short getData() {
return this.data;
private TallGrass(String name, int data, TallGrass parent) {
super(name, 31, data, parent);
this.setDefault();
}

@Override
public TallGrass getParentMaterial() {
return this.parent;
private void setDefault() {
this.setHardness(0.0F).setResistance(0.0F);
}
}
@@ -25,49 +25,28 @@
*/
package org.spout.vanilla.material.block;

import org.spout.api.material.SubMaterial;
import org.spout.vanilla.material.Plant;
import org.spout.vanilla.material.generic.GenericBlock;

public class Tree extends GenericBlock implements Plant, SubMaterial {

public final Tree DEFAULT;
public final Tree SPRUCE;
public final Tree BIRCH;
public final Tree JUNGLE;

private final Tree parent;
private final short data;

private void setDefault() {
this.setHardness(2.0F).setResistance(3.3F).setOpacity((byte) 1);
}

private Tree(String name, int data, Tree parent) {
public class Tree extends GenericBlock implements Plant {
public static final Tree PARENT = new Tree("Wood");
public static final Tree DEFAULT = PARENT;
public static final Tree SPRUCE = new Tree("Spruce Wood", 1, PARENT);
public static final Tree BIRCH = new Tree("Birch Wood", 2, PARENT);
public static final Tree JUNGLE = new Tree("Jungle Wood", 3, PARENT);

public Tree(String name) {
super(name, 17);
this.setDefault();
this.parent = parent;
this.data = (short) data;
parent.registerSubMaterial(this);
this.register();

this.DEFAULT = parent.DEFAULT;
this.SPRUCE = parent.SPRUCE;
this.BIRCH = parent.BIRCH;
this.JUNGLE = parent.JUNGLE;
}
public Tree(String name) {
super(name, 17);

private Tree(String name, int data, Tree parent) {
super(name, 17, data, parent);
this.setDefault();
this.parent = this;
this.data = 0;
this.register();

this.DEFAULT = new Tree("Default Wood", 0, this);
this.SPRUCE = new Tree("Spruce Wood", 1, this);
this.BIRCH = new Tree("Birch Wood", 2, this);
this.JUNGLE = new Tree("Jungle Wood", 3, this);
}

private void setDefault() {
this.setHardness(2.0F).setResistance(3.3F).setOpacity((byte) 1);
}

@Override
@@ -84,14 +63,4 @@ public int getNumGrowthStages() {
public int getMinimumLightToGrow() {
return 0;
}

@Override
public short getData() {
return this.data;
}

@Override
public Tree getParentMaterial() {
return this.parent;
}
}
@@ -26,120 +26,87 @@
package org.spout.vanilla.material.block;

import org.spout.api.material.DataSource;
import org.spout.api.material.SubMaterial;
import org.spout.vanilla.material.MovingBlock;
import org.spout.vanilla.material.generic.GenericBlock;

public class Wool extends GenericBlock implements MovingBlock, SubMaterial {
public final Wool WHITE;
public final Wool ORANGE;
public final Wool MAGENTA;
public final Wool LIGHTBLUE;
public final Wool YELLOW;
public final Wool LIME;
public final Wool PINK;
public final Wool GRAY;
public final Wool SILVER;
public final Wool CYAN;
public final Wool PURPLE;
public final Wool BLUE;
public final Wool BROWN;
public final Wool GREEN;
public final Wool RED;
public final Wool BLACK;
public class Wool extends GenericBlock implements MovingBlock {
public static final Wool PARENT = new Wool("White Wool");
public static final Wool WHITE = PARENT;
public static final Wool ORANGE = new Wool("Orange Wool", WoolColor.Orange, PARENT);
public static final Wool MAGENTA = new Wool("Magenta Wool", WoolColor.Magenta, PARENT);
public static final Wool LIGHTBLUE = new Wool("Light Blue Wool", WoolColor.LightBlue, PARENT);
public static final Wool YELLOW = new Wool("Yellow Wool", WoolColor.Yellow, PARENT);
public static final Wool LIME = new Wool("Lime Wool", WoolColor.Lime, PARENT);
public static final Wool PINK = new Wool("Pink Wool", WoolColor.Pink, PARENT);
public static final Wool GRAY = new Wool("Gray Wool", WoolColor.Gray, PARENT);
public static final Wool SILVER = new Wool("Silver Wool", WoolColor.Silver, PARENT);
public static final Wool CYAN = new Wool("Cyan Wool", WoolColor.Cyan, PARENT);
public static final Wool PURPLE = new Wool("Purple Wool", WoolColor.Purple, PARENT);
public static final Wool BLUE = new Wool("Blue Wool", WoolColor.Blue, PARENT);
public static final Wool BROWN = new Wool("Brown Wool", WoolColor.Brown, PARENT);
public static final Wool GREEN = new Wool("Green Wool", WoolColor.Green, PARENT);
public static final Wool RED = new Wool("Red Wool", WoolColor.Red, PARENT);
public static final Wool BLACK = new Wool("Black Wool", WoolColor.Black, PARENT);

public static enum WoolColor implements DataSource {
White(0),
Orange(1),
Magenta(2),
LightBlue(3),
Yellow(4),
Lime(5),
Pink(6),
Gray(7),
Silver(8),
Cyan(9),
Purple(10),
Blue(11),
Brown(12),
Green(13),
Red(14),
Black(15);

public static enum Color implements DataSource {
White(0), Orange(1), Magenta(2), LightBlue(3),
Yellow(4), Lime(5), Pink(6), Gray(7), Silver(8),
Cyan(9), Purple(10), Blue(11), Brown(12), Green(13),
Red(14), Black(15);

private final short data;
private Color(int data) {

private WoolColor(int data) {
this.data = (short) data;
}

@Override
public short getData() {
return this.data;
}
}

private final Color color;
private final Wool parent;

private void setDefault() {
this.setHardness(0.8F).setResistance(1.3F);
}

private Wool(String name, Color color, Wool parent) {
private final WoolColor color;

public Wool(String name) {
super(name, 35);
this.setDefault();
this.color = color;
this.parent = parent;
parent.registerSubMaterial(this);
this.register();

this.WHITE = parent.WHITE;
this.ORANGE = parent.ORANGE;
this.MAGENTA = parent.MAGENTA;
this.LIGHTBLUE = parent.LIGHTBLUE;
this.YELLOW = parent.YELLOW;
this.LIME = parent.LIME;
this.PINK = parent.PINK;
this.GRAY = parent.GRAY;
this.SILVER = parent.SILVER;
this.CYAN = parent.CYAN;
this.PURPLE = parent.PURPLE;
this.BLUE = parent.BLUE;
this.BROWN = parent.BROWN;
this.GREEN = parent.GREEN;
this.RED = parent.RED;
this.BLACK = parent.BLACK;
this.color = WoolColor.White;
}

public Wool(String name) {
super(name, 35);
private Wool(String name, WoolColor color, Wool parent) {
super(name, 35, color.getData(), parent);
this.setDefault();
this.color = Color.White;
this.parent = this;
this.register();

this.WHITE = new Wool("White Wool", Color.White, this);
this.ORANGE = new Wool("Orange Wool", Color.Orange, this);
this.MAGENTA = new Wool("Magenta Wool", Color.Magenta, this);
this.LIGHTBLUE = new Wool("Light Blue Wool", Color.LightBlue, this);
this.YELLOW = new Wool("Yellow Wool", Color.Yellow, this);
this.LIME = new Wool("Lime Wool", Color.Lime, this);
this.PINK = new Wool("Pink Wool", Color.Pink, this);
this.GRAY = new Wool("Gray Wool", Color.Gray, this);
this.SILVER = new Wool("Silver Wool", Color.Silver, this);
this.CYAN = new Wool("Cyan Wool", Color.Cyan, this);
this.PURPLE = new Wool("Purple Wool", Color.Purple, this);
this.BLUE = new Wool("Blue Wool", Color.Blue, this);
this.BROWN = new Wool("Brown Wool", Color.Brown, this);
this.GREEN = new Wool("Green Wool", Color.Green, this);
this.RED = new Wool("Red Wool", Color.Red, this);
this.BLACK = new Wool("Black Wool", Color.Black, this);
this.color = color;
}

private void setDefault() {
this.setHardness(0.8F).setResistance(1.3F);
}

@Override
public boolean isMoving() {
return false;
}

public Color getColor() {
public WoolColor getColor() {
return this.color;
}

@Override
public short getData() {
return this.color.getData();
}

@Override
public Wool getParentMaterial() {
return this.parent;
}
}
@@ -27,14 +27,13 @@

import org.spout.api.geo.World;
import org.spout.api.material.BlockMaterial;
import org.spout.api.material.GenericBlockMaterial;
import org.spout.api.material.Material;
import org.spout.api.material.block.BlockFace;
import org.spout.api.math.Vector3;
import org.spout.vanilla.material.item.RedstoneTorch;
import org.spout.vanilla.material.item.RedstoneWire;

public class GenericBlock extends GenericBlockMaterial {
public class GenericBlock extends BlockMaterial {

private static BlockFace indirectSourcesWire[] = {BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH};
private float resistance;
@@ -46,6 +45,11 @@ public GenericBlock(String name, int id) {
dropMaterial = this;
dropCount = 1;
}

public GenericBlock(String name, int id, int data, Material parent) {
super(name, id, data, parent);

}

/**
* Represents power that comes into the block from a redstone wire or a torch that is below the block
@@ -129,4 +133,27 @@ public GenericBlock setDropCount(int count) {

return this;
}

@Override
public boolean isLiquid() {
return false;
}

@Override
public boolean isPlacementObstacle() {
return false;
}

@Override
public boolean hasPhysics() {
return false;
}

@Override
public void onUpdate(World world, int x, int y, int z) {
}

@Override
public void onDestroy(World world, int x, int y, int z) {
}
}
@@ -25,15 +25,24 @@
*/
package org.spout.vanilla.material.generic;

import org.spout.api.material.GenericItemMaterial;
import org.spout.api.entity.Entity;
import org.spout.api.event.player.PlayerInteractEvent.Action;
import org.spout.api.geo.discrete.Point;
import org.spout.api.material.ItemMaterial;
import org.spout.api.material.Material;
import org.spout.api.material.block.BlockFace;

public class GenericItem extends GenericItemMaterial {
public class GenericItem extends ItemMaterial {
private boolean hasNBT = false;

public GenericItem(String name, int id) {
super(name, id);
}

public GenericItem(String name, int id, int data, Material parent) {
super(name, id, data, parent);
}

public boolean getNBTData() {
return this.hasNBT;
}
@@ -42,4 +51,16 @@ public GenericItem setNBTData(boolean has) {
this.hasNBT = has;
return this;
}

@Override
public void onInventoryRender() {
}

@Override
public void onInteract(Entity entity, Point position, Action type, BlockFace clickedFace) {
}

@Override
public void onInteract(Entity entity, Entity other) {
}
}

This file was deleted.

@@ -14,7 +14,7 @@
*
* Vanilla is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR POSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License,
@@ -25,29 +25,18 @@
*/
package org.spout.vanilla.material.item;

import org.spout.vanilla.material.generic.GenericSubItem;
import org.spout.vanilla.material.generic.GenericItem;

public class Coal extends GenericItem {
public static final Coal PARENT = new Coal("Coal");
public final Coal COAL = PARENT;
public final Coal CHARCOAL = new Coal("Charcoal", 1, PARENT);

public class Coal extends GenericSubItem {
public final Coal CHARCOAL;
public final Coal COAL;

private Coal(String name, int data, Coal parent) {
super(name, 263, data, parent);

this.COAL = parent.COAL;
this.CHARCOAL = parent.CHARCOAL;
}

public Coal(String name) {
super(name, 263);

this.COAL = new Coal("Coal", 0, this);
this.CHARCOAL = new Coal("Charcoal", 1, this);
}

@Override
public Coal getParentMaterial() {
return (Coal) super.getParentMaterial();
private Coal(String name, int data, Coal parent) {
super(name, 263, data, parent);
}

}
@@ -28,95 +28,69 @@
import org.spout.api.entity.Entity;
import org.spout.api.inventory.ItemStack;
import org.spout.api.material.DataSource;
import org.spout.api.material.SubMaterial;
import org.spout.vanilla.entity.living.creature.passive.Sheep;
import org.spout.vanilla.entity.living.player.SurvivalPlayer;
import org.spout.vanilla.material.generic.GenericItem;

public class Dye extends GenericItem implements SubMaterial {
public final Dye INK_SAC;
public final Dye ROSE_RED;
public final Dye CACTUS_GREEN;
public final Dye COCOA_BEANS;
public final Dye LAPIS_LAZULI;
public final Dye PURPLE;
public final Dye CYAN;
public final Dye LIGHT_GRAY;
public final Dye GRAY;
public final Dye PINK;
public final Dye LIME;
public final Dye DANDELION_YELLOW;
public final Dye LIGHT_BLUE;
public final Dye MAGENTA;
public final Dye ORANGE;
public final Dye BONE_MEAL;

private final Dye parent;
private final Color color;

public static enum Color implements DataSource {
BLACK(0), RED(1), GREEN(2), BROWN(3), BLUE(4), PURPLE(5), CYAN(6),
LIGHT_GRAY(7), GRAY(8), PINK(9), LIME(10), YELLOW(11), LIGHT_BLUE(12),
MAGENTA(13), ORANGE(14), WHITE(15);

public class Dye extends GenericItem {
public static final Dye PARENT = new Dye("Ink Sac");
public final Dye INK_SAC = new Dye("Ink Sac", DyeColor.BLACK, PARENT);
public final Dye ROSE_RED = new Dye("Rose Red", DyeColor.RED, PARENT);
public final Dye CACTUS_GREEN = new Dye("Cactus Green", DyeColor.GREEN, PARENT);
public final Dye COCOA_BEANS = new Dye("Cocoa Beans", DyeColor.BROWN, PARENT);
public final Dye LAPIS_LAZULI = new Dye("Lapis Lazuli", DyeColor.BLUE, PARENT);
public final Dye PURPLE = new Dye("Purple Dye", DyeColor.PURPLE, PARENT);
public final Dye CYAN = new Dye("Cyan Dye", DyeColor.CYAN, PARENT);
public final Dye LIGHT_GRAY = new Dye("Light Gray Dye", DyeColor.LIGHT_GRAY, PARENT);
public final Dye GRAY = new Dye("Gray Dye", DyeColor.GRAY, PARENT);
public final Dye PINK = new Dye("Pink Dye", DyeColor.PINK, PARENT);
public final Dye LIME = new Dye("Lime Dye", DyeColor.LIME, PARENT);
public final Dye DANDELION_YELLOW = new Dye("Dandelion Yellow", DyeColor.YELLOW, PARENT);
public final Dye LIGHT_BLUE = new Dye("Light Blue Dye", DyeColor.LIGHT_BLUE, PARENT);
public final Dye MAGENTA = new Dye("Magenta Dye", DyeColor.MAGENTA, PARENT);
public final Dye ORANGE = new Dye("Orange Dye", DyeColor.ORANGE, PARENT);
public final Dye BONE_MEAL = new Dye("Bone Meal", DyeColor.WHITE, PARENT);

private final DyeColor color;

public static enum DyeColor implements DataSource {
BLACK(0),
RED(1),
GREEN(2),
BROWN(3),
BLUE(4),
PURPLE(5),
CYAN(6),
LIGHT_GRAY(7),
GRAY(8),
PINK(9),
LIME(10),
YELLOW(11),
LIGHT_BLUE(12),
MAGENTA(13),
ORANGE(14),
WHITE(15);

private final short data;
private Color(int data) {

private DyeColor(int data) {
this.data = (short) data;
}

@Override
public short getData() {
return this.data;
}
}

private Dye(String name, Color color, Dye parent) {
public Dye(String name) {
super(name, 351);
this.parent = parent;
this.color = color;
this.INK_SAC = parent.INK_SAC;
this.ROSE_RED = parent.ROSE_RED;
this.CACTUS_GREEN = parent.CACTUS_GREEN;
this.COCOA_BEANS = parent.COCOA_BEANS;
this.LAPIS_LAZULI = parent.LAPIS_LAZULI;
this.PURPLE = parent.PURPLE;
this.CYAN = parent.CYAN;
this.LIGHT_GRAY = parent.LIGHT_GRAY;
this.GRAY = parent.GRAY;
this.PINK = parent.PINK;
this.LIME = parent.LIME;
this.DANDELION_YELLOW = parent.DANDELION_YELLOW;
this.LIGHT_BLUE = parent.LIGHT_BLUE;
this.MAGENTA = parent.MAGENTA;
this.ORANGE = parent.ORANGE;
this.BONE_MEAL = parent.BONE_MEAL;
this.register();
this.parent.registerSubMaterial(this);
this.color = DyeColor.BLACK;
}

public Dye(String name) {
super(name, 351);
this.parent = this;
this.color = Color.BLACK;

this.register();

this.INK_SAC = new Dye("Ink Sac", Color.BLACK, this);
this.ROSE_RED = new Dye("Rose Red", Color.RED, this);
this.CACTUS_GREEN = new Dye("Cactus Green", Color.GREEN, this);
this.COCOA_BEANS = new Dye("Cocoa Beans", Color.BROWN, this);
this.LAPIS_LAZULI = new Dye("Lapis Lazuli", Color.BLUE, this);
this.PURPLE = new Dye("Purple Dye", Color.PURPLE, this);
this.CYAN = new Dye("Cyan Dye", Color.CYAN, this);
this.LIGHT_GRAY = new Dye("Light Gray Dye", Color.LIGHT_GRAY, this);
this.GRAY = new Dye("Gray Dye", Color.GRAY, this);
this.PINK = new Dye("Pink Dye", Color.PINK, this);
this.LIME = new Dye("Lime Dye", Color.LIME, this);
this.DANDELION_YELLOW = new Dye("Dandelion Yellow", Color.YELLOW, this);
this.LIGHT_BLUE = new Dye("Light Blue Dye", Color.LIGHT_BLUE, this);
this.MAGENTA = new Dye("Magenta Dye", Color.MAGENTA, this);
this.ORANGE = new Dye("Orange Dye", Color.ORANGE, this);
this.BONE_MEAL = new Dye("Bone Meal", Color.WHITE, this);
private Dye(String name, DyeColor color, Dye parent) {
super(name, 351, color.getData(), parent);
this.color = color;
}

@Override
@@ -125,12 +99,12 @@ public void onInteract(Entity entity, Entity other) {
System.out.println("No sheep: " + other.getClass().getName() + " :(");
return;
}

ItemStack holding = entity.getInventory().getCurrentItem();
//get color from holding item
other.setData("SheepColor", 0xF - holding.getData());
System.out.println("Sheep go baaaa!");

if (entity.getController() instanceof SurvivalPlayer) {
if (holding.getAmount() > 1) {
holding.setAmount(holding.getAmount() - 1);
@@ -141,17 +115,12 @@ public void onInteract(Entity entity, Entity other) {
}
}

public Color getColor() {
public DyeColor getColor() {
return this.color;
}

@Override
public short getData() {
return this.color.getData();
}

@Override
public Dye getParentMaterial() {
return this.parent;
}
}
@@ -25,174 +25,61 @@
*/
package org.spout.vanilla.material.item;

import org.spout.api.material.Material;
import org.spout.api.material.SubMaterial;
import org.spout.vanilla.material.generic.GenericItem;

public class Potion extends GenericItem implements SubMaterial {
public final Potion EMPTY;
public final Potion AWKWARD;
public final Potion THICK;
public final Potion MUNDANE;
public final Potion MUNDANE_EXTENDED;
public final Potion REGENERATION;
public final Potion REGENERATION_II;
public final Potion REGENERATION_EXTENDED;
public final Potion SWIFTNESS;
public final Potion SWIFTNESS_II;
public final Potion SWIFTNESS_EXTENDED;
public final Potion FIRE;
public final Potion FIRE_II;
public final Potion FIRE_EXTENDED;
public final Potion FIRE_REVERTED;
public final Potion HEALING;
public final Potion HEALING_II;
public final Potion HEALING_REVERTED;
public final Potion HARMING;
public final Potion HARMING_REVERTED;
public final Potion HARMING_II;
public final Potion STRENGTH;
public final Potion STRENGTH_EXTENDED;
public final Potion SLOWNESS_REVERTED;
public final Potion SLOWNESS_EXTENDED;
public final Potion SPLASH_AWKWARD;
public final Potion SPLASH_REGENERATION;
public final Potion SPLASH_REGENERATION_EXTENDED;
public final Potion SPLASH_REGENERATION_II;
public final Potion SPLASH_SWIFTNESS;
public final Potion SPLASH_SWIFTNESS_EXTENDED;
public final Potion SPLASH_SWIFTNESS_II;
public final Potion SPLASH_FIRE;
public final Potion SPLASH_FIRE_EXTENDED;
public final Potion SPLASH_FIRE_REVERTED;
public final Potion SPLASH_HEALING;
public final Potion SPLASH_HEALING_REVERTED;
public final Potion SPLASH_HEALING_II;
public final Potion SPLASH_STRENGTH;
public final Potion SPLASH_STRENGTH_EXTENDED;
public final Potion SPLASH_SLOWNESS_REVERTED;
public final Potion SPLASH_SLOWNESS_EXTENDED;
public final Potion SPLASH_HARMING;
public final Potion SPLASH_HARMING_REVERTED;
public final Potion SPLASH_HARMING_II;
public class Potion extends GenericItem {
public static final Potion PARENT = new Potion("Empty Potion");
public final Potion EMPTY = PARENT;
public final Potion AWKWARD = new Potion("Awkward Potion", 16, this);
public final Potion SPLASH_AWKWARD = new Potion("Splash Awkward Potion", 16384, this);
public final Potion THICK = new Potion("Thick Potion", 32, this);
public final Potion MUNDANE_EXTENDED = new Potion("Mundane Potion (Extended)", 64, this);
public final Potion MUNDANE = new Potion("Mundane Potion", 8192, this);
public final Potion REGENERATION_EXTENDED = new Potion("Potion of Regeneration (Extended)", 8193, this);
public final Potion SPLASH_REGENERATION_EXTENDED = new Potion("Splash Potion of Regeneration (Extended)", 16449, this);
public final Potion REGENERATION = new Potion("Potion of Regeneration", 8257, this);
public final Potion SPLASH_REGENERATION = new Potion("Splash Potion of Regeneration", 16385, this);
public final Potion REGENERATION_II = new Potion("Potion of Regeneration II", 8225, this);
public final Potion SPLASH_REGENERATION_II = new Potion("Splash Potion of Regeneration II", 16417, this);
public final Potion SWIFTNESS_EXTENDED = new Potion("Potion of Swiftness (Extended)", 8194, this);
public final Potion SPLASH_SWIFTNESS_EXTENDED = new Potion("Splash Potion of Swiftness (Extended)", 16450, this);
public final Potion SWIFTNESS = new Potion("Potion of Swiftness", 8258, this);
public final Potion SPLASH_SWIFTNESS = new Potion("Splash Potion of Swiftness", 16386, this);
public final Potion SWIFTNESS_II = new Potion("Potion of Swiftness II", 8226, this);
public final Potion SPLASH_SWIFTNESS_II = new Potion("Splash Potion of Swiftness II", 16418, this);
public final Potion FIRE_EXTENDED = new Potion("Potion of Fire Resistance (Extended)", 8194, this);
public final Potion SPLASH_FIRE_EXTENDED = new Potion("Splash Potion of Fire Resistance (Extended)", 16415, this);
public final Potion FIRE = new Potion("Potion of Fire Resistance", 8258, this);
public final Potion SPLASH_FIRE = new Potion("Splash Potion of Fire Resistance", 16387, this);
public final Potion FIRE_II = new Potion("Potion of Fire Resistance II", 8226, this);
public final Potion FIRE_REVERTED = new Potion("Potion of Fire Resistance", 8227, this);
public final Potion SPLASH_FIRE_REVERTED = new Potion("Splash Potion of Fire Resistance", 16419, this);
public final Potion HEALING = new Potion("Potion of Healing", 8197, this);
public final Potion SPLASH_HEALING = new Potion("Splash Potion of Healing", 16389, this);
public final Potion HEALING_REVERTED = new Potion("Potion of Healing", 8261, this);
public final Potion SPLASH_HEALING_REVERTED = new Potion("Splash Potion of Healing", 16453, this);
public final Potion HEALING_II = new Potion("Potion of Healing II", 8229, this);
public final Potion SPLASH_HEALING_II = new Potion("Splash Potion of Healing II", 16421, this);
public final Potion STRENGTH = new Potion("Potion of Strength", 8201, this);
public final Potion SPLASH_STRENGTH = new Potion("Splash Potion of Strength", 16393, this);
public final Potion STRENGTH_EXTENDED = new Potion("Potion of Strength (Extended)", 8265, this);
public final Potion SPLASH_STRENGTH_EXTENDED = new Potion("Spash Potion of Strength (Extended)", 16457, this);
public final Potion SLOWNESS_EXTENDED = new Potion("Potion of Slowness (Extended)", 8226, this);
public final Potion SPLASH_SLOWNESS_EXTENDED = new Potion("Splash Potion of Slowness (Extended)", 16458, this);
public final Potion SLOWNESS_REVERTED = new Potion("Potion of Slowness", 8234, this);
public final Potion SPLASH_SLOWNESS_REVERTED = new Potion("Splash Potion of Slowness", 16426, this);
public final Potion HARMING = new Potion("Potion of Harming", 8202, this);
public final Potion SPLASH_HARMING = new Potion("Splash Potion of Harming", 16396, this);
public final Potion HARMING_REVERTED = new Potion("Potion of Harming", 8264, this);
public final Potion SPLASH_HARMING_REVERTED = new Potion("Splash Potion of Harming", 16460, this);
public final Potion HARMING_II = new Potion("Potion of Harming II", 8236, this);
public final Potion SPLASH_HARMING_II = new Potion("Splash Potion of Harming", 16428, this);

private final short data;
private final Potion parent;

private Potion(String name, int data, Potion parent) {
super(name, 373);
this.data = (short) data;
this.parent = parent;
this.register();
parent.registerSubMaterial(this);

this.EMPTY = parent.EMPTY;
this.AWKWARD = parent.AWKWARD;
this.FIRE = parent.FIRE;
this.FIRE_EXTENDED = parent.FIRE_EXTENDED;
this.FIRE_II = parent.FIRE_II;
this.FIRE_REVERTED = parent.FIRE_REVERTED;
this.HEALING = parent.HEALING;
this.HEALING_II = parent.HEALING_II;
this.HEALING_REVERTED = parent.HEALING_REVERTED;
this.MUNDANE = parent.MUNDANE;
this.MUNDANE_EXTENDED = parent.MUNDANE_EXTENDED;
this.REGENERATION = parent.REGENERATION;
this.REGENERATION_EXTENDED = parent.REGENERATION_EXTENDED;
this.REGENERATION_II = parent.REGENERATION_II;
this.SPLASH_AWKWARD = parent.SPLASH_AWKWARD;
this.SPLASH_FIRE = parent.SPLASH_FIRE;
this.SPLASH_FIRE_EXTENDED = parent.SPLASH_FIRE_EXTENDED;
this.SPLASH_FIRE_REVERTED = parent.SPLASH_FIRE_REVERTED;
this.SPLASH_HEALING = parent.SPLASH_HEALING;
this.SPLASH_HEALING_II = parent.SPLASH_HEALING_II;
this.SPLASH_HEALING_REVERTED = parent.SPLASH_HEALING_REVERTED;
this.SPLASH_REGENERATION = parent.SPLASH_REGENERATION;
this.SPLASH_REGENERATION_EXTENDED = parent.SPLASH_REGENERATION_EXTENDED;
this.SPLASH_REGENERATION_II = parent.SPLASH_REGENERATION_II;
this.SPLASH_STRENGTH = parent.SPLASH_STRENGTH;
this.SPLASH_STRENGTH_EXTENDED = parent.SPLASH_STRENGTH_EXTENDED;
this.SPLASH_SWIFTNESS = parent.SPLASH_SWIFTNESS;
this.SPLASH_SWIFTNESS_EXTENDED = parent.SPLASH_SWIFTNESS_EXTENDED;
this.SPLASH_SWIFTNESS_II = parent.SPLASH_SWIFTNESS_II;
this.THICK = parent.THICK;
this.SWIFTNESS = parent.SWIFTNESS;
this.SWIFTNESS_EXTENDED = parent.SWIFTNESS_EXTENDED;
this.SWIFTNESS_II = parent.SWIFTNESS_II;
this.STRENGTH = parent.STRENGTH;
this.STRENGTH_EXTENDED = parent.STRENGTH_EXTENDED;
this.HARMING = parent.HARMING;
this.HARMING_REVERTED = parent.HARMING_REVERTED;
this.HARMING_II = parent.HARMING_II;
this.SPLASH_HARMING = parent.SPLASH_HARMING;
this.SPLASH_HARMING_REVERTED = parent.SPLASH_HARMING_REVERTED;
this.SPLASH_HARMING_II = parent.SPLASH_HARMING_II;
this.SLOWNESS_EXTENDED = parent.SLOWNESS_EXTENDED;
this.SLOWNESS_REVERTED = parent.SLOWNESS_REVERTED;
this.SPLASH_SLOWNESS_EXTENDED = parent.SPLASH_SLOWNESS_EXTENDED;
this.SPLASH_SLOWNESS_REVERTED = parent.SPLASH_SLOWNESS_REVERTED;
}

public Potion(String name) {
super(name, 373);
this.parent = this;
this.data = 0;
this.register();

this.EMPTY = new Potion("Empty Potion", 0, this);
this.AWKWARD = new Potion("Awkward Potion", 16, this);
this.SPLASH_AWKWARD = new Potion("Splash Awkward Potion", 16384, this);
this.THICK = new Potion("Thick Potion", 32, this);
this.MUNDANE_EXTENDED = new Potion("Mundane Potion (Extended)", 64, this);
this.MUNDANE = new Potion("Mundane Potion", 8192, this);
this.REGENERATION_EXTENDED = new Potion("Potion of Regeneration (Extended)", 8193, this);
this.SPLASH_REGENERATION_EXTENDED = new Potion("Splash Potion of Regeneration (Extended)", 16449, this);
this.REGENERATION = new Potion("Potion of Regeneration", 8257, this);
this.SPLASH_REGENERATION = new Potion("Splash Potion of Regeneration", 16385, this);
this.REGENERATION_II = new Potion("Potion of Regeneration II", 8225, this);
this.SPLASH_REGENERATION_II = new Potion("Splash Potion of Regeneration II", 16417, this);
this.SWIFTNESS_EXTENDED = new Potion("Potion of Swiftness (Extended)", 8194, this);
this.SPLASH_SWIFTNESS_EXTENDED = new Potion("Splash Potion of Swiftness (Extended)", 16450, this);
this.SWIFTNESS = new Potion("Potion of Swiftness", 8258, this);
this.SPLASH_SWIFTNESS = new Potion("Splash Potion of Swiftness", 16386, this);
this.SWIFTNESS_II = new Potion("Potion of Swiftness II", 8226, this);
this.SPLASH_SWIFTNESS_II = new Potion("Splash Potion of Swiftness II", 16418, this);
this.FIRE_EXTENDED = new Potion("Potion of Fire Resistance (Extended)", 8194, this);
this.SPLASH_FIRE_EXTENDED = new Potion("Splash Potion of Fire Resistance (Extended)", 16415, this);
this.FIRE = new Potion("Potion of Fire Resistance", 8258, this);
this.SPLASH_FIRE = new Potion("Splash Potion of Fire Resistance", 16387, this);
this.FIRE_II = new Potion("Potion of Fire Resistance II", 8226, this);
this.FIRE_REVERTED = new Potion("Potion of Fire Resistance", 8227, this);
this.SPLASH_FIRE_REVERTED = new Potion("Splash Potion of Fire Resistance", 16419, this);
this.HEALING = new Potion("Potion of Healing", 8197, this);
this.SPLASH_HEALING = new Potion("Splash Potion of Healing", 16389, this);
this.HEALING_REVERTED = new Potion("Potion of Healing", 8261, this);
this.SPLASH_HEALING_REVERTED = new Potion("Splash Potion of Healing", 16453, this);
this.HEALING_II = new Potion("Potion of Healing II", 8229, this);
this.SPLASH_HEALING_II = new Potion("Splash Potion of Healing II", 16421, this);
this.STRENGTH = new Potion("Potion of Strength", 8201, this);
this.SPLASH_STRENGTH = new Potion("Splash Potion of Strength", 16393, this);
this.STRENGTH_EXTENDED = new Potion("Potion of Strength (Extended)", 8265, this);
this.SPLASH_STRENGTH_EXTENDED = new Potion("Spash Potion of Strength (Extended)", 16457, this);
this.SLOWNESS_EXTENDED = new Potion("Potion of Slowness (Extended)", 8226, this);
this.SPLASH_SLOWNESS_EXTENDED = new Potion("Splash Potion of Slowness (Extended)", 16458, this);
this.SLOWNESS_REVERTED = new Potion("Potion of Slowness", 8234, this);
this.SPLASH_SLOWNESS_REVERTED = new Potion("Splash Potion of Slowness", 16426, this);
this.HARMING = new Potion("Potion of Harming", 8202, this);
this.SPLASH_HARMING = new Potion("Splash Potion of Harming", 16396, this);
this.HARMING_REVERTED = new Potion("Potion of Harming", 8264, this);
this.SPLASH_HARMING_REVERTED = new Potion("Splash Potion of Harming", 16460, this);
this.HARMING_II = new Potion("Potion of Harming II", 8236, this);
this.SPLASH_HARMING_II = new Potion("Splash Potion of Harming", 16428, this);
}

@Override
public short getData() {
return this.data;
}

@Override
public Material getParentMaterial() {
return this.parent;
private Potion(String name, int data, Potion parent) {
super(name, 373, data, parent);
}
}
@@ -25,62 +25,12 @@
*/
package org.spout.vanilla.material.item;

import java.lang.reflect.Constructor;

import org.spout.api.entity.Entity;
import org.spout.api.event.player.PlayerInteractEvent.Action;
import org.spout.api.geo.discrete.Point;
import org.spout.api.inventory.ItemStack;
import org.spout.api.material.block.BlockFace;
import org.spout.vanilla.entity.VanillaEntity;
import org.spout.vanilla.entity.living.player.SurvivalPlayer;
import org.spout.vanilla.material.generic.GenericItem;

public class SpawnEgg extends GenericItem {
final Constructor<?> chosen;

public SpawnEgg(String name, int id, int spawnedEntityId) {
this(name, id, org.spout.vanilla.entity.Entity.getByID(spawnedEntityId));
}

public SpawnEgg(String name, int id, org.spout.vanilla.entity.Entity spawnedEntity) {
super(name, id);

if (spawnedEntity == null) {
throw new IllegalArgumentException("Spawned entity can not be null!");
}

Class<? extends VanillaEntity> controller = spawnedEntity.getController();

Constructor<?>[] constructors = controller.getConstructors();
for (Constructor<?> constructor : constructors) {
if (constructor.getParameterTypes().length == 0) {
chosen = constructor;
return;
}
}

chosen = null;
public SpawnEgg(String name) {
super(name, 383);
}

@Override
public void onInteract(Entity entity, Point position, Action type, BlockFace clickedFace) {
if (chosen != null) {
try {
entity.getWorld().createAndSpawnEntity(position, (VanillaEntity) chosen.newInstance(new Object[]{}));
} catch (Exception e) {
// What to do here?
}
}

ItemStack holding = entity.getInventory().getCurrentItem();
if (entity.getController() instanceof SurvivalPlayer) {
if (holding.getAmount() > 1) {
holding.setAmount(holding.getAmount() - 1);
entity.getInventory().setItem(holding, entity.getInventory().getCurrentSlot());
} else if (holding.getAmount() == 1) {
entity.getInventory().setItem(null, entity.getInventory().getCurrentSlot());
}
}
}
}