added way to not use ore dic
This commit is contained in:
parent
df7199d113
commit
0ea07a6a1a
6 changed files with 26 additions and 10 deletions
|
@ -79,4 +79,9 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
|
||||||
public Object clone()throws CloneNotSupportedException{
|
public Object clone()throws CloneNotSupportedException{
|
||||||
return super.clone();
|
return super.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useOreDic() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,6 @@ public interface IBaseRecipeType {
|
||||||
public boolean onCraft(TileEntity tile);
|
public boolean onCraft(TileEntity tile);
|
||||||
|
|
||||||
public Object clone()throws CloneNotSupportedException;
|
public Object clone()throws CloneNotSupportedException;
|
||||||
|
|
||||||
|
public boolean useOreDic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class RecipeCrafter {
|
||||||
if (recipe.canCraft(parentTile) && hasAllInputs(recipe)) {//This checks to see if it has all of the inputs
|
if (recipe.canCraft(parentTile) && hasAllInputs(recipe)) {//This checks to see if it has all of the inputs
|
||||||
boolean canGiveInvAll = true;
|
boolean canGiveInvAll = true;
|
||||||
for (int i = 0; i < recipe.getOutputsSize(); i++) {//This checks to see if it can fit all of the outputs
|
for (int i = 0; i < recipe.getOutputsSize(); i++) {//This checks to see if it can fit all of the outputs
|
||||||
if (!canFitStack(recipe.getOutput(i), outputSlots[i])) {
|
if (!canFitStack(recipe.getOutput(i), outputSlots[i], recipe.useOreDic())) {
|
||||||
canGiveInvAll = false;
|
canGiveInvAll = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public class RecipeCrafter {
|
||||||
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
|
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
|
||||||
boolean canGiveInvAll = true;
|
boolean canGiveInvAll = true;
|
||||||
for (int i = 0; i < currentRecipe.getOutputsSize(); i++) {//Checks to see if it can fit the output
|
for (int i = 0; i < currentRecipe.getOutputsSize(); i++) {//Checks to see if it can fit the output
|
||||||
if (!canFitStack(currentRecipe.getOutput(i), outputSlots[i])) {
|
if (!canFitStack(currentRecipe.getOutput(i), outputSlots[i], currentRecipe.useOreDic())) {
|
||||||
canGiveInvAll = false;
|
canGiveInvAll = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ public class RecipeCrafter {
|
||||||
for (ItemStack input : currentRecipe.getInputs()) {
|
for (ItemStack input : currentRecipe.getInputs()) {
|
||||||
Boolean hasItem = false;
|
Boolean hasItem = false;
|
||||||
for (int inputSlot : inputSlots) {//Checks to see if it can find the input
|
for (int inputSlot : inputSlots) {//Checks to see if it can find the input
|
||||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true, true) && inventory.getStackInSlot(inputSlot).stackSize >= input.stackSize) {
|
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true, currentRecipe.useOreDic()) && inventory.getStackInSlot(inputSlot).stackSize >= input.stackSize) {
|
||||||
hasItem = true;
|
hasItem = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ public class RecipeCrafter {
|
||||||
for (ItemStack input : recipeType.getInputs()) {
|
for (ItemStack input : recipeType.getInputs()) {
|
||||||
Boolean hasItem = false;
|
Boolean hasItem = false;
|
||||||
for (int inputslot : inputSlots) {
|
for (int inputslot : inputSlots) {
|
||||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true, true) && inventory.getStackInSlot(inputslot).stackSize >= input.stackSize) {
|
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true, recipeType.useOreDic()) && inventory.getStackInSlot(inputslot).stackSize >= input.stackSize) {
|
||||||
hasItem = true;
|
hasItem = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ public class RecipeCrafter {
|
||||||
}
|
}
|
||||||
for (ItemStack input : currentRecipe.getInputs()) {
|
for (ItemStack input : currentRecipe.getInputs()) {
|
||||||
for (int inputSlot : inputSlots) {//Uses all of the inputs
|
for (int inputSlot : inputSlots) {//Uses all of the inputs
|
||||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true, true)) {
|
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true, currentRecipe.useOreDic())) {
|
||||||
inventory.decrStackSize(inputSlot, input.stackSize);
|
inventory.decrStackSize(inputSlot, input.stackSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -217,14 +217,14 @@ public class RecipeCrafter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canFitStack(ItemStack stack, int slot) {//Checks to see if it can fit the stack
|
public boolean canFitStack(ItemStack stack, int slot, boolean oreDic) {//Checks to see if it can fit the stack
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (inventory.getStackInSlot(slot) == null) {
|
if (inventory.getStackInSlot(slot) == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, true)) {
|
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, oreDic)) {
|
||||||
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {
|
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ public class RecipeCrafter {
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, true)) {//If the slot has stuff in
|
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, currentRecipe.useOreDic())) {//If the slot has stuff in
|
||||||
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {//Check to see if it fits
|
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {//Check to see if it fits
|
||||||
ItemStack newStack = stack.copy();
|
ItemStack newStack = stack.copy();
|
||||||
newStack.stackSize = inventory.getStackInSlot(slot).stackSize + stack.stackSize;//Sets the new stack size
|
newStack.stackSize = inventory.getStackInSlot(slot).stackSize + stack.stackSize;//Sets the new stack size
|
||||||
|
|
|
@ -67,4 +67,9 @@ public class IndustrialSawmillRecipe extends BaseRecipe {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useOreDic() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,12 @@ public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implemen
|
||||||
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
|
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
|
||||||
int offset = 4;
|
int offset = 4;
|
||||||
if (recipeType.getInputs().size() > 0) {
|
if (recipeType.getInputs().size() > 0) {
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 32 - offset, 26 - offset);
|
PositionedStack pStack = new PositionedStack(recipeType.getInputs().get(0), 32 - offset, 26 - offset);
|
||||||
input.add(pStack);
|
input.add(pStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recipeType.getInputs().size() > 1) {
|
if (recipeType.getInputs().size() > 1) {
|
||||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 32 - offset, 44 - offset);
|
PositionedStack pStack2 = new PositionedStack(recipeType.getInputs().get(1), 32 - offset, 44 - offset);
|
||||||
input.add(pStack2);
|
input.add(pStack2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import ic2.api.item.IC2Items;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import techreborn.api.BlastFurnaceRecipe;
|
import techreborn.api.BlastFurnaceRecipe;
|
||||||
|
@ -159,6 +160,9 @@ public class ModRecipes {
|
||||||
RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 1), new ItemStack(ModItems.cells, 1, 16), null, IC2Items.getItem("iridiumOre"), new ItemStack(ModItems.smallDusts, 6, 39), new ItemStack(ModItems.dusts, 6, 58), IC2Items.getItem("cell"), 400, 5));
|
RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 1), new ItemStack(ModItems.cells, 1, 16), null, IC2Items.getItem("iridiumOre"), new ItemStack(ModItems.smallDusts, 6, 39), new ItemStack(ModItems.dusts, 6, 58), IC2Items.getItem("cell"), 400, 5));
|
||||||
|
|
||||||
RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.coal), null, new ItemStack(Items.diamond), new ItemStack(Items.emerald), new ItemStack(Items.apple), new ItemStack(Items.arrow), 1, 10));
|
RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.coal), null, new ItemStack(Items.diamond), new ItemStack(Items.emerald), new ItemStack(Items.apple), new ItemStack(Items.arrow), 1, 10));
|
||||||
|
|
||||||
|
RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 0), ItemDusts.getDustByName("ashes", 1), null, 100, 10));
|
||||||
|
|
||||||
LogHelper.info("Machine Recipes Added");
|
LogHelper.info("Machine Recipes Added");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue