mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 14:59:22 +01:00
made the blast furnace booster only work on ores
This commit is contained in:
parent
68bf15b791
commit
0175c836e2
1 changed files with 14 additions and 0 deletions
|
@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
|||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tileentity.BlastFurnaceTileEntity;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -16,6 +17,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityBlastFurnaceBooster extends TileEntityImpl implements ITickableTileEntity {
|
||||
|
||||
|
@ -35,6 +37,8 @@ public class TileEntityBlastFurnaceBooster extends TileEntityImpl implements ITi
|
|||
IRecipe<?> recipe = this.world.getRecipeManager().getRecipe(TileEntityFurnaceHeater.getRecipeType(tile), tile, this.world).orElse(null);
|
||||
if (recipe == null)
|
||||
return;
|
||||
if (!this.isApplicable(recipe.getIngredients()))
|
||||
return;
|
||||
|
||||
IIntArray data = TileEntityFurnaceHeater.getFurnaceData(tile);
|
||||
int doneDiff = data.get(3) - data.get(2);
|
||||
|
@ -65,6 +69,16 @@ public class TileEntityBlastFurnaceBooster extends TileEntityImpl implements ITi
|
|||
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.BLAST_FURNACE_BOOSTER, 1));
|
||||
}
|
||||
|
||||
private boolean isApplicable(List<Ingredient> ingredients) {
|
||||
for (Ingredient ing : ingredients) {
|
||||
for (ItemStack stack : ing.getMatchingStacks()) {
|
||||
if (stack.getItem().getTags().stream().anyMatch(t -> t.getPath().startsWith("ores/")))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
TileEntity below = this.world.getTileEntity(this.pos.down());
|
||||
|
|
Loading…
Reference in a new issue