Package net.tnemc.item.component.impl
Class FoodComponent<I extends AbstractItemStack<T>,T>
java.lang.Object
net.tnemc.item.component.impl.FoodComponent<I,T>
- All Implemented Interfaces:
SerialComponent<I,
,T> ItemApplicator<I,
,T> ItemCheck<T>
,Identifiable
,ItemSerializer<I,
T>
- Direct Known Subclasses:
BukkitFoodComponent
,PaperOldFoodComponent
public abstract class FoodComponent<I extends AbstractItemStack<T>,T>
extends Object
implements SerialComponent<I,T>
FoodComponent - The food stats for this consumable item. Has no effect unless the item can be
consumed (i.e. the item has the consumable component).
- Since:
- 0.0.1.0
- Author:
- creatorfromhell
-
Constructor Summary
ConstructorsConstructorDescriptionFoodComponent
(boolean canAlwaysEat) FoodComponent
(boolean canAlwaysEat, float saturation) FoodComponent
(boolean canAlwaysEat, float saturation, int nutrition) -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
canAlwaysEat
(boolean canAlwaysEat) int
void
nutrition
(int nutrition) void
readJSON
(JSONHelper json, ItemPlatform<I, T, ?> platform) Reads JSON data and converts it back to aSerialComponent
object.float
void
saturation
(float saturation) boolean
similar
(SerialComponent<?, ?> component) Used to determine if some data is equal to this data.org.json.simple.JSONObject
toJSON()
Converts theSerialComponent
to a JSON object.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.tnemc.item.platform.applier.ItemApplicator
apply, enabled
Methods inherited from interface net.tnemc.item.platform.serialize.ItemSerializer
enabled, serialize
Methods inherited from interface net.tnemc.item.component.SerialComponent
applies, appliesTo, check
-
Constructor Details
-
FoodComponent
public FoodComponent() -
FoodComponent
-
FoodComponent
-
FoodComponent
-
-
Method Details
-
identifier
- Specified by:
identifier
in interfaceIdentifiable
- Returns:
- the type of component this is.
- Since:
- 0.2.0.0
-
toJSON
Converts theSerialComponent
to a JSON object.- Specified by:
toJSON
in interfaceSerialComponent<I extends AbstractItemStack<T>,
T> - Returns:
- The JSONObject representing this
SerialComponent
. - Since:
- 0.2.0.0
-
readJSON
Reads JSON data and converts it back to aSerialComponent
object.- Specified by:
readJSON
in interfaceSerialComponent<I extends AbstractItemStack<T>,
T> - Parameters:
json
- The JSONHelper instance of the json data.platform
- Theplatform
instance.- Since:
- 0.2.0.0
-
similar
Used to determine if some data is equal to this data. This means that it has to be an exact copy of this data. For instance, book copies will return false when compared to the original.- Specified by:
similar
in interfaceSerialComponent<I extends AbstractItemStack<T>,
T> - Parameters:
component
- The component to compare.- Returns:
- True if similar, otherwise false.
- Since:
- 0.2.0.0
-
canAlwaysEat
-
canAlwaysEat
-
saturation
-
saturation
-
nutrition
-
nutrition
-