@@ -107,18 +107,38 @@ public void onTick(float dt) {
getParent().kill();
}

/**
* Gets what material the item is.
*
* @return material of item.
*/
public Material getMaterial() {
return is.getMaterial();
}

/**
* Gets the amount of the material there is in the ItemStack.
*
* @return amount of items
*/
public int getAmount() {
return is.getAmount();
}

/**
* Gets the data of the item
*
* @return item data
*/
public short getData() {
return is.getData();
}

/**
* Gets the roll of the item
*
* @return roll of item.
*/
public int getRoll() {
return roll;
}
@@ -30,6 +30,9 @@
import org.spout.vanilla.controller.VanillaController;
import org.spout.vanilla.controller.action.MovingBlockAction;

/**
* Represents a block that can move, such as sand or gravel.
*/
public class MovingBlock extends VanillaController {
private final BlockMaterial block;

@@ -38,6 +41,11 @@ public MovingBlock(BlockMaterial block) {
registerAction(new MovingBlockAction());
}

/**
* Gets the block that is moving.
*
* @return moving block.
*/
public BlockMaterial getBlock() {
return block;
}
@@ -32,6 +32,9 @@

import org.spout.vanilla.controller.object.Substance;

/**
* Represents a controller that can project through the air.
*/
public class Projectile extends Substance {
private Entity shooter;
private Point start;
@@ -64,6 +67,7 @@ public void onTick(float dt) {

/**
* Sets the controller that shot this projectile
*
* @param entity - the shooter
*/
public void setShooter(Entity entity) {
@@ -72,16 +76,27 @@ public void setShooter(Entity entity) {

/**
* Gets the controller that shot this projectile
*
* @return the shooter controller
*/
public Entity getShooter() {
return shooter;
}

/**
* Gets the velocity of the projectile.
*
* @return velocity of projectile.
*/
public Vector3 getVelocity() {
return velocity;
}

/**
* Sets the velocity of the projectile.
*
* @param velocity
*/
public void setVelocity(Vector3 velocity) {
this.velocity = velocity;
}
@@ -23,7 +23,7 @@
* License and see <http://www.spout.org/SpoutDevLicenseV1.txt> for the full license,
* including the MIT license.
*/
package org.spout.vanilla.controller.object.sky;
package org.spout.vanilla.controller.object;

import org.spout.api.geo.World;

@@ -28,9 +28,10 @@
import org.spout.api.entity.Controller;
import org.spout.api.geo.World;

import org.spout.vanilla.controller.object.Sky;
import org.spout.vanilla.world.Weather;

public class NetherSky extends Controller implements Sky {
public class NetherSky extends VanillaSky {
@Override
public void onAttached() {
}
@@ -33,12 +33,13 @@
import org.spout.api.geo.World;
import org.spout.api.player.Player;

import org.spout.vanilla.controller.object.Sky;
import org.spout.vanilla.event.world.WeatherChangeEvent;
import org.spout.vanilla.protocol.msg.StateChangeMessage;
import org.spout.vanilla.protocol.msg.TimeMessage;
import org.spout.vanilla.world.Weather;

public class NormalSky extends Controller implements Sky {
public class NormalSky extends VanillaSky {
private float time = 0;
private float countdown = 20;
private Weather currentWeather;
@@ -28,9 +28,10 @@
import org.spout.api.entity.Controller;
import org.spout.api.geo.World;

import org.spout.vanilla.controller.object.Sky;
import org.spout.vanilla.world.Weather;

public class TheEndSky extends Controller implements Sky {
public class TheEndSky extends VanillaSky {
@Override
public void onAttached() {
}
@@ -0,0 +1,65 @@
/*
* This file is part of Vanilla (http://www.spout.org/).
*
* Vanilla is licensed under the SpoutDev License Version 1.
*
* Vanilla is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, 180 days after any changes are published, you can use the
* software, incorporating those changes, under the terms of the MIT license,
* as described in the SpoutDev License Version 1.
*
* 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
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License,
* the MIT license and the SpoutDev license version 1 along with this program.
* If not, see <http://www.gnu.org/licenses/> for the GNU Lesser General Public
* License and see <http://www.spout.org/SpoutDevLicenseV1.txt> for the full license,
* including the MIT license.
*/
package org.spout.vanilla.controller.object.sky;

import org.spout.api.entity.Controller;
import org.spout.api.geo.World;
import org.spout.vanilla.controller.object.Sky;
import org.spout.vanilla.world.Weather;

public class VanillaSky extends Controller implements Sky {

@Override
public void onTick(float dt) {
}

@Override
public void onAttached() {
}

@Override
public void setTime(float time) {
}

@Override
public float getTime() {
return -1;
}

@Override
public void setWeather(Weather weather) {
}

@Override
public Weather getWeather() {
return null;
}

@Override
public World getWorld() {
return null;
}
}
@@ -26,6 +26,7 @@
package org.spout.vanilla.event.entity;

import java.util.List;
import java.util.Set;

import org.spout.api.entity.Entity;
import org.spout.api.event.Cancellable;
@@ -36,44 +37,83 @@

public class EntityExplodeEvent extends EntityEvent implements Cancellable {
private static HandlerList handlers = new HandlerList();
private List<Block> blocks;
private Set<Block> blocks;
private Point epicenter;
private float yield;
private boolean incendiary;

public EntityExplodeEvent(Entity e) {
super(e);
// TODO Auto-generated constructor stub
}

public List<Block> getBlocks() {
/**
* Gets a set of blocks that explode during this event.
*
* @return
*/
public Set<Block> getBlocks() {
return blocks;
}

public void setBlocks(List<Block> blocks) {
/**
* Sets which blocks to explode.
*
* @param blocks
*/
public void setBlocks(Set<Block> blocks) {
this.blocks = blocks;
}

/**
* Gets the epicenter of the explosion.
*
* @return epicenter of explosion.
*/
public Point getEpicenter() {
return epicenter;
}

/**
* Sets the epicenter of the explosion.
*
* @param epicenter
*/
public void setEpicenter(Point epicenter) {
this.epicenter = epicenter;
}

/**
* Whether or not the explosion is incendiary.
*
* @return true if incendiary.
*/
public boolean isIncendiary() {
return incendiary;
}

/**
* Sets whether or not the explosion is incendiary.
*
* @param incendiary
*/
public void setIncendiary(boolean incendiary) {
this.incendiary = incendiary;
}

/**
* Gets the yield of the explosion.
*
* @return yield of explosion.
*/
public float getYield() {
return yield;
}

/**
* Sets the yield of the explosion.
*
* @param yield
*/
public void setYield(float yield) {
this.yield = yield;
}
@@ -85,6 +85,9 @@ public static HandlerList getHandlerList() {
return handlers;
}

/**
* Represents a target reason for an EntityTargetEvent.
*/
public enum TargetReason {
TARGET_DIED(false),
CLOSEST_PLAYER(true),
@@ -95,12 +98,18 @@ public enum TargetReason {
RANDOM_TARGET(true),
CUSTOM_TARGET(true),
CUSTOM_UNTARGET(false);

private boolean target;

private TargetReason(boolean target) {
this.target = target;
}

/**
* Whether or not it is target
*
* @return true if target
*/
public boolean isTarget() {
return target;
}
@@ -29,7 +29,7 @@
import org.spout.api.event.HandlerList;
import org.spout.api.event.world.WorldEvent;

import org.spout.vanilla.controller.object.sky.Sky;
import org.spout.vanilla.controller.object.Sky;
import org.spout.vanilla.world.Weather;

public class WeatherChangeEvent extends WorldEvent implements Cancellable {
@@ -29,6 +29,9 @@
import org.spout.vanilla.material.MovingBlock;
import org.spout.vanilla.material.generic.GenericBlock;

import java.util.HashMap;
import java.util.Map;

public class Wool extends GenericBlock implements MovingBlock {
public static final Wool WHITE = register(new Wool("White Wool"));
public static final Wool ORANGE = register(new Wool("Orange Wool", WoolColor.Orange, WHITE));
@@ -66,6 +69,7 @@ public static enum WoolColor implements DataSource {
Black(15);

private final short data;
private static final Map<Short, WoolColor> ids = new HashMap<Short, WoolColor>();

private WoolColor(int data) {
this.data = (short) data;
@@ -75,6 +79,16 @@ private WoolColor(int data) {
public short getData() {
return this.data;
}

public static WoolColor getById(short id) {
return ids.get(id);
}

static {
for (WoolColor color : WoolColor.values()) {
ids.put(color.getData(), color);
}
}
}

private final WoolColor color;
@@ -42,7 +42,7 @@ public List<Parameter<?>> getSpawnParameters(Controller controller) {
Sheep sheep = (Sheep) controller;
byte data = 0;
data |= (sheep.isSheared() ? 1 : 0) << 4;
data |= sheep.getColor() & 0x0F;
data |= sheep.getColor().getData() & 0x0F;
parameters.add(new Parameter<Byte>(Parameter.TYPE_BYTE, 16, data));
}

@@ -53,10 +53,10 @@ public void handle(Session session, Player player, EntityActionMessage message)
case EntityActionMessage.ACTION_LEAVE_BED:
break;
case EntityActionMessage.ACTION_START_SPRINTING:
ve.setRunning(true);
ve.setSprinting(true);
break;
case EntityActionMessage.ACTION_STOP_SPRINTING:
ve.setRunning(false);
ve.setSprinting(false);
break;
default:
break;