Add a wrapper around Ingredient to allow for stack sizes
This commit is contained in:
parent
1dad4697ba
commit
d45284de2c
2 changed files with 8 additions and 9 deletions
|
@ -34,6 +34,7 @@ import reborncore.api.tile.ItemHandlerProvider;
|
||||||
import reborncore.client.containerBuilder.IContainerProvider;
|
import reborncore.client.containerBuilder.IContainerProvider;
|
||||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||||
|
import reborncore.common.crafting.RebornIngredient;
|
||||||
import reborncore.common.crafting.Recipe;
|
import reborncore.common.crafting.Recipe;
|
||||||
import reborncore.common.recipes.RecipeTranslator;
|
import reborncore.common.recipes.RecipeTranslator;
|
||||||
import reborncore.common.registration.RebornRegister;
|
import reborncore.common.registration.RebornRegister;
|
||||||
|
@ -121,7 +122,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
||||||
if (recipeType == null) {
|
if (recipeType == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Ingredient ingredient : recipeType.getIngredients()) {
|
for (RebornIngredient ingredient : recipeType.getRebornIngredients()) {
|
||||||
boolean hasItem = false;
|
boolean hasItem = false;
|
||||||
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||||
if (ingredient.test(inventory.getStackInSlot(inputslot))) {
|
if (ingredient.test(inventory.getStackInSlot(inputslot))) {
|
||||||
|
@ -195,12 +196,10 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
||||||
hasAllRecipes = false;
|
hasAllRecipes = false;
|
||||||
}
|
}
|
||||||
if (hasAllRecipes) {
|
if (hasAllRecipes) {
|
||||||
for (Ingredient ingredient : recipeType.getIngredients()) {
|
for (RebornIngredient ingredient : recipeType.getRebornIngredients()) {
|
||||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||||
if (ingredient.test(this.inventory.getStackInSlot(inputSlot))) {
|
if (ingredient.test(this.inventory.getStackInSlot(inputSlot))) {
|
||||||
int count = 1;
|
inventory.shrinkSlot(inputSlot, ingredient.getSize());
|
||||||
//TODO also look into ingredient size here
|
|
||||||
inventory.shrinkSlot(inputSlot, count);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,9 +279,9 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
||||||
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||||
.addInventory().tile(this)
|
.addInventory().tile(this)
|
||||||
.filterSlot(0, 47, 17,
|
.filterSlot(0, 47, 17,
|
||||||
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(0).test(stack)))
|
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getRebornIngredients().get(0).test(stack)))
|
||||||
.filterSlot(1, 65, 17,
|
.filterSlot(1, 65, 17,
|
||||||
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(1).test(stack)))
|
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getRebornIngredients().get(1).test(stack)))
|
||||||
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||||
.syncIntegerValue(this::getCookTime, this::setCookTime)
|
.syncIntegerValue(this::getCookTime, this::setCookTime)
|
||||||
.syncIntegerValue(this::getCurrentItemBurnTime, this::setCurrentItemBurnTime).addInventory().create(this);
|
.syncIntegerValue(this::getCurrentItemBurnTime, this::setCurrentItemBurnTime).addInventory().create(this);
|
||||||
|
|
|
@ -60,9 +60,9 @@ public class TileAlloySmelter extends TileGenericMachine implements IContainerPr
|
||||||
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory().hotbar()
|
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory().hotbar()
|
||||||
.addInventory().tile(this)
|
.addInventory().tile(this)
|
||||||
.filterSlot(0, 34, 47,
|
.filterSlot(0, 34, 47,
|
||||||
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(0).test(stack)))
|
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getRebornIngredients().get(0).test(stack)))
|
||||||
.filterSlot(1, 126, 47,
|
.filterSlot(1, 126, 47,
|
||||||
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(1).test(stack)))
|
stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getRebornIngredients().get(1).test(stack)))
|
||||||
.outputSlot(2, 80, 47).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
.outputSlot(2, 80, 47).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
||||||
.create(this);
|
.create(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue