mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
- Added interface to game, client and server - Added transformations - Made ingredient conditions more practical to use, no longer requires imports - Started implementation of event handling - Moved commands and logic to the common API code - Added common interface to MineTweaker recipes - Added string methods - Moved the logger from static value to static getter - Fixed crashes on dedicated servers - Fixed bracket resolution for <id:meta> values in 1.6.4 - Fixed scripts not being sent to multiplayer clients in 1.6.4
84 lines
1.7 KiB
Java
84 lines
1.7 KiB
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package minetweaker.api.item;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
*
|
|
* @author Stan
|
|
*/
|
|
public class IngredientStack implements IIngredient {
|
|
private final IIngredient ingredient;
|
|
private final int amount;
|
|
|
|
public IngredientStack(IIngredient ingredient, int amount) {
|
|
this.ingredient = ingredient;
|
|
this.amount = amount;
|
|
}
|
|
|
|
@Override
|
|
public String getMark() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public int getAmount() {
|
|
return amount;
|
|
}
|
|
|
|
@Override
|
|
public List<IItemStack> getItems() {
|
|
return ingredient.getItems();
|
|
}
|
|
|
|
@Override
|
|
public IIngredient amount(int amount) {
|
|
return new IngredientStack(ingredient, amount);
|
|
}
|
|
|
|
@Override
|
|
public IIngredient transform(IItemTransformer transformer) {
|
|
return new IngredientStack(ingredient.transform(transformer), amount);
|
|
}
|
|
|
|
@Override
|
|
public IIngredient only(IItemCondition condition) {
|
|
return new IngredientStack(ingredient.only(condition), amount);
|
|
}
|
|
|
|
@Override
|
|
public IIngredient marked(String mark) {
|
|
return new IngredientStack(ingredient.marked(mark), amount);
|
|
}
|
|
|
|
@Override
|
|
public boolean matches(IItemStack item) {
|
|
return item.getAmount() == amount && ingredient.matches(item);
|
|
}
|
|
|
|
@Override
|
|
public boolean contains(IIngredient ingredient) {
|
|
return this.ingredient.contains(ingredient);
|
|
}
|
|
|
|
@Override
|
|
public IItemStack applyTransform(IItemStack item) {
|
|
return ingredient.applyTransform(item);
|
|
}
|
|
|
|
@Override
|
|
public Object getInternal() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public boolean hasTransformers() {
|
|
return ingredient.hasTransformers();
|
|
}
|
|
}
|