Fix #1844
This commit is contained in:
parent
4bbcf9e282
commit
ef96e41557
3 changed files with 30 additions and 5 deletions
|
@ -34,11 +34,12 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.blockentity.SlotConfiguration;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
||||
public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop {
|
||||
public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, SlotConfiguration.SlotFilter {
|
||||
|
||||
public RebornInventory<?> inventory;
|
||||
public int burnTime;
|
||||
|
@ -62,7 +63,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
|
|||
* @return
|
||||
*/
|
||||
protected abstract boolean canSmelt();
|
||||
|
||||
|
||||
/**
|
||||
* Turn ingredients into the appropriate smelted
|
||||
* item in the output slot
|
||||
|
@ -228,4 +229,5 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
|
|||
this.progress = progress;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -136,4 +136,17 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
|
|||
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime)
|
||||
.addInventory().create(this, syncID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValid(int slotID, ItemStack stack) {
|
||||
return ModRecipes.ALLOY_SMELTER.getRecipes(world).stream()
|
||||
.anyMatch(rebornRecipe -> rebornRecipe.getRebornIngredients().stream()
|
||||
.anyMatch(rebornIngredient -> rebornIngredient.test(stack))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getInputSlots() {
|
||||
return new int[]{input1, input2};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
package techreborn.blockentity.machine.iron;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.entity.ExperienceOrbEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -41,6 +39,8 @@ import techreborn.init.TRBlockEntities;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.RecipeUtils;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity implements IContainerProvider {
|
||||
|
||||
int inputSlot = 0;
|
||||
|
@ -118,7 +118,12 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
|||
int result = inventory.getInvStack(outputSlot).getCount() + outputStack.getCount();
|
||||
return result <= inventory.getStackLimit() && result <= outputStack.getMaxCount();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isStackValid(int slotID, ItemStack stack) {
|
||||
return !getResultFor(stack).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(CompoundTag compoundTag) {
|
||||
super.fromTag(compoundTag);
|
||||
|
@ -141,6 +146,11 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
|||
this.experience = experience;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getInputSlots() {
|
||||
return new int[]{inputSlot};
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
|
||||
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory().hotbar()
|
||||
|
|
Loading…
Reference in a new issue