2010-10-25 06:42:56 +00:00
|
|
|
// $Id$
|
|
|
|
/*
|
|
|
|
* WorldEdit
|
|
|
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.sk89q.worldedit.blocks;
|
|
|
|
|
2012-01-17 02:46:33 +00:00
|
|
|
import gnu.trove.map.TIntIntMap;
|
|
|
|
import gnu.trove.map.hash.TIntIntHashMap;
|
2011-11-27 23:29:51 +00:00
|
|
|
|
2010-10-25 06:42:56 +00:00
|
|
|
/**
|
|
|
|
* Represents an item.
|
2011-09-24 19:32:03 +00:00
|
|
|
*
|
2010-10-25 06:42:56 +00:00
|
|
|
* @author sk89q
|
|
|
|
*/
|
|
|
|
public class BaseItem {
|
|
|
|
/**
|
|
|
|
* Item ID.
|
|
|
|
*/
|
2011-01-18 04:30:54 +00:00
|
|
|
private int id;
|
2010-10-25 06:42:56 +00:00
|
|
|
/**
|
|
|
|
* Item damage.
|
|
|
|
*/
|
|
|
|
private short damage;
|
|
|
|
|
2012-01-17 02:46:33 +00:00
|
|
|
private TIntIntMap enchantments = new TIntIntHashMap();
|
2011-11-27 23:29:51 +00:00
|
|
|
|
2010-10-25 06:42:56 +00:00
|
|
|
/**
|
|
|
|
* Construct the object.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
*/
|
2011-01-18 04:30:54 +00:00
|
|
|
public BaseItem(int id) {
|
2010-10-25 06:42:56 +00:00
|
|
|
this.id = id;
|
|
|
|
this.damage = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct the object.
|
|
|
|
*
|
|
|
|
* @param id
|
2011-09-24 19:32:03 +00:00
|
|
|
* @param damage
|
2010-10-25 06:42:56 +00:00
|
|
|
*/
|
2011-01-18 04:30:54 +00:00
|
|
|
public BaseItem(int id, short damage) {
|
2010-10-25 06:42:56 +00:00
|
|
|
this.id = id;
|
|
|
|
this.damage = damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the id
|
|
|
|
*/
|
2011-01-18 04:30:54 +00:00
|
|
|
public int getType() {
|
2010-10-25 06:42:56 +00:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param id the id to set
|
|
|
|
*/
|
2011-01-18 04:30:54 +00:00
|
|
|
public void setType(int id) {
|
2010-10-25 06:42:56 +00:00
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the damage
|
|
|
|
*/
|
|
|
|
public short getDamage() {
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param damage the damage to set
|
|
|
|
*/
|
|
|
|
public void setDamage(short damage) {
|
|
|
|
this.damage = damage;
|
|
|
|
}
|
2011-11-27 23:29:51 +00:00
|
|
|
|
2012-01-17 02:46:33 +00:00
|
|
|
public TIntIntMap getEnchantments() {
|
2011-11-27 23:29:51 +00:00
|
|
|
return enchantments;
|
|
|
|
}
|
2010-10-25 06:42:56 +00:00
|
|
|
}
|