Made the api usefull
This commit is contained in:
parent
b44cdd4064
commit
7e7fcf2ad9
18 changed files with 162 additions and 133 deletions
|
@ -11,7 +11,7 @@ import reborncore.api.power.EnumPowerTier;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.utils.RecipeCrafter;
|
||||
import techreborn.api.upgrade.UpgradeHandler;
|
||||
import techreborn.utils.upgrade.UpgradeHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.api.Reference;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
|
|
|
@ -17,6 +17,8 @@ import reborncore.common.misc.Location;
|
|||
import reborncore.common.multiblock.IMultiblockPart;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.api.recipe.ITileRecipeHandler;
|
||||
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
||||
import techreborn.utils.RecipeCrafter;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -25,7 +27,7 @@ import techreborn.api.Reference;
|
|||
import techreborn.multiblocks.MultiBlockCasing;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
|
||||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory
|
||||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory, ITileRecipeHandler<BlastFurnaceRecipe>
|
||||
{
|
||||
|
||||
public static int euTick = 5;
|
||||
|
@ -336,4 +338,18 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
|||
{
|
||||
return inventory.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile, BlastFurnaceRecipe recipe) {
|
||||
if (tile instanceof TileBlastFurnace) {
|
||||
TileBlastFurnace blastFurnace = (TileBlastFurnace) tile;
|
||||
return blastFurnace.getHeat() >= recipe.neededHeat;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile, BlastFurnaceRecipe recipe) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.api.recipe.ITileRecipeHandler;
|
||||
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
|
||||
import techreborn.utils.RecipeCrafter;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
@ -27,7 +30,7 @@ import techreborn.api.Reference;
|
|||
import ic2.api.tile.IWrenchable;
|
||||
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||
implements IWrenchable, IFluidHandler, IInventory, ISidedInventory
|
||||
implements IWrenchable, IFluidHandler, IInventory, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>
|
||||
{
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
|
||||
|
@ -378,4 +381,49 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
{
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile, IndustrialGrinderRecipe recipe) {
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialGrinder) {
|
||||
TileIndustrialGrinder grinder = (TileIndustrialGrinder) tile;
|
||||
if (grinder.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (grinder.tank.getFluid() == recipe.fluidStack) {
|
||||
if (grinder.tank.getFluidAmount() >= recipe.fluidStack.amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile, IndustrialGrinderRecipe recipe) {
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialGrinder) {
|
||||
TileIndustrialGrinder grinder = (TileIndustrialGrinder) tile;
|
||||
if (grinder.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (grinder.tank.getFluid() == recipe.fluidStack) {
|
||||
if (grinder.tank.getFluidAmount() >= recipe.fluidStack.amount) {
|
||||
if (grinder.tank.getFluidAmount() > 0) {
|
||||
grinder.tank.setFluid(new FluidStack(recipe.fluidStack.getFluid(),
|
||||
grinder.tank.getFluidAmount() - recipe.fluidStack.amount));
|
||||
} else {
|
||||
grinder.tank.setFluid(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.api.recipe.ITileRecipeHandler;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.utils.RecipeCrafter;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
@ -29,7 +31,7 @@ import techreborn.api.Reference;
|
|||
import ic2.api.tile.IWrenchable;
|
||||
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||
implements IWrenchable, IFluidHandler, IInventory, ISidedInventory, IListInfoProvider
|
||||
implements IWrenchable, IFluidHandler, IInventory, ISidedInventory, IListInfoProvider, ITileRecipeHandler<IndustrialSawmillRecipe>
|
||||
{
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
|
||||
|
@ -373,4 +375,48 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
|||
{
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile, IndustrialSawmillRecipe recipe) {
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialSawmill) {
|
||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
||||
if (sawmill.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (sawmill.tank.getFluid() == recipe.fluidStack) {
|
||||
if (sawmill.tank.getFluidAmount() >= recipe.fluidStack.amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile, IndustrialSawmillRecipe recipe) {
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialSawmill) {
|
||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
||||
if (sawmill.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (sawmill.tank.getFluid() == recipe.fluidStack) {
|
||||
if (sawmill.tank.getFluidAmount() >= recipe.fluidStack.amount) {
|
||||
if (sawmill.tank.getFluidAmount() > 0) {
|
||||
sawmill.tank.setFluid(new FluidStack(recipe.fluidStack.getFluid(),
|
||||
sawmill.tank.getFluidAmount() - recipe.fluidStack.amount));
|
||||
} else {
|
||||
sawmill.tank.setFluid(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,19 +5,22 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.api.recipe.ITileRecipeHandler;
|
||||
import techreborn.api.recipe.machines.VacuumFreezerRecipe;
|
||||
import techreborn.utils.RecipeCrafter;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.api.Reference;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable, IInventory
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable, IInventory, ITileRecipeHandler<VacuumFreezerRecipe>
|
||||
{
|
||||
|
||||
public int tickTime;
|
||||
|
@ -289,4 +292,18 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile, VacuumFreezerRecipe recipe) {
|
||||
if (tile instanceof TileVacuumFreezer) {
|
||||
if (((TileVacuumFreezer) tile).multiBlockStatus == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile, VacuumFreezerRecipe recipe) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue