mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 11:29:23 +00:00
Add MultiFenceRecipe Jei Registry Plugin
This commit is contained in:
1 parent
7964e56c77
commit
8ba9d8609b
9 files changed
+463
-2
No files matched your search
@@ -14,13 +14,16 @@ import forestry.core.utils.Translator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WoodManager {
|
||||
public static Map<IPlankType, ItemStack> PLANKS;
|
||||
public static String getDisplayName(IWoodTyped wood, IWoodType woodType) {
|
||||
WoodBlockKind blockKind = wood.getBlockKind();
|
||||
|
||||
@@ -134,6 +137,22 @@ public class WoodManager {
|
||||
Collections.addAll(list, PlankType.VanillaPlanks.values());
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Map<IPlankType, ItemStack> getAllPlankStacks(){
|
||||
if(PLANKS == null){
|
||||
PLANKS = new HashMap<>();
|
||||
for(IPlankType type : getAllPlankTypes()){
|
||||
PLANKS.put(type, type.getStack(false));
|
||||
}
|
||||
}
|
||||
return PLANKS;
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getAllPlankStacks(IPlankType type){
|
||||
Map<IPlankType, ItemStack> planks = new HashMap<>(getAllPlankStacks());
|
||||
planks.remove(type);
|
||||
return planks.values();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IPlankType getPlankType(ItemStack itemStack) {
|
||||
|
||||
@@ -71,6 +71,11 @@ public class FenceType {
|
||||
public boolean isPlain() {
|
||||
return this.size == 0 && !this.embossed && !this.solid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return size + (embossed ? ":embossed" : "") + (solid ? ":solid" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
|
||||
@@ -28,6 +28,10 @@ public class MultiFenceRecipePattern{
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
public int getTypeCount() {
|
||||
return typeCount;
|
||||
}
|
||||
|
||||
@@ -310,6 +310,8 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(AlleleManager.alleleRegistry.getFruitFamily("forestry.pomes"));
|
||||
species.addFruitFamily(AlleleManager.alleleRegistry.getFruitFamily("forestry.prunes"));
|
||||
species.addFruitFamily(ETFruitFamily.Citrus);
|
||||
species.setTemperature(EnumTemperature.NORMAL);
|
||||
species.setRarity(0.0015F);
|
||||
}
|
||||
},
|
||||
SourCherry("prunus", "cerasus", EnumLeafType.DECIDUOUS, new Color(0x6D8F1E), new Color(0xF7EBF6), EnumSaplingType.Fruit, EnumETLog.Cherry, new Color(0x716850)) {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package binnie.extratrees.integration.jei;
|
||||
|
||||
import binnie.core.integration.jei.Drawables;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import binnie.extratrees.block.decor.FenceDescription;
|
||||
import binnie.extratrees.block.decor.FenceType;
|
||||
import binnie.extratrees.integration.jei.brewery.BreweryRecipeCategory;
|
||||
import binnie.extratrees.integration.jei.brewery.BreweryRecipeMaker;
|
||||
import binnie.extratrees.integration.jei.distillery.brewery.DistilleryRecipeCategory;
|
||||
@@ -9,6 +13,7 @@ import binnie.extratrees.integration.jei.fruitpress.FruitPressRecipeCategory;
|
||||
import binnie.extratrees.integration.jei.fruitpress.FruitPressRecipeMaker;
|
||||
import binnie.extratrees.integration.jei.lumbermill.LumbermillRecipeCategory;
|
||||
import binnie.extratrees.integration.jei.lumbermill.LumbermillRecipeMaker;
|
||||
import binnie.extratrees.integration.jei.multifence.MultiFenceRecipeRegistryPlugin;
|
||||
import binnie.extratrees.machines.ExtraTreeMachine;
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
@@ -16,6 +21,8 @@ import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@JEIPlugin
|
||||
public class ExtraTreesJeiPlugin extends BlankModPlugin {
|
||||
@@ -25,7 +32,14 @@ public class ExtraTreesJeiPlugin extends BlankModPlugin {
|
||||
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
|
||||
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ExtraTrees.blocks().blockMultiFence), (ItemStack itemStack)->{
|
||||
FenceDescription desc = WoodManager.getFenceDescription(itemStack);
|
||||
if(desc != null){
|
||||
FenceType type = WoodManager.getFenceType(itemStack);
|
||||
return type + ":" + desc.getPlankType().getName().toLowerCase() + ":" + desc.getSecondaryPlankType().getName().toLowerCase();
|
||||
}
|
||||
return Integer.toString(itemStack.getItemDamage());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,5 +64,7 @@ public class ExtraTreesJeiPlugin extends BlankModPlugin {
|
||||
registry.addRecipes(FruitPressRecipeMaker.create(), RecipeUids.FRUIT_PRESS);
|
||||
registry.addRecipes(BreweryRecipeMaker.create(), RecipeUids.BREWING);
|
||||
registry.addRecipes(DistilleryRecipeMaker.create(), RecipeUids.DISTILLING);
|
||||
|
||||
registry.addRecipeRegistryPlugin(new MultiFenceRecipeRegistryPlugin());
|
||||
}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package binnie.extratrees.integration.jei.multifence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import binnie.extratrees.block.decor.FenceDescription;
|
||||
import binnie.extratrees.block.decor.FenceType;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MultiFenceRecipeEmbeddedWrapper extends BlankRecipeWrapper implements IShapedCraftingRecipeWrapper {
|
||||
|
||||
private FenceType fenceType;
|
||||
@Nullable
|
||||
private IPlankType plankType;
|
||||
@Nullable
|
||||
private IPlankType plankTypeSecondary;
|
||||
|
||||
public MultiFenceRecipeEmbeddedWrapper(FenceType fenceType) {
|
||||
this.fenceType = fenceType;
|
||||
}
|
||||
|
||||
public MultiFenceRecipeEmbeddedWrapper(IPlankType plankType, FenceType fenceType) {
|
||||
this.plankType = plankType;
|
||||
this.fenceType = fenceType;
|
||||
}
|
||||
|
||||
public MultiFenceRecipeEmbeddedWrapper(FenceDescription fenceDesc) {
|
||||
this.plankType = fenceDesc.getPlankType();
|
||||
this.plankTypeSecondary = fenceDesc.getSecondaryPlankType();
|
||||
this.fenceType = fenceDesc.getFenceType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
List<ItemStack> fences = new ArrayList<>();
|
||||
List<ItemStack> planks = new ArrayList<>();
|
||||
List<ItemStack> outputFences = new ArrayList<>();
|
||||
if(plankType != null){
|
||||
if(plankTypeSecondary == null){
|
||||
for(Entry<IPlankType, ItemStack> secondary : WoodManager.getAllPlankStacks().entrySet()){
|
||||
IPlankType plankTypeSecondary = secondary.getKey();
|
||||
if(plankType != plankTypeSecondary){
|
||||
planks.add(plankType.getStack(false));
|
||||
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, false), 1));
|
||||
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, true), 2));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
planks.add(plankType.getStack(false));
|
||||
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, false), 1));
|
||||
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, true), 2));
|
||||
}
|
||||
}else{
|
||||
for(IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()){
|
||||
for(IPlankType plankType : WoodManager.getAllPlankTypes()){
|
||||
if(plankType != plankTypeSecondary){
|
||||
planks.add(plankType.getStack(false));
|
||||
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, false), 1));
|
||||
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, true), 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<List<ItemStack>> itemInputs = new ArrayList<>();
|
||||
itemInputs.add(fences);
|
||||
itemInputs.add(planks);
|
||||
itemInputs.add(fences);
|
||||
List<List<ItemStack>> itemOutputs = new ArrayList<>();
|
||||
itemOutputs.add(outputFences);
|
||||
ingredients.setOutputLists(ItemStack.class, itemOutputs);
|
||||
ingredients.setInputLists(ItemStack.class, itemInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package binnie.extratrees.integration.jei.multifence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import binnie.extratrees.block.decor.FenceDescription;
|
||||
import binnie.extratrees.block.decor.FenceType;
|
||||
import binnie.extratrees.block.decor.MultiFenceRecipePattern;
|
||||
import mezz.jei.api.recipe.IFocus;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeRegistryPlugin;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IFocus.Mode;
|
||||
import mezz.jei.gui.Focus;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MultiFenceRecipeRegistryPlugin implements IRecipeRegistryPlugin {
|
||||
|
||||
public List<IRecipeWrapper> recipes = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public <V> List<String> getRecipeCategoryUids(IFocus<V> focus) {
|
||||
focus = Focus.check(focus);
|
||||
V ingredient = focus.getValue();
|
||||
|
||||
if(!(ingredient instanceof ItemStack)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ItemStack itemStack = (ItemStack) ingredient;
|
||||
FenceDescription desc;
|
||||
switch (focus.getMode()) {
|
||||
case INPUT:
|
||||
desc = WoodManager.getFenceDescription(itemStack);
|
||||
IPlankType plankType = WoodManager.getPlankType(itemStack);
|
||||
if(plankType != null || desc != null && (!desc.getFenceType().embossed || !desc.getFenceType().embossed)){
|
||||
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
case OUTPUT:
|
||||
desc = WoodManager.getFenceDescription(itemStack);
|
||||
if(desc != null){
|
||||
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
default:
|
||||
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IRecipeWrapper, V> List<T> getRecipeWrappers(IRecipeCategory<T> recipeCategory, IFocus<V> focus) {
|
||||
focus = Focus.check(focus);
|
||||
V ingredient = focus.getValue();
|
||||
if(!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING) || !(ingredient instanceof ItemStack)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return (List<T>) getRecipes((IFocus<ItemStack>) focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IRecipeWrapper> List<T> getRecipeWrappers(IRecipeCategory<T> recipeCategory) {
|
||||
if(!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if(recipes.isEmpty()){
|
||||
for(MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES){
|
||||
recipes.add(new MultiFenceRecipeSizeWrapper(pattern));
|
||||
}
|
||||
for(FenceType fenceType : FenceType.VALUES){
|
||||
recipes.add(new MultiFenceRecipeEmbeddedWrapper(fenceType));
|
||||
recipes.add(new MultiFenceRecipeSolidWrapper(fenceType));
|
||||
}
|
||||
}
|
||||
return (List<T>) recipes;
|
||||
}
|
||||
|
||||
private List<IRecipeWrapper> getRecipes(IFocus<ItemStack> focus){
|
||||
ItemStack ingredient = focus.getValue();
|
||||
List<IRecipeWrapper> recipes = new ArrayList<>();
|
||||
if(focus.getMode() == Mode.INPUT){
|
||||
IPlankType plankType = WoodManager.getPlankType(ingredient);
|
||||
if(plankType != null){
|
||||
for(MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES){
|
||||
recipes.add(new MultiFenceRecipeSizeWrapper(pattern, plankType));
|
||||
}
|
||||
for(int size = 0;size < 3;size++){
|
||||
for (final boolean solid : new boolean[]{false, true}) {
|
||||
recipes.add(new MultiFenceRecipeEmbeddedWrapper(plankType, new FenceType(size, solid, false)));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
FenceDescription desc = WoodManager.getFenceDescription(ingredient);
|
||||
if(desc != null){
|
||||
if(!desc.getFenceType().embossed){
|
||||
recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
|
||||
}
|
||||
if(!desc.getFenceType().solid){
|
||||
recipes.add(new MultiFenceRecipeSolidWrapper(desc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
FenceDescription desc = WoodManager.getFenceDescription(ingredient);
|
||||
if(desc != null){
|
||||
int size = desc.getFenceType().size;
|
||||
recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2], desc.getPlankType(), desc.getSecondaryPlankType()));
|
||||
recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2 + 1], desc.getPlankType(), desc.getSecondaryPlankType()));
|
||||
if(desc.getFenceType().embossed){
|
||||
recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
|
||||
}
|
||||
if(desc.getFenceType().solid){
|
||||
recipes.add(new MultiFenceRecipeSolidWrapper(desc));
|
||||
}
|
||||
}
|
||||
}
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package binnie.extratrees.integration.jei.multifence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import binnie.extratrees.block.decor.MultiFenceRecipePattern;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class MultiFenceRecipeSizeWrapper extends BlankRecipeWrapper {
|
||||
|
||||
@Nullable
|
||||
private IPlankType plankType;
|
||||
@Nullable
|
||||
private IPlankType plankTypeSecond;
|
||||
private MultiFenceRecipePattern pattern;
|
||||
private String[] recipePattern;
|
||||
|
||||
|
||||
public MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern pattern) {
|
||||
this(pattern, null, null);
|
||||
}
|
||||
|
||||
public MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern pattern, @Nullable IPlankType plankType) {
|
||||
this(pattern, plankType, null);
|
||||
}
|
||||
|
||||
public MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern pattern, @Nullable IPlankType plankType, @Nullable IPlankType plankTypeSecond) {
|
||||
this.pattern = pattern;
|
||||
String recipePattern = pattern.getPattern();
|
||||
this.recipePattern = new String[3];
|
||||
this.recipePattern[0] = recipePattern.substring(0, 3);
|
||||
this.recipePattern[1] = recipePattern.substring(3, 6);
|
||||
this.recipePattern[2] = recipePattern.substring(6);
|
||||
this.plankType = plankType;
|
||||
this.plankTypeSecond = plankTypeSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
int typeCount = pattern.getTypeCount();
|
||||
List<List<ItemStack>> types = NonNullList.create();
|
||||
if(this.plankType != null){
|
||||
types.add(Collections.singletonList(plankType.getStack(false)));
|
||||
}else{
|
||||
List<ItemStack> planks = new ArrayList<>(WoodManager.getAllPlankStacks().values());
|
||||
Collections.shuffle(planks);
|
||||
types.add(planks);
|
||||
}
|
||||
if(typeCount > 1){
|
||||
if(plankTypeSecond != null){
|
||||
types.add(Collections.singletonList(plankTypeSecond.getStack(false)));
|
||||
}else{
|
||||
List<ItemStack> planks;
|
||||
if(plankType != null){
|
||||
planks = new ArrayList<>(WoodManager.getAllPlankStacks(plankType));
|
||||
}else{
|
||||
planks = new ArrayList<>(WoodManager.getAllPlankStacks().values());
|
||||
}
|
||||
Collections.shuffle(planks);
|
||||
types.add(planks);
|
||||
}
|
||||
}else{
|
||||
types.add(types.get(0));
|
||||
}
|
||||
List<List<ItemStack>> itemInputs = NonNullList.withSize(9, NonNullList.create());
|
||||
for(int p = 0;p < 3;p++){
|
||||
String recipePattern = this.recipePattern[p];
|
||||
for(int index = 0;index < 3;index++){
|
||||
char c = recipePattern.charAt(index);
|
||||
if(c == '0'){
|
||||
itemInputs.set(p * 3 + index, types.get(0));
|
||||
}else if(c == '1'){
|
||||
itemInputs.set(p * 3 + index, types.get(1));
|
||||
}else{
|
||||
itemInputs.set(p * 3 + index, NonNullList.withSize(1, ItemStack.EMPTY));
|
||||
}
|
||||
}
|
||||
}
|
||||
List<List<ItemStack>> itemOutputs = new ArrayList<>();
|
||||
int size = typeCount > 1 || plankType == null ? types.get(1).size() : 1;
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
itemOutputs.add(outputs);
|
||||
for(int i = 0;i < size;i++){
|
||||
ItemStack item = types.get(0).get(i);
|
||||
ItemStack itemSecond = types.get(1).get(i);
|
||||
IPlankType plankType = this.plankType;
|
||||
if(plankType == null){
|
||||
plankType = WoodManager.getPlankType(item);
|
||||
}
|
||||
IPlankType plankTypeSecond = this.plankTypeSecond;
|
||||
if(plankTypeSecond == null){
|
||||
plankTypeSecond = WoodManager.getPlankType(itemSecond);
|
||||
}
|
||||
outputs.add(pattern.createFence(plankType, plankTypeSecond));
|
||||
}
|
||||
ingredients.setOutputLists(ItemStack.class, itemOutputs);
|
||||
ingredients.setInputLists(ItemStack.class, itemInputs);
|
||||
}
|
||||
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package binnie.extratrees.integration.jei.multifence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import binnie.extratrees.block.decor.FenceDescription;
|
||||
import binnie.extratrees.block.decor.FenceType;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MultiFenceRecipeSolidWrapper extends BlankRecipeWrapper implements IShapedCraftingRecipeWrapper {
|
||||
|
||||
private FenceType fenceType;
|
||||
@Nullable
|
||||
private IPlankType plankType;
|
||||
@Nullable
|
||||
private IPlankType plankTypeSecondary;
|
||||
|
||||
public MultiFenceRecipeSolidWrapper(FenceType fenceType) {
|
||||
this.fenceType = fenceType;
|
||||
this.plankType = null;
|
||||
this.plankTypeSecondary = null;
|
||||
}
|
||||
|
||||
public MultiFenceRecipeSolidWrapper(FenceDescription fenceDesc) {
|
||||
this.fenceType = fenceDesc.getFenceType();
|
||||
this.plankType = fenceDesc.getPlankType();
|
||||
this.plankTypeSecondary = fenceDesc.getSecondaryPlankType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
List<ItemStack> fences = new ArrayList<>();
|
||||
List<ItemStack> outputFences = new ArrayList<>();
|
||||
if(plankType != null){
|
||||
if(plankTypeSecondary == null){
|
||||
for(IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()){
|
||||
if(plankType != plankTypeSecondary){
|
||||
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1));
|
||||
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1));
|
||||
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2));
|
||||
}
|
||||
}else{
|
||||
for(IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()){
|
||||
for(IPlankType plankType : WoodManager.getAllPlankTypes()){
|
||||
if(plankType != plankTypeSecondary){;
|
||||
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1));
|
||||
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<List<ItemStack>> itemInputs = new ArrayList<>();
|
||||
itemInputs.add(fences);
|
||||
itemInputs.add(fences);
|
||||
itemInputs.add(fences);
|
||||
List<List<ItemStack>> itemOutputs = new ArrayList<>();
|
||||
itemOutputs.add(outputFences);
|
||||
ingredients.setOutputLists(ItemStack.class, itemOutputs);
|
||||
ingredients.setInputLists(ItemStack.class, itemInputs);
|
||||
/*List<ItemStack> fences = Collections.singletonList(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1));
|
||||
List<ItemStack> outputFences = Collections.singletonList(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2));
|
||||
List<List<ItemStack>> itemInputs = new ArrayList<>();
|
||||
itemInputs.add(fences);
|
||||
itemInputs.add(fences);
|
||||
itemInputs.add(fences);
|
||||
List<List<ItemStack>> itemOutputs = new ArrayList<>();
|
||||
itemOutputs.add(outputFences);
|
||||
ingredients.setOutputLists(ItemStack.class, itemOutputs);
|
||||
ingredients.setInputLists(ItemStack.class, itemInputs);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user