This commit is contained in:
Vincent Lee committed 2019-12-23 15:52:19 -06:00
1 parent 144cd96add
commit c0e9e8f105
2 files changed
+9 -6

No files matched your search

@@ -13,11 +13,12 @@ package vazkii.botania.api.corporea;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import java.util.function.Function;
import java.util.regex.Pattern;
/**
* An interface for a Corporea Request matcher. Accepts an ItemStack and returns whether it fulfills the request.
* Needs to be registered over in {@link vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer.corporeaMatchers}.
* Needs to be registered over in {@link vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer#addCorporeaRequestMatcher}.
*/
public final class CorporeaRequestDefaultMatchers {
@@ -78,12 +79,12 @@ public final class CorporeaRequestDefaultMatchers {
tag.putBoolean(TAG_REQUEST_CONTAINS, contains);
}
public boolean equalOrContain(String str) {
private boolean equalOrContain(String str) {
return contains ? str.contains(expression) : str.equals(expression);
}
// Copy from StringUtils
public static String stripControlCodes(String str) {
private static String stripControlCodes(String str) {
return patternControlCode.matcher(str).replaceAll("");
}
}
@@ -13,9 +13,11 @@ package vazkii.botania.api.corporea;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import java.util.function.Function;
/**
* An interface for a Corporea Request matcher. Accepts an ItemStack and returns whether it fulfills the request.
* Needs to be registered over in {@link vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer.corporeaMatchers}.
* Needs to be registered over in {@link vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer#addCorporeaRequestMatcher}.
* Needs one additional (static) method for deserialization, which can't really go here because Java doesn't like static abstract's.
*/
public interface ICorporeaRequestMatcher {
@@ -23,10 +25,10 @@ public interface ICorporeaRequestMatcher {
/**
* Returns whether the given stack matches the request's criteria.
*/
public boolean isStackValid(ItemStack stack);
boolean isStackValid(ItemStack stack);
/**
* Serialize to NBT data, for the Corporea Retainer's benefit.
*/
public void writeToNBT(CompoundNBT tag);
void writeToNBT(CompoundNBT tag);
}