Allow any input or output to be null, includes a fix for the grinder fluid as well
This commit is contained in:
parent
46ee2fc71d
commit
2d17902d03
29 changed files with 1208 additions and 1266 deletions
|
@ -1,67 +1,67 @@
|
||||||
package techreborn.api.recipe;
|
package techreborn.api.recipe;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend this to add a recipe
|
* Extend this to add a recipe
|
||||||
*/
|
*/
|
||||||
public abstract class BaseRecipe implements IBaseRecipeType {
|
public abstract class BaseRecipe implements IBaseRecipeType {
|
||||||
|
|
||||||
public ArrayList<ItemStack> inputs;
|
public ArrayList<ItemStack> inputs;
|
||||||
|
|
||||||
public ArrayList<ItemStack> outputs;
|
public ArrayList<ItemStack> outputs;
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
|
|
||||||
public int euPerTick;
|
public int euPerTick;
|
||||||
|
|
||||||
public BaseRecipe(String name, int tickTime, int euPerTick) {
|
public BaseRecipe(String name, int tickTime, int euPerTick) {
|
||||||
inputs = new ArrayList<ItemStack>();
|
inputs = new ArrayList<ItemStack>();
|
||||||
outputs = new ArrayList<ItemStack>();
|
outputs = new ArrayList<ItemStack>();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
//This adds all new recipes
|
//This adds all new recipes
|
||||||
this.tickTime = tickTime;
|
this.tickTime = tickTime;
|
||||||
this.euPerTick = euPerTick;
|
this.euPerTick = euPerTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getOutputs() {
|
public List<ItemStack> getOutputs() {
|
||||||
return outputs;
|
return outputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getInputs() {
|
public List<ItemStack> getInputs() {
|
||||||
return inputs;
|
return inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int tickTime() {
|
public int tickTime() {
|
||||||
return tickTime;
|
return tickTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int euPerTick() {
|
public int euPerTick() {
|
||||||
return euPerTick;
|
return euPerTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCraft(TileEntity tile) {
|
public boolean canCraft(TileEntity tile) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCraft(TileEntity tile) {
|
public boolean onCraft(TileEntity tile) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
package techreborn.api.recipe;
|
package techreborn.api.recipe;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the base recipe class implement this to make a recipe handler
|
* This is the base recipe class implement this to make a recipe handler
|
||||||
*/
|
*/
|
||||||
public interface IBaseRecipeType {
|
public interface IBaseRecipeType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this to get all of the inputs
|
* Use this to get all of the inputs
|
||||||
*
|
*
|
||||||
* @return the List of inputs
|
* @return the List of inputs
|
||||||
*/
|
*/
|
||||||
public List<ItemStack> getInputs();
|
public List<ItemStack> getInputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this to get all of the outputs
|
* Use this to get all of the outputs
|
||||||
*
|
*
|
||||||
* @return the List of outputs
|
* @return the List of outputs
|
||||||
*/
|
*/
|
||||||
public List<ItemStack> getOutputs();
|
public List<ItemStack> getOutputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the name to check that the recipe is the one that should be used in
|
* This is the name to check that the recipe is the one that should be used in
|
||||||
* the tile entity that is set up to process this recipe.
|
* the tile entity that is set up to process this recipe.
|
||||||
*
|
*
|
||||||
* @return The recipeName
|
* @return The recipeName
|
||||||
*/
|
*/
|
||||||
public String getRecipeName();
|
public String getRecipeName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is how long the recipe needs to tick for the crafting operation to complete
|
* This is how long the recipe needs to tick for the crafting operation to complete
|
||||||
* @return tick length
|
*
|
||||||
*/
|
* @return tick length
|
||||||
public int tickTime();
|
*/
|
||||||
|
public int tickTime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is how much eu Per tick the machine should use
|
* This is how much eu Per tick the machine should use
|
||||||
* @return the amount of eu to be used per tick.
|
*
|
||||||
*/
|
* @return the amount of eu to be used per tick.
|
||||||
public int euPerTick();
|
*/
|
||||||
|
public int euPerTick();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param tile the tile that is doing the crafting
|
||||||
* @param tile the tile that is doing the crafting
|
* @return if true the recipe will craft, if false it will not
|
||||||
* @return if true the recipe will craft, if false it will not
|
*/
|
||||||
*/
|
public boolean canCraft(TileEntity tile);
|
||||||
public boolean canCraft(TileEntity tile);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param tile the tile that is doing the crafting
|
||||||
* @param tile the tile that is doing the crafting
|
* @return return true if fluid was taken and should craft
|
||||||
* @return return true if fluid was taken and should craft
|
*/
|
||||||
*/
|
public boolean onCraft(TileEntity tile);
|
||||||
public boolean onCraft(TileEntity tile);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,248 +1,246 @@
|
||||||
package techreborn.api.recipe;
|
package techreborn.api.recipe;
|
||||||
|
|
||||||
import ic2.api.energy.prefab.BasicSink;
|
import ic2.api.energy.prefab.BasicSink;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import techreborn.tiles.TileMachineBase;
|
import techreborn.tiles.TileMachineBase;
|
||||||
import techreborn.util.Inventory;
|
import techreborn.util.Inventory;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this in your tile entity to craft things
|
* Use this in your tile entity to craft things
|
||||||
*/
|
*/
|
||||||
public class RecipeCrafter {
|
public class RecipeCrafter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the recipe type to use
|
* This is the recipe type to use
|
||||||
*/
|
*/
|
||||||
public String recipeName;
|
public String recipeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the parent tile
|
* This is the parent tile
|
||||||
*/
|
*/
|
||||||
public TileMachineBase parentTile;
|
public TileMachineBase parentTile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the place to use the power from
|
* This is the place to use the power from
|
||||||
*/
|
*/
|
||||||
public BasicSink energy;
|
public BasicSink energy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the amount of inputs that the setRecipe has
|
* This is the amount of inputs that the setRecipe has
|
||||||
*/
|
*/
|
||||||
public int inputs;
|
public int inputs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the amount of outputs that the recipe has
|
* This is the amount of outputs that the recipe has
|
||||||
*/
|
*/
|
||||||
public int outputs;
|
public int outputs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the inventory to use for the crafting
|
* This is the inventory to use for the crafting
|
||||||
*/
|
*/
|
||||||
public Inventory inventory;
|
public Inventory inventory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the list of the slots that the crafting logic should look for the input item stacks.
|
* This is the list of the slots that the crafting logic should look for the input item stacks.
|
||||||
*/
|
*/
|
||||||
public int[] inputSlots;
|
public int[] inputSlots;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the list for the slots that the crafting logic should look fot the output item stacks.
|
* This is the list for the slots that the crafting logic should look fot the output item stacks.
|
||||||
*/
|
*/
|
||||||
public int[] outputSlots;
|
public int[] outputSlots;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the constructor, not a lot to say here :P
|
* This is the constructor, not a lot to say here :P
|
||||||
*
|
*
|
||||||
* @param recipeName
|
* @param recipeName
|
||||||
* @param parentTile
|
* @param parentTile
|
||||||
* @param energy
|
* @param energy
|
||||||
* @param inputs
|
* @param inputs
|
||||||
* @param outputs
|
* @param outputs
|
||||||
* @param inventory
|
* @param inventory
|
||||||
* @param inputSlots
|
* @param inputSlots
|
||||||
* @param outputSlots
|
* @param outputSlots
|
||||||
*/
|
*/
|
||||||
public RecipeCrafter(String recipeName, TileMachineBase parentTile, BasicSink energy, int inputs, int outputs, Inventory inventory, int[] inputSlots, int[] outputSlots) {
|
public RecipeCrafter(String recipeName, TileMachineBase parentTile, BasicSink energy, int inputs, int outputs, Inventory inventory, int[] inputSlots, int[] outputSlots) {
|
||||||
this.recipeName = recipeName;
|
this.recipeName = recipeName;
|
||||||
this.parentTile = parentTile;
|
this.parentTile = parentTile;
|
||||||
this.energy = energy;
|
this.energy = energy;
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
this.outputs = outputs;
|
this.outputs = outputs;
|
||||||
this.inventory = inventory;
|
this.inventory = inventory;
|
||||||
this.inputSlots = inputSlots;
|
this.inputSlots = inputSlots;
|
||||||
this.outputSlots = outputSlots;
|
this.outputSlots = outputSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IBaseRecipeType currentRecipe;
|
public IBaseRecipeType currentRecipe;
|
||||||
public int currentTickTime = 0;
|
public int currentTickTime = 0;
|
||||||
double lastEnergy;
|
double lastEnergy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this on the tile tick
|
* Call this on the tile tick
|
||||||
*/
|
*/
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (currentRecipe == null) {//It will now look for new recipes.
|
if (currentRecipe == null) {//It will now look for new recipes.
|
||||||
for (IBaseRecipeType recipe : RecipeHanderer.getRecipeClassFromName(recipeName)) {
|
for (IBaseRecipeType recipe : RecipeHanderer.getRecipeClassFromName(recipeName)) {
|
||||||
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.getOutputs().size(); i++) {//This checks to see if it can fit all of the outputs
|
for (int i = 0; i < recipe.getOutputs().size(); i++) {//This checks to see if it can fit all of the outputs
|
||||||
if (!canFitStack(recipe.getOutputs().get(i), outputSlots[i])) {
|
if (!canFitStack(recipe.getOutputs().get(i), outputSlots[i])) {
|
||||||
canGiveInvAll = false;
|
canGiveInvAll = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(canGiveInvAll){
|
if (canGiveInvAll) {
|
||||||
currentRecipe = recipe;//Sets the current recipe then syncs
|
currentRecipe = recipe;//Sets the current recipe then syncs
|
||||||
parentTile.needsSync = true;
|
parentTile.needsSync = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(lastEnergy != energy.getEnergyStored()){
|
if (lastEnergy != energy.getEnergyStored()) {
|
||||||
parentTile.needsSync = true;
|
parentTile.needsSync = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!hasAllInputs()){//If it doesn't have all the inputs reset
|
if (!hasAllInputs()) {//If it doesn't have all the inputs reset
|
||||||
currentRecipe = null;
|
currentRecipe = null;
|
||||||
currentTickTime = 0;
|
currentTickTime = 0;
|
||||||
parentTile.needsSync = true;
|
parentTile.needsSync = true;
|
||||||
}
|
}
|
||||||
if (currentRecipe != null && currentTickTime >= currentRecipe.tickTime()) {//If it has reached the recipe tick time
|
if (currentRecipe != null && currentTickTime >= currentRecipe.tickTime()) {//If it has reached the recipe tick time
|
||||||
boolean canGiveInvAll = true;
|
boolean canGiveInvAll = true;
|
||||||
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {//Checks to see if it can fit the output
|
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {//Checks to see if it can fit the output
|
||||||
if (!canFitStack(currentRecipe.getOutputs().get(i), outputSlots[i])) {
|
if (!canFitStack(currentRecipe.getOutputs().get(i), outputSlots[i])) {
|
||||||
canGiveInvAll = false;
|
canGiveInvAll = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArrayList<Integer> filledSlots = new ArrayList<Integer>();//The slots that have been filled
|
ArrayList<Integer> filledSlots = new ArrayList<Integer>();//The slots that have been filled
|
||||||
if (canGiveInvAll && currentRecipe.onCraft(parentTile)) {
|
if (canGiveInvAll && currentRecipe.onCraft(parentTile)) {
|
||||||
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {
|
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {
|
||||||
if (!filledSlots.contains(outputSlots[i])) {//checks it has not been filled
|
if (!filledSlots.contains(outputSlots[i])) {//checks it has not been filled
|
||||||
fitStack(currentRecipe.getOutputs().get(i), outputSlots[i]);//fills the slot with the output stack
|
fitStack(currentRecipe.getOutputs().get(i), outputSlots[i]);//fills the slot with the output stack
|
||||||
filledSlots.add(outputSlots[i]);
|
filledSlots.add(outputSlots[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
useAllInputs();//this uses all the inputs
|
useAllInputs();//this uses all the inputs
|
||||||
currentRecipe = null;//resets
|
currentRecipe = null;//resets
|
||||||
currentTickTime = 0;
|
currentTickTime = 0;
|
||||||
//Force sync after craft
|
//Force sync after craft
|
||||||
parentTile.syncWithAll();
|
parentTile.syncWithAll();
|
||||||
parentTile.needsSync = false;
|
parentTile.needsSync = false;
|
||||||
parentTile.ticksSinceLastSync = 0;
|
parentTile.ticksSinceLastSync = 0;
|
||||||
}
|
}
|
||||||
} else if (currentRecipe != null && currentTickTime < currentRecipe.tickTime()) {
|
} else if (currentRecipe != null && currentTickTime < currentRecipe.tickTime()) {
|
||||||
if (energy.canUseEnergy(currentRecipe.euPerTick())) {//This checks to see if it can use the power
|
if (energy.canUseEnergy(currentRecipe.euPerTick())) {//This checks to see if it can use the power
|
||||||
if(!parentTile.getWorldObj().isRemote){//remove the power on the server side only
|
if (!parentTile.getWorldObj().isRemote) {//remove the power on the server side only
|
||||||
this.energy.setEnergyStored(this.energy.getEnergyStored() - currentRecipe.euPerTick());
|
this.energy.setEnergyStored(this.energy.getEnergyStored() - currentRecipe.euPerTick());
|
||||||
}
|
}
|
||||||
currentTickTime++;//increase the ticktime
|
currentTickTime++;//increase the ticktime
|
||||||
parentTile.needsSync = true;
|
parentTile.needsSync = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastEnergy = energy.getEnergyStored();
|
lastEnergy = energy.getEnergyStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAllInputs(){
|
public boolean hasAllInputs() {
|
||||||
if(currentRecipe == null){
|
if (currentRecipe == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
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, true) && inventory.getStackInSlot(inputSlot).stackSize >= input.stackSize) {
|
||||||
hasItem = true;
|
hasItem = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!hasItem)
|
if (!hasItem)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAllInputs(IBaseRecipeType recipeType){
|
public boolean hasAllInputs(IBaseRecipeType recipeType) {
|
||||||
if(recipeType == null){
|
if (recipeType == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
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)){
|
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true, true)) {
|
||||||
hasItem = true;
|
hasItem = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!hasItem)
|
if (!hasItem)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useAllInputs(){
|
public void useAllInputs() {
|
||||||
if(currentRecipe == null){
|
if (currentRecipe == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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, true)) {
|
||||||
inventory.decrStackSize(inputSlot, input.stackSize);
|
inventory.decrStackSize(inputSlot, input.stackSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canFitStack(ItemStack stack, int slot) {//Checks to see if it can fit the stack
|
public boolean canFitStack(ItemStack stack, int slot) {//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, true)) {
|
||||||
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {
|
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fitStack(ItemStack stack, int slot) {//This fits a stack into a slot
|
public void fitStack(ItemStack stack, int slot) {//This fits a stack into a slot
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (inventory.getStackInSlot(slot) == null) {//If the slot is empty set the contents
|
if (inventory.getStackInSlot(slot) == null) {//If the slot is empty set the contents
|
||||||
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, true)) {//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
|
||||||
inventory.setInventorySlotContents(slot, newStack);
|
inventory.setInventorySlotContents(slot, newStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound tag) {
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
NBTTagCompound data = tag.getCompoundTag("Crater");
|
NBTTagCompound data = tag.getCompoundTag("Crater");
|
||||||
|
|
||||||
currentTickTime = data.getInteger("currentTickTime");
|
currentTickTime = data.getInteger("currentTickTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound tag) {
|
public void writeToNBT(NBTTagCompound tag) {
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
|
||||||
data.setDouble("currentTickTime", currentTickTime);
|
data.setDouble("currentTickTime", currentTickTime);
|
||||||
|
|
||||||
tag.setTag("Crater", data);
|
tag.setTag("Crater", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive(){
|
public boolean isActive() {
|
||||||
return currentRecipe != null && currentTickTime != 0;
|
return currentRecipe != null && currentTickTime != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
package techreborn.api.recipe;
|
package techreborn.api.recipe;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class RecipeHanderer {
|
public class RecipeHanderer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the array list of all of the recipes for all of the machines
|
* This is the array list of all of the recipes for all of the machines
|
||||||
*/
|
*/
|
||||||
public static ArrayList<IBaseRecipeType> recipeList = new ArrayList<IBaseRecipeType>();
|
public static ArrayList<IBaseRecipeType> recipeList = new ArrayList<IBaseRecipeType>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a backedup clone of the master recipeList
|
* This is a backedup clone of the master recipeList
|
||||||
*/
|
*/
|
||||||
public static ArrayList<IBaseRecipeType> recipeListBackup = new ArrayList<IBaseRecipeType>();
|
public static ArrayList<IBaseRecipeType> recipeListBackup = new ArrayList<IBaseRecipeType>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this to get all of the recipes form a recipe name
|
* Use this to get all of the recipes form a recipe name
|
||||||
* @param name the name that the recipe was resisted as.
|
*
|
||||||
* @return A list of all the recipes of a given name.
|
* @param name the name that the recipe was resisted as.
|
||||||
*/
|
* @return A list of all the recipes of a given name.
|
||||||
public static List<IBaseRecipeType> getRecipeClassFromName(String name){
|
*/
|
||||||
List<IBaseRecipeType> baseRecipeList = new ArrayList<IBaseRecipeType>();
|
public static List<IBaseRecipeType> getRecipeClassFromName(String name) {
|
||||||
for(IBaseRecipeType baseRecipe : recipeList){
|
List<IBaseRecipeType> baseRecipeList = new ArrayList<IBaseRecipeType>();
|
||||||
if(baseRecipe.getRecipeName().equals(name)){
|
for (IBaseRecipeType baseRecipe : recipeList) {
|
||||||
baseRecipeList.add(baseRecipe);
|
if (baseRecipe.getRecipeName().equals(name)) {
|
||||||
}
|
baseRecipeList.add(baseRecipe);
|
||||||
}
|
}
|
||||||
return baseRecipeList;
|
}
|
||||||
}
|
return baseRecipeList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a recipe to the system
|
* Add a recipe to the system
|
||||||
* @param recipe The recipe to add to the system.
|
*
|
||||||
*/
|
* @param recipe The recipe to add to the system.
|
||||||
public static void addRecipe(IBaseRecipeType recipe){
|
*/
|
||||||
if(recipe == null){
|
public static void addRecipe(IBaseRecipeType recipe) {
|
||||||
return;
|
if (recipe == null) {
|
||||||
}
|
return;
|
||||||
if(recipeList.contains(recipe)){
|
}
|
||||||
return;
|
if (recipeList.contains(recipe)) {
|
||||||
}
|
return;
|
||||||
recipeList.add(recipe);
|
}
|
||||||
}
|
recipeList.add(recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,14 +5,13 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class AlloySmelterRecipe extends BaseRecipe {
|
public class AlloySmelterRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public AlloySmelterRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick)
|
public AlloySmelterRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||||
{
|
super("alloySmelterRecipe", tickTime, euPerTick);
|
||||||
super("alloySmelterRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (input2 != null)
|
||||||
if(input2 != null)
|
inputs.add(input2);
|
||||||
inputs.add(input2);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,13 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class AssemblingMachineRecipe extends BaseRecipe {
|
public class AssemblingMachineRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public AssemblingMachineRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick)
|
public AssemblingMachineRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||||
{
|
super("assemblingMachineRecipe", tickTime, euPerTick);
|
||||||
super("assemblingMachineRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (input2 != null)
|
||||||
if(input2 != null)
|
inputs.add(input2);
|
||||||
inputs.add(input2);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,20 +5,19 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class CentrifugeRecipe extends BaseRecipe {
|
public class CentrifugeRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick)
|
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
|
||||||
{
|
super("centrifugeRecipe", tickTime, euPerTick);
|
||||||
super("centrifugeRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (input2 != null)
|
||||||
if(input2 != null)
|
inputs.add(input2);
|
||||||
inputs.add(input2);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
if (output2 != null)
|
||||||
if(output2 != null)
|
outputs.add(output2);
|
||||||
outputs.add(output2);
|
if (output3 != null)
|
||||||
if(output3 != null)
|
outputs.add(output3);
|
||||||
outputs.add(output3);
|
if (output4 != null)
|
||||||
if(output4 != null)
|
outputs.add(output4);
|
||||||
outputs.add(output4);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,13 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class ChemicalReactorRecipe extends BaseRecipe {
|
public class ChemicalReactorRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public ChemicalReactorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick)
|
public ChemicalReactorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||||
{
|
super("chemicalReactorRecipe", tickTime, euPerTick);
|
||||||
super("chemicalReactorRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (input2 != null)
|
||||||
if(input2 != null)
|
inputs.add(input2);
|
||||||
inputs.add(input2);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,58 +9,63 @@ import techreborn.tiles.TileGrinder;
|
||||||
|
|
||||||
public class GrinderRecipe extends BaseRecipe {
|
public class GrinderRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public FluidStack fluidStack;
|
public FluidStack fluidStack;
|
||||||
|
|
||||||
public GrinderRecipe(ItemStack input1, FluidStack fluidStack, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick)
|
public GrinderRecipe(ItemStack input1, FluidStack fluidStack, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
|
||||||
{
|
super("grinderRecipe", tickTime, euPerTick);
|
||||||
super("grinderRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
if (output2 != null)
|
||||||
if(output2 != null)
|
outputs.add(output2);
|
||||||
outputs.add(output2);
|
if (output3 != null)
|
||||||
if(output3 != null)
|
outputs.add(output3);
|
||||||
outputs.add(output3);
|
if (output4 != null)
|
||||||
if(output4 != null)
|
outputs.add(output4);
|
||||||
outputs.add(output4);
|
this.fluidStack = fluidStack;
|
||||||
this.fluidStack = fluidStack;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCraft(TileEntity tile) {
|
public boolean canCraft(TileEntity tile) {
|
||||||
if(tile instanceof TileGrinder){
|
if (fluidStack == null) {
|
||||||
TileGrinder grinder = (TileGrinder) tile;
|
return true;
|
||||||
if(grinder.tank.getFluid() == null){
|
}
|
||||||
return false;
|
if (tile instanceof TileGrinder) {
|
||||||
}
|
TileGrinder grinder = (TileGrinder) tile;
|
||||||
if(grinder.tank.getFluid().getFluidID() == fluidStack.getFluidID()){
|
if (grinder.tank.getFluid() == null) {
|
||||||
if(grinder.tank.getFluidAmount() >= fluidStack.amount){
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
if (grinder.tank.getFluid().getFluidID() == fluidStack.getFluidID()) {
|
||||||
}
|
if (grinder.tank.getFluidAmount() >= fluidStack.amount) {
|
||||||
}
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCraft(TileEntity tile) {
|
public boolean onCraft(TileEntity tile) {
|
||||||
if(tile instanceof TileGrinder) {
|
if (fluidStack == null) {
|
||||||
TileGrinder grinder = (TileGrinder) tile;
|
return true;
|
||||||
if(grinder.tank.getFluid() == null){
|
}
|
||||||
return false;
|
if (tile instanceof TileGrinder) {
|
||||||
}
|
TileGrinder grinder = (TileGrinder) tile;
|
||||||
if(grinder.tank.getFluid().getFluidID() == fluidStack.getFluidID()){
|
if (grinder.tank.getFluid() == null) {
|
||||||
if(grinder.tank.getFluidAmount() >= fluidStack.amount){
|
return false;
|
||||||
if(grinder.tank.getFluidAmount() > 0){
|
}
|
||||||
grinder.tank.setFluid(new FluidStack(fluidStack.getFluid(), grinder.tank.getFluidAmount() - fluidStack.amount));
|
if (grinder.tank.getFluid().getFluidID() == fluidStack.getFluidID()) {
|
||||||
} else {
|
if (grinder.tank.getFluidAmount() >= fluidStack.amount) {
|
||||||
grinder.tank.setFluid(null);
|
if (grinder.tank.getFluidAmount() > 0) {
|
||||||
}
|
grinder.tank.setFluid(new FluidStack(fluidStack.getFluid(), grinder.tank.getFluidAmount() - fluidStack.amount));
|
||||||
return true;
|
} else {
|
||||||
}
|
grinder.tank.setFluid(null);
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,15 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class ImplosionCompressorRecipe extends BaseRecipe {
|
public class ImplosionCompressorRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public ImplosionCompressorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tickTime, int euPerTick) {
|
public ImplosionCompressorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tickTime, int euPerTick) {
|
||||||
super("implosionCompressorRecipe", tickTime, euPerTick);
|
super("implosionCompressorRecipe", tickTime, euPerTick);
|
||||||
if(input1 != null)
|
if (input1 != null)
|
||||||
inputs.add(input1);
|
inputs.add(input1);
|
||||||
if(input2 != null)
|
if (input2 != null)
|
||||||
inputs.add(input2);
|
inputs.add(input2);
|
||||||
if(output1 != null)
|
if (output1 != null)
|
||||||
outputs.add(output1);
|
outputs.add(output1);
|
||||||
if(output2 != null)
|
if (output2 != null)
|
||||||
outputs.add(output2);
|
outputs.add(output2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,17 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class IndustrialSawmillRecipe extends BaseRecipe {
|
public class IndustrialSawmillRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3, int tickTime, int euPerTick)
|
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3, int tickTime, int euPerTick) {
|
||||||
{
|
super("industrialSawmillRecipe", tickTime, euPerTick);
|
||||||
super("industrialSawmillRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (input2 != null)
|
||||||
if(input2 != null)
|
inputs.add(input2);
|
||||||
inputs.add(input2);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
if (output2 != null)
|
||||||
if(output2 != null)
|
outputs.add(output2);
|
||||||
outputs.add(output2);
|
if (output3 != null)
|
||||||
if(output3 != null)
|
outputs.add(output3);
|
||||||
outputs.add(output3);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,11 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class LatheRecipe extends BaseRecipe {
|
public class LatheRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public LatheRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick)
|
public LatheRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||||
{
|
super("latheRecipe", tickTime, euPerTick);
|
||||||
super("latheRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,11 @@ import techreborn.api.recipe.BaseRecipe;
|
||||||
|
|
||||||
public class PlateCuttingMachineRecipe extends BaseRecipe {
|
public class PlateCuttingMachineRecipe extends BaseRecipe {
|
||||||
|
|
||||||
public PlateCuttingMachineRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick)
|
public PlateCuttingMachineRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||||
{
|
super("plateCuttingMachineRecipe", tickTime, euPerTick);
|
||||||
super("plateCuttingMachineRecipe", tickTime, euPerTick);
|
if (input1 != null)
|
||||||
if(input1 != null)
|
inputs.add(input1);
|
||||||
inputs.add(input1);
|
if (output1 != null)
|
||||||
if(output1 != null)
|
outputs.add(output1);
|
||||||
outputs.add(output1);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI")
|
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api.recipe.machines;
|
||||||
package techreborn.api.recipe.machines;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI")
|
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api.recipe;
|
||||||
package techreborn.api.recipe;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
|
|
|
@ -1,186 +1,158 @@
|
||||||
package techreborn.compat.nei;
|
package techreborn.compat.nei;
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import techreborn.api.BlastFurnaceRecipe;
|
|
||||||
import techreborn.api.TechRebornAPI;
|
|
||||||
import techreborn.client.gui.GuiBlastFurnace;
|
|
||||||
import techreborn.config.ConfigTechReborn;
|
|
||||||
import codechicken.lib.gui.GuiDraw;
|
import codechicken.lib.gui.GuiDraw;
|
||||||
import codechicken.nei.NEIServerUtils;
|
import codechicken.nei.NEIServerUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
import codechicken.nei.PositionedStack;
|
||||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import techreborn.api.BlastFurnaceRecipe;
|
||||||
|
import techreborn.api.TechRebornAPI;
|
||||||
|
import techreborn.client.gui.GuiBlastFurnace;
|
||||||
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mark on 29/04/15.
|
* Created by mark on 29/04/15.
|
||||||
*/
|
*/
|
||||||
public class BlastFurnaceRecipeHandler extends TemplateRecipeHandler {
|
public class BlastFurnaceRecipeHandler extends TemplateRecipeHandler {
|
||||||
|
|
||||||
public class CachedBlastFurnaceRecipe extends CachedRecipe {
|
public class CachedBlastFurnaceRecipe extends CachedRecipe {
|
||||||
|
|
||||||
private List<PositionedStack> input = new ArrayList<PositionedStack>();
|
private List<PositionedStack> input = new ArrayList<PositionedStack>();
|
||||||
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
|
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
|
||||||
public Point focus;
|
public Point focus;
|
||||||
public BlastFurnaceRecipe centrifugeRecipie;
|
public BlastFurnaceRecipe centrifugeRecipie;
|
||||||
|
|
||||||
public CachedBlastFurnaceRecipe(BlastFurnaceRecipe recipie)
|
public CachedBlastFurnaceRecipe(BlastFurnaceRecipe recipie) {
|
||||||
{
|
this.centrifugeRecipie = recipie;
|
||||||
this.centrifugeRecipie = recipie;
|
int offset = 4;
|
||||||
int offset = 4;
|
PositionedStack pStack = new PositionedStack(
|
||||||
PositionedStack pStack = new PositionedStack(
|
recipie.getInput1(), 56 - offset, 25 - offset);
|
||||||
recipie.getInput1(), 56 - offset, 25 - offset);
|
|
||||||
|
|
||||||
pStack.setMaxSize(1);
|
pStack.setMaxSize(1);
|
||||||
this.input.add(pStack);
|
this.input.add(pStack);
|
||||||
|
|
||||||
PositionedStack pStack2 = new PositionedStack(
|
PositionedStack pStack2 = new PositionedStack(
|
||||||
recipie.getInput2(), 56 - offset, 43 - offset);
|
recipie.getInput2(), 56 - offset, 43 - offset);
|
||||||
|
|
||||||
pStack.setMaxSize(1);
|
pStack.setMaxSize(1);
|
||||||
this.input.add(pStack2);
|
this.input.add(pStack2);
|
||||||
|
|
||||||
if (recipie.getOutput1() != null)
|
if (recipie.getOutput1() != null) {
|
||||||
{
|
this.outputs.add(new PositionedStack(recipie.getOutput1(),
|
||||||
this.outputs.add(new PositionedStack(recipie.getOutput1(),
|
116 - offset, 35 - offset));
|
||||||
116 - offset, 35 - offset));
|
}
|
||||||
}
|
if (recipie.getOutput2() != null) {
|
||||||
if (recipie.getOutput2() != null)
|
this.outputs.add(new PositionedStack(recipie.getOutput2(),
|
||||||
{
|
116 - offset, 53 - offset));
|
||||||
this.outputs.add(new PositionedStack(recipie.getOutput2(),
|
}
|
||||||
116 - offset, 53 - offset));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PositionedStack> getIngredients()
|
public List<PositionedStack> getIngredients() {
|
||||||
{
|
return this.getCycledIngredients(cycleticks / 20, this.input);
|
||||||
return this.getCycledIngredients(cycleticks / 20, this.input);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PositionedStack> getOtherStacks()
|
public List<PositionedStack> getOtherStacks() {
|
||||||
{
|
return this.outputs;
|
||||||
return this.outputs;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PositionedStack getResult()
|
public PositionedStack getResult() {
|
||||||
{
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName()
|
public String getRecipeName() {
|
||||||
{
|
return "Blast Furnace";
|
||||||
return "Blast Furnace";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture()
|
public String getGuiTexture() {
|
||||||
{
|
return "techreborn:textures/gui/industrial_blast_furnace.png";
|
||||||
return "techreborn:textures/gui/industrial_blast_furnace.png";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass()
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
{
|
return GuiBlastFurnace.class;
|
||||||
return GuiBlastFurnace.class;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int recipeIndex)
|
public void drawBackground(int recipeIndex) {
|
||||||
{
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GuiDraw.changeTexture(getGuiTexture());
|
||||||
GuiDraw.changeTexture(getGuiTexture());
|
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
|
||||||
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
|
GuiDraw.drawTooltipBox(10, 80, 145, 50);
|
||||||
GuiDraw.drawTooltipBox(10, 80, 145, 50);
|
GuiDraw.drawString("Info:", 14, 84, -1);
|
||||||
GuiDraw.drawString("Info:", 14, 84, -1);
|
CachedRecipe recipe = arecipes.get(recipeIndex);
|
||||||
CachedRecipe recipe = arecipes.get(recipeIndex);
|
if (recipe instanceof CachedBlastFurnaceRecipe) {
|
||||||
if (recipe instanceof CachedBlastFurnaceRecipe)
|
CachedBlastFurnaceRecipe centrifugeRecipie = (CachedBlastFurnaceRecipe) recipe;
|
||||||
{
|
GuiDraw.drawString(
|
||||||
CachedBlastFurnaceRecipe centrifugeRecipie = (CachedBlastFurnaceRecipe) recipe;
|
"EU needed: "
|
||||||
GuiDraw.drawString(
|
+ (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie
|
||||||
"EU needed: "
|
.getTickTime()), 14, 94, -1);
|
||||||
+ (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie
|
GuiDraw.drawString("Ticks to smelt: "
|
||||||
.getTickTime()), 14, 94, -1);
|
+ centrifugeRecipie.centrifugeRecipie.getTickTime(), 14,
|
||||||
GuiDraw.drawString("Ticks to smelt: "
|
104, -1);
|
||||||
+ centrifugeRecipie.centrifugeRecipie.getTickTime(), 14,
|
GuiDraw.drawString("Time to smelt: "
|
||||||
104, -1);
|
+ centrifugeRecipie.centrifugeRecipie.getTickTime() / 20
|
||||||
GuiDraw.drawString("Time to smelt: "
|
+ " seconds", 14, 114, -1);
|
||||||
+ centrifugeRecipie.centrifugeRecipie.getTickTime() / 20
|
}
|
||||||
+ " seconds", 14, 114, -1);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int recipiesPerPage()
|
public int recipiesPerPage() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadTransferRects()
|
public void loadTransferRects() {
|
||||||
{
|
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
|
||||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
|
new Rectangle(0, 0, 20, 20), "tr.blast", new Object[0]));
|
||||||
new Rectangle(0, 0, 20, 20), "tr.blast", new Object[0]));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void loadCraftingRecipes(String outputId, Object... results)
|
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||||
{
|
if (outputId.equals("tr.blast")) {
|
||||||
if (outputId.equals("tr.blast"))
|
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
|
||||||
{
|
addCached(centrifugeRecipie);
|
||||||
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes)
|
}
|
||||||
{
|
} else {
|
||||||
addCached(centrifugeRecipie);
|
super.loadCraftingRecipes(outputId, results);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
{
|
|
||||||
super.loadCraftingRecipes(outputId, results);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(ItemStack result)
|
public void loadCraftingRecipes(ItemStack result) {
|
||||||
{
|
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
|
||||||
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes)
|
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||||
{
|
centrifugeRecipie.getOutput1(), result)) {
|
||||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
addCached(centrifugeRecipie);
|
||||||
centrifugeRecipie.getOutput1(), result))
|
}
|
||||||
{
|
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||||
addCached(centrifugeRecipie);
|
centrifugeRecipie.getOutput2(), result)) {
|
||||||
}
|
addCached(centrifugeRecipie);
|
||||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
}
|
||||||
centrifugeRecipie.getOutput2(), result))
|
}
|
||||||
{
|
}
|
||||||
addCached(centrifugeRecipie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadUsageRecipes(ItemStack ingredient)
|
public void loadUsageRecipes(ItemStack ingredient) {
|
||||||
{
|
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
|
||||||
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes)
|
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput1(), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput2(), ingredient)) {
|
||||||
{
|
addCached(centrifugeRecipie);
|
||||||
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput1(), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput2(), ingredient))
|
}
|
||||||
{
|
}
|
||||||
addCached(centrifugeRecipie);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addCached(BlastFurnaceRecipe recipie)
|
private void addCached(BlastFurnaceRecipe recipie) {
|
||||||
{
|
this.arecipes.add(new CachedBlastFurnaceRecipe(recipie));
|
||||||
this.arecipes.add(new CachedBlastFurnaceRecipe(recipie));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,70 +1,62 @@
|
||||||
package techreborn.compat.nei;
|
package techreborn.compat.nei;
|
||||||
|
|
||||||
import techreborn.compat.nei.recipes.AlloySmelterRecipeHandler;
|
|
||||||
import techreborn.compat.nei.recipes.AssemblingMachineRecipeHandler;
|
|
||||||
import techreborn.compat.nei.recipes.CentrifugeRecipeHandler;
|
|
||||||
import techreborn.compat.nei.recipes.ChemicalReactorRecipeHandler;
|
|
||||||
import techreborn.compat.nei.recipes.ImplosionCompressorRecipeHandler;
|
|
||||||
import techreborn.compat.nei.recipes.IndustrialSawmillRecipeHandler;
|
|
||||||
import techreborn.compat.nei.recipes.LatheRecipeHandler;
|
|
||||||
import techreborn.compat.nei.recipes.PlateCuttingMachineRecipeHandler;
|
|
||||||
import techreborn.lib.ModInfo;
|
|
||||||
import codechicken.nei.api.API;
|
import codechicken.nei.api.API;
|
||||||
import codechicken.nei.api.IConfigureNEI;
|
import codechicken.nei.api.IConfigureNEI;
|
||||||
|
import techreborn.compat.nei.recipes.*;
|
||||||
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
public class NEIConfig implements IConfigureNEI {
|
public class NEIConfig implements IConfigureNEI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
return ModInfo.MOD_ID;
|
||||||
return ModInfo.MOD_ID;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public String getVersion() {
|
||||||
|
return ModInfo.MOD_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion()
|
|
||||||
{
|
|
||||||
return ModInfo.MOD_VERSION;
|
|
||||||
}
|
|
||||||
public static BlastFurnaceRecipeHandler blastFurnaceRecipeHandle;
|
public static BlastFurnaceRecipeHandler blastFurnaceRecipeHandle;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadConfig() {
|
public void loadConfig() {
|
||||||
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
|
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
|
||||||
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
|
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
|
||||||
NEIConfig.blastFurnaceRecipeHandle = new BlastFurnaceRecipeHandler();
|
NEIConfig.blastFurnaceRecipeHandle = new BlastFurnaceRecipeHandler();
|
||||||
|
|
||||||
|
|
||||||
ImplosionCompressorRecipeHandler implosion = new ImplosionCompressorRecipeHandler();
|
|
||||||
API.registerUsageHandler(implosion);
|
ImplosionCompressorRecipeHandler implosion = new ImplosionCompressorRecipeHandler();
|
||||||
API.registerRecipeHandler(implosion);
|
API.registerUsageHandler(implosion);
|
||||||
|
API.registerRecipeHandler(implosion);
|
||||||
AlloySmelterRecipeHandler alloy = new AlloySmelterRecipeHandler();
|
|
||||||
API.registerUsageHandler(alloy);
|
AlloySmelterRecipeHandler alloy = new AlloySmelterRecipeHandler();
|
||||||
API.registerRecipeHandler(alloy);
|
API.registerUsageHandler(alloy);
|
||||||
|
API.registerRecipeHandler(alloy);
|
||||||
AssemblingMachineRecipeHandler assembling = new AssemblingMachineRecipeHandler();
|
|
||||||
API.registerUsageHandler(assembling);
|
AssemblingMachineRecipeHandler assembling = new AssemblingMachineRecipeHandler();
|
||||||
API.registerRecipeHandler(assembling);
|
API.registerUsageHandler(assembling);
|
||||||
|
API.registerRecipeHandler(assembling);
|
||||||
LatheRecipeHandler lathe = new LatheRecipeHandler();
|
|
||||||
API.registerUsageHandler(lathe);
|
LatheRecipeHandler lathe = new LatheRecipeHandler();
|
||||||
API.registerRecipeHandler(lathe);
|
API.registerUsageHandler(lathe);
|
||||||
|
API.registerRecipeHandler(lathe);
|
||||||
IndustrialSawmillRecipeHandler sawmill = new IndustrialSawmillRecipeHandler();
|
|
||||||
API.registerUsageHandler(sawmill);
|
IndustrialSawmillRecipeHandler sawmill = new IndustrialSawmillRecipeHandler();
|
||||||
API.registerRecipeHandler(sawmill);
|
API.registerUsageHandler(sawmill);
|
||||||
|
API.registerRecipeHandler(sawmill);
|
||||||
PlateCuttingMachineRecipeHandler plate = new PlateCuttingMachineRecipeHandler();
|
|
||||||
API.registerUsageHandler(plate);
|
PlateCuttingMachineRecipeHandler plate = new PlateCuttingMachineRecipeHandler();
|
||||||
API.registerRecipeHandler(plate);
|
API.registerUsageHandler(plate);
|
||||||
|
API.registerRecipeHandler(plate);
|
||||||
ChemicalReactorRecipeHandler chem = new ChemicalReactorRecipeHandler();
|
|
||||||
API.registerUsageHandler(chem);
|
ChemicalReactorRecipeHandler chem = new ChemicalReactorRecipeHandler();
|
||||||
API.registerRecipeHandler(chem);
|
API.registerUsageHandler(chem);
|
||||||
|
API.registerRecipeHandler(chem);
|
||||||
CentrifugeRecipeHandler cent = new CentrifugeRecipeHandler();
|
|
||||||
API.registerUsageHandler(cent);
|
CentrifugeRecipeHandler cent = new CentrifugeRecipeHandler();
|
||||||
API.registerRecipeHandler(cent);
|
API.registerUsageHandler(cent);
|
||||||
|
API.registerRecipeHandler(cent);
|
||||||
|
|
||||||
API.registerUsageHandler(shapedRollingMachineHandler);
|
API.registerUsageHandler(shapedRollingMachineHandler);
|
||||||
API.registerRecipeHandler(shapedRollingMachineHandler);
|
API.registerRecipeHandler(shapedRollingMachineHandler);
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
//Copy and pasted from https://github.com/Chicken-Bones/NotEnoughItems/blob/master/src/codechicken/nei/recipe/ShapedRecipeHandler.java
|
//Copy and pasted from https://github.com/Chicken-Bones/NotEnoughItems/blob/master/src/codechicken/nei/recipe/ShapedRecipeHandler.java
|
||||||
package techreborn.compat.nei;
|
package techreborn.compat.nei;
|
||||||
|
|
||||||
import java.awt.Rectangle;
|
import codechicken.nei.NEIServerUtils;
|
||||||
import java.util.List;
|
import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
@ -11,110 +10,97 @@ import net.minecraft.item.crafting.ShapedRecipes;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import techreborn.api.RollingMachineRecipe;
|
import techreborn.api.RollingMachineRecipe;
|
||||||
import techreborn.client.gui.GuiRollingMachine;
|
import techreborn.client.gui.GuiRollingMachine;
|
||||||
import codechicken.nei.NEIServerUtils;
|
|
||||||
import codechicken.nei.recipe.ShapedRecipeHandler;
|
import java.awt.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ShapedRollingMachineHandler extends ShapedRecipeHandler {
|
public class ShapedRollingMachineHandler extends ShapedRecipeHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass()
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
{
|
return GuiRollingMachine.class;
|
||||||
return GuiRollingMachine.class;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadTransferRects()
|
public void loadTransferRects() {
|
||||||
{
|
this.transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24,
|
||||||
this.transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24,
|
18), "rollingcrafting", new Object[0]));
|
||||||
18), "rollingcrafting", new Object[0]));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName()
|
public String getRecipeName() {
|
||||||
{
|
return "rollingcrafting";
|
||||||
return "rollingcrafting";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOverlayIdentifier()
|
public String getOverlayIdentifier() {
|
||||||
{
|
return "rollingcrafting";
|
||||||
return "rollingcrafting";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(String outputId, Object... results)
|
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||||
{
|
if (outputId.equals("rollingcrafting")
|
||||||
if (outputId.equals("rollingcrafting")
|
&& getClass() == ShapedRollingMachineHandler.class) {
|
||||||
&& getClass() == ShapedRollingMachineHandler.class)
|
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
||||||
{
|
.getRecipeList()) {
|
||||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
CachedShapedRecipe recipe = null;
|
||||||
.getRecipeList())
|
if (irecipe instanceof ShapedRecipes)
|
||||||
{
|
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||||
CachedShapedRecipe recipe = null;
|
else if (irecipe instanceof ShapedOreRecipe)
|
||||||
if (irecipe instanceof ShapedRecipes)
|
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
|
||||||
else if (irecipe instanceof ShapedOreRecipe)
|
|
||||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
|
||||||
|
|
||||||
if (recipe == null)
|
if (recipe == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
recipe.computeVisuals();
|
recipe.computeVisuals();
|
||||||
arecipes.add(recipe);
|
arecipes.add(recipe);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
super.loadCraftingRecipes(outputId, results);
|
||||||
super.loadCraftingRecipes(outputId, results);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(ItemStack result)
|
public void loadCraftingRecipes(ItemStack result) {
|
||||||
{
|
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
||||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
.getRecipeList()) {
|
||||||
.getRecipeList())
|
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||||
{
|
irecipe.getRecipeOutput(), result)) {
|
||||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
CachedShapedRecipe recipe = null;
|
||||||
irecipe.getRecipeOutput(), result))
|
if (irecipe instanceof ShapedRecipes)
|
||||||
{
|
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||||
CachedShapedRecipe recipe = null;
|
else if (irecipe instanceof ShapedOreRecipe)
|
||||||
if (irecipe instanceof ShapedRecipes)
|
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
|
||||||
else if (irecipe instanceof ShapedOreRecipe)
|
|
||||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
|
||||||
|
|
||||||
if (recipe == null)
|
if (recipe == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
recipe.computeVisuals();
|
recipe.computeVisuals();
|
||||||
arecipes.add(recipe);
|
arecipes.add(recipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadUsageRecipes(ItemStack ingredient)
|
public void loadUsageRecipes(ItemStack ingredient) {
|
||||||
{
|
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
||||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
.getRecipeList()) {
|
||||||
.getRecipeList())
|
CachedShapedRecipe recipe = null;
|
||||||
{
|
if (irecipe instanceof ShapedRecipes)
|
||||||
CachedShapedRecipe recipe = null;
|
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||||
if (irecipe instanceof ShapedRecipes)
|
else if (irecipe instanceof ShapedOreRecipe)
|
||||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||||
else if (irecipe instanceof ShapedOreRecipe)
|
|
||||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
|
||||||
|
|
||||||
if (recipe == null
|
if (recipe == null
|
||||||
|| !recipe.contains(recipe.ingredients,
|
|| !recipe.contains(recipe.ingredients,
|
||||||
ingredient.getItem()))
|
ingredient.getItem()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
recipe.computeVisuals();
|
recipe.computeVisuals();
|
||||||
if (recipe.contains(recipe.ingredients, ingredient))
|
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||||
{
|
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
arecipes.add(recipe);
|
||||||
arecipes.add(recipe);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
//Copy and pasted from https://github.com/Chicken-Bones/NotEnoughItems/blob/master/src/codechicken/nei/recipe/ShapelessRecipeHandler.java
|
//Copy and pasted from https://github.com/Chicken-Bones/NotEnoughItems/blob/master/src/codechicken/nei/recipe/ShapelessRecipeHandler.java
|
||||||
package techreborn.compat.nei;
|
package techreborn.compat.nei;
|
||||||
|
|
||||||
import java.awt.Rectangle;
|
import codechicken.nei.NEIServerUtils;
|
||||||
import java.util.List;
|
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
@ -11,116 +10,102 @@ import net.minecraft.item.crafting.ShapelessRecipes;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
import techreborn.api.RollingMachineRecipe;
|
import techreborn.api.RollingMachineRecipe;
|
||||||
import techreborn.client.gui.GuiRollingMachine;
|
import techreborn.client.gui.GuiRollingMachine;
|
||||||
import codechicken.nei.NEIServerUtils;
|
|
||||||
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
import java.awt.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ShapelessRollingMachineHandler extends ShapelessRecipeHandler {
|
public class ShapelessRollingMachineHandler extends ShapelessRecipeHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass()
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
{
|
return GuiRollingMachine.class;
|
||||||
return GuiRollingMachine.class;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String getRecipeName()
|
public String getRecipeName() {
|
||||||
{
|
return "Shapeless Rolling Machine";
|
||||||
return "Shapeless Rolling Machine";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadTransferRects()
|
public void loadTransferRects() {
|
||||||
{
|
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18),
|
||||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18),
|
"rollingcraftingnoshape"));
|
||||||
"rollingcraftingnoshape"));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOverlayIdentifier()
|
public String getOverlayIdentifier() {
|
||||||
{
|
return "rollingcraftingnoshape";
|
||||||
return "rollingcraftingnoshape";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(String outputId, Object... results)
|
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||||
{
|
if (outputId.equals("rollingcraftingnoshape")
|
||||||
if (outputId.equals("rollingcraftingnoshape")
|
&& getClass() == ShapelessRollingMachineHandler.class) {
|
||||||
&& getClass() == ShapelessRollingMachineHandler.class)
|
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
||||||
{
|
.getRecipeList();
|
||||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
for (IRecipe irecipe : allrecipes) {
|
||||||
.getRecipeList();
|
CachedShapelessRecipe recipe = null;
|
||||||
for (IRecipe irecipe : allrecipes)
|
if (irecipe instanceof ShapelessRecipes)
|
||||||
{
|
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||||
CachedShapelessRecipe recipe = null;
|
else if (irecipe instanceof ShapelessOreRecipe)
|
||||||
if (irecipe instanceof ShapelessRecipes)
|
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
|
||||||
else if (irecipe instanceof ShapelessOreRecipe)
|
|
||||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
|
||||||
|
|
||||||
if (recipe == null)
|
if (recipe == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
arecipes.add(recipe);
|
arecipes.add(recipe);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
super.loadCraftingRecipes(outputId, results);
|
||||||
super.loadCraftingRecipes(outputId, results);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(ItemStack result)
|
public void loadCraftingRecipes(ItemStack result) {
|
||||||
{
|
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
||||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
.getRecipeList();
|
||||||
.getRecipeList();
|
for (IRecipe irecipe : allrecipes) {
|
||||||
for (IRecipe irecipe : allrecipes)
|
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||||
{
|
irecipe.getRecipeOutput(), result)) {
|
||||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
CachedShapelessRecipe recipe = null;
|
||||||
irecipe.getRecipeOutput(), result))
|
if (irecipe instanceof ShapelessRecipes)
|
||||||
{
|
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||||
CachedShapelessRecipe recipe = null;
|
else if (irecipe instanceof ShapelessOreRecipe)
|
||||||
if (irecipe instanceof ShapelessRecipes)
|
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
|
||||||
else if (irecipe instanceof ShapelessOreRecipe)
|
|
||||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
|
||||||
|
|
||||||
if (recipe == null)
|
if (recipe == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
arecipes.add(recipe);
|
arecipes.add(recipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadUsageRecipes(ItemStack ingredient)
|
public void loadUsageRecipes(ItemStack ingredient) {
|
||||||
{
|
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
||||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
.getRecipeList();
|
||||||
.getRecipeList();
|
for (IRecipe irecipe : allrecipes) {
|
||||||
for (IRecipe irecipe : allrecipes)
|
CachedShapelessRecipe recipe = null;
|
||||||
{
|
if (irecipe instanceof ShapelessRecipes)
|
||||||
CachedShapelessRecipe recipe = null;
|
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||||
if (irecipe instanceof ShapelessRecipes)
|
else if (irecipe instanceof ShapelessOreRecipe)
|
||||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||||
else if (irecipe instanceof ShapelessOreRecipe)
|
|
||||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
|
||||||
|
|
||||||
if (recipe == null)
|
if (recipe == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (recipe.contains(recipe.ingredients, ingredient))
|
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||||
{
|
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
arecipes.add(recipe);
|
||||||
arecipes.add(recipe);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe)
|
private CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe) {
|
||||||
{
|
if (recipe.recipeItems == null)
|
||||||
if (recipe.recipeItems == null)
|
return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
return new CachedShapelessRecipe(recipe.recipeItems,
|
return new CachedShapelessRecipe(recipe.recipeItems,
|
||||||
recipe.getRecipeOutput());
|
recipe.getRecipeOutput());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiAlloySmelter;
|
import techreborn.client.gui.GuiAlloySmelter;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AlloySmelterRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class AlloySmelterRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 47 - offset, 17 - offset);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 47 - offset, 17 - offset);
|
||||||
input.add(pStack);
|
input.add(pStack);
|
||||||
|
|
||||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
|
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
|
||||||
input.add(pStack2);
|
input.add(pStack2);
|
||||||
|
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
||||||
outputs.add(pStack3);
|
outputs.add(pStack3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "alloySmelterRecipe";
|
return "alloySmelterRecipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture() {
|
public String getGuiTexture() {
|
||||||
return "techreborn:textures/gui/electric_alloy_furnace.png";
|
return "techreborn:textures/gui/electric_alloy_furnace.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
return GuiAlloySmelter.class;
|
return GuiAlloySmelter.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,50 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiAssemblingMachine;
|
import techreborn.client.gui.GuiAssemblingMachine;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AssemblingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class AssemblingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 47 - offset, 17 - offset);
|
if (recipeType.getInputs().size() > 0) {
|
||||||
input.add(pStack);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 47 - offset, 17 - offset);
|
||||||
|
input.add(pStack);
|
||||||
|
}
|
||||||
|
if (recipeType.getInputs().size() > 1) {
|
||||||
|
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
|
||||||
|
input.add(pStack2);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
|
if (recipeType.getOutputs().size() > 0) {
|
||||||
input.add(pStack2);
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
||||||
|
outputs.add(pStack3);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
}
|
||||||
outputs.add(pStack3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "assemblingMachineRecipe";
|
return "assemblingMachineRecipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture() {
|
public String getGuiTexture() {
|
||||||
return "techreborn:textures/gui/assembling_machine.png";
|
return "techreborn:textures/gui/assembling_machine.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
return GuiAssemblingMachine.class;
|
return GuiAssemblingMachine.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,53 +1,64 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiCentrifuge;
|
import techreborn.client.gui.GuiCentrifuge;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CentrifugeRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class CentrifugeRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 80 - offset, 35 - offset);
|
if (recipeType.getInputs().size() > 0) {
|
||||||
input.add(pStack);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 80 - offset, 35 - offset);
|
||||||
|
input.add(pStack);
|
||||||
|
}
|
||||||
|
if (recipeType.getInputs().size() > 1) {
|
||||||
|
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 50 - offset, 5 - offset);
|
||||||
|
input.add(pStack2);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 50 - offset, 5 - offset);
|
if (recipeType.getOutputs().size() > 0) {
|
||||||
input.add(pStack2);
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 80 - offset, 5 - offset);
|
||||||
|
outputs.add(pStack3);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 80 - offset, 5 - offset);
|
if (recipeType.getOutputs().size() > 1) {
|
||||||
outputs.add(pStack3);
|
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 110 - offset, 35 - offset);
|
||||||
|
outputs.add(pStack4);
|
||||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 110 - offset, 35 - offset);
|
}
|
||||||
outputs.add(pStack4);
|
|
||||||
|
|
||||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 80 - offset, 65 - offset);
|
|
||||||
outputs.add(pStack5);
|
|
||||||
|
|
||||||
PositionedStack pStack6 = new PositionedStack(recipeType.getOutputs().get(3), 50 - offset, 35 - offset);
|
|
||||||
outputs.add(pStack6);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (recipeType.getOutputs().size() > 2) {
|
||||||
public String getRecipeName() {
|
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 80 - offset, 65 - offset);
|
||||||
return "centrifugeRecipe";
|
outputs.add(pStack5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
if (recipeType.getOutputs().size() > 3) {
|
||||||
public String getGuiTexture() {
|
PositionedStack pStack6 = new PositionedStack(recipeType.getOutputs().get(3), 50 - offset, 35 - offset);
|
||||||
return "techreborn:textures/gui/industrial_centrifuge.png";
|
outputs.add(pStack6);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public String getRecipeName() {
|
||||||
return GuiCentrifuge.class;
|
return "centrifugeRecipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
public String getGuiTexture() {
|
||||||
return this;
|
return "techreborn:textures/gui/industrial_centrifuge.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
|
return GuiCentrifuge.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,50 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiChemicalReactor;
|
import techreborn.client.gui.GuiChemicalReactor;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ChemicalReactorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class ChemicalReactorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 70 - offset, 21 - offset);
|
if (recipeType.getInputs().size() > 0) {
|
||||||
input.add(pStack);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 70 - offset, 21 - offset);
|
||||||
|
input.add(pStack);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 90 - offset, 21 - offset);
|
if (recipeType.getInputs().size() > 1) {
|
||||||
input.add(pStack2);
|
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 90 - offset, 21 - offset);
|
||||||
|
input.add(pStack2);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 80 - offset, 51 - offset);
|
if (recipeType.getOutputs().size() > 0) {
|
||||||
outputs.add(pStack3);
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 80 - offset, 51 - offset);
|
||||||
}
|
outputs.add(pStack3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "chemicalReactorRecipe";
|
return "chemicalReactorRecipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture() {
|
public String getGuiTexture() {
|
||||||
return "techreborn:textures/gui/chemical_reactor.png";
|
return "techreborn:textures/gui/chemical_reactor.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
return GuiChemicalReactor.class;
|
return GuiChemicalReactor.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,164 +1,139 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.awt.Point;
|
import codechicken.lib.gui.GuiDraw;
|
||||||
import java.awt.Rectangle;
|
import codechicken.nei.PositionedStack;
|
||||||
import java.util.ArrayList;
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.api.recipe.RecipeHanderer;
|
import techreborn.api.recipe.RecipeHanderer;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.lib.gui.GuiDraw;
|
|
||||||
import codechicken.nei.PositionedStack;
|
import java.awt.*;
|
||||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class GenericRecipeHander extends TemplateRecipeHandler {
|
public abstract class GenericRecipeHander extends TemplateRecipeHandler {
|
||||||
|
|
||||||
public INeiBaseRecipe getNeiBaseRecipe(){
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CachedGenericRecipe extends CachedRecipe {
|
public class CachedGenericRecipe extends CachedRecipe {
|
||||||
|
|
||||||
private List<PositionedStack> input = new ArrayList<PositionedStack>();
|
private List<PositionedStack> input = new ArrayList<PositionedStack>();
|
||||||
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
|
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
|
||||||
public Point focus;
|
public Point focus;
|
||||||
public IBaseRecipeType recipie;
|
public IBaseRecipeType recipie;
|
||||||
public INeiBaseRecipe neiBaseRecipe;
|
public INeiBaseRecipe neiBaseRecipe;
|
||||||
|
|
||||||
public CachedGenericRecipe(IBaseRecipeType recipe, INeiBaseRecipe neiBaseRecipe)
|
public CachedGenericRecipe(IBaseRecipeType recipe, INeiBaseRecipe neiBaseRecipe) {
|
||||||
{
|
this.recipie = recipe;
|
||||||
this.recipie = recipe;
|
this.neiBaseRecipe = neiBaseRecipe;
|
||||||
this.neiBaseRecipe = neiBaseRecipe;
|
neiBaseRecipe.addPositionedStacks(input, outputs, recipe);
|
||||||
neiBaseRecipe.addPositionedStacks(input, outputs, recipe);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PositionedStack> getIngredients()
|
public List<PositionedStack> getIngredients() {
|
||||||
{
|
return this.getCycledIngredients(cycleticks / 20, this.input);
|
||||||
return this.getCycledIngredients(cycleticks / 20, this.input);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PositionedStack> getOtherStacks()
|
public List<PositionedStack> getOtherStacks() {
|
||||||
{
|
return this.outputs;
|
||||||
return this.outputs;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PositionedStack getResult()
|
public PositionedStack getResult() {
|
||||||
{
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName()
|
public String getRecipeName() {
|
||||||
{
|
return getNeiBaseRecipe().getRecipeName();
|
||||||
return getNeiBaseRecipe().getRecipeName();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture()
|
public String getGuiTexture() {
|
||||||
{
|
return getNeiBaseRecipe().getGuiTexture();
|
||||||
return getNeiBaseRecipe().getGuiTexture();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass()
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
{
|
return getNeiBaseRecipe().getGuiClass();
|
||||||
return getNeiBaseRecipe().getGuiClass();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int recipeIndex)
|
public void drawBackground(int recipeIndex) {
|
||||||
{
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GuiDraw.changeTexture(getGuiTexture());
|
||||||
GuiDraw.changeTexture(getGuiTexture());
|
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
|
||||||
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
|
GuiDraw.drawTooltipBox(10, 80, 145, 50);
|
||||||
GuiDraw.drawTooltipBox(10, 80, 145, 50);
|
GuiDraw.drawString("Info:", 14, 84, -1);
|
||||||
GuiDraw.drawString("Info:", 14, 84, -1);
|
CachedRecipe recipe = arecipes.get(recipeIndex);
|
||||||
CachedRecipe recipe = arecipes.get(recipeIndex);
|
if (recipe instanceof CachedGenericRecipe) {
|
||||||
if (recipe instanceof CachedGenericRecipe)
|
CachedGenericRecipe genericRecipe = (CachedGenericRecipe) recipe;
|
||||||
{
|
GuiDraw.drawString(
|
||||||
CachedGenericRecipe genericRecipe = (CachedGenericRecipe) recipe;
|
"EU needed: "
|
||||||
GuiDraw.drawString(
|
+ (ConfigTechReborn.CentrifugeInputTick * genericRecipe.recipie
|
||||||
"EU needed: "
|
.tickTime()), 14, 94, -1);
|
||||||
+ (ConfigTechReborn.CentrifugeInputTick * genericRecipe.recipie
|
GuiDraw.drawString("Ticks to smelt: "
|
||||||
.tickTime()), 14, 94, -1);
|
+ genericRecipe.recipie.tickTime(), 14,
|
||||||
GuiDraw.drawString("Ticks to smelt: "
|
104, -1);
|
||||||
+ genericRecipe.recipie.tickTime(), 14,
|
GuiDraw.drawString("Time to smelt: "
|
||||||
104, -1);
|
+ genericRecipe.recipie.tickTime() / 20
|
||||||
GuiDraw.drawString("Time to smelt: "
|
+ " seconds", 14, 114, -1);
|
||||||
+ genericRecipe.recipie.tickTime() / 20
|
}
|
||||||
+ " seconds", 14, 114, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int recipiesPerPage()
|
public int recipiesPerPage() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void loadTransferRects()
|
public void loadTransferRects() {
|
||||||
{
|
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
|
||||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
|
new Rectangle(0, 0, 20, 20), getNeiBaseRecipe().getRecipeName(), new Object[0]));
|
||||||
new Rectangle(0, 0, 20, 20), getNeiBaseRecipe().getRecipeName(), new Object[0]));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void loadCraftingRecipes(String outputId, Object... results)
|
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||||
{
|
if (outputId.equals(getNeiBaseRecipe().getRecipeName())) {
|
||||||
if (outputId.equals(getNeiBaseRecipe().getRecipeName()))
|
for (IBaseRecipeType recipeType : RecipeHanderer.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
|
||||||
{
|
addCached(recipeType);
|
||||||
for (IBaseRecipeType recipeType : RecipeHanderer.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName()))
|
}
|
||||||
{
|
} else {
|
||||||
addCached(recipeType);
|
super.loadCraftingRecipes(outputId, results);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
{
|
|
||||||
super.loadCraftingRecipes(outputId, results);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(ItemStack result)
|
public void loadCraftingRecipes(ItemStack result) {
|
||||||
{
|
for (IBaseRecipeType recipeType : RecipeHanderer.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
|
||||||
for (IBaseRecipeType recipeType : RecipeHanderer.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName()))
|
for (ItemStack output : recipeType.getOutputs()) {
|
||||||
{
|
if (ItemUtils.isItemEqual(output, result, true, false, true)) {
|
||||||
for(ItemStack output : recipeType.getOutputs()){
|
addCached(recipeType);
|
||||||
if (ItemUtils.isItemEqual(output, result, true, false, true))
|
}
|
||||||
{
|
}
|
||||||
addCached(recipeType);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadUsageRecipes(ItemStack ingredient)
|
public void loadUsageRecipes(ItemStack ingredient) {
|
||||||
{
|
for (IBaseRecipeType recipeType : RecipeHanderer.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
|
||||||
for (IBaseRecipeType recipeType : RecipeHanderer.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName()))
|
for (ItemStack input : recipeType.getInputs()) {
|
||||||
{
|
if (ItemUtils.isItemEqual(ingredient, input, true, false, true)) {
|
||||||
for(ItemStack input : recipeType.getInputs()){
|
addCached(recipeType);
|
||||||
if (ItemUtils.isItemEqual(ingredient, input, true, false, true))
|
}
|
||||||
{
|
}
|
||||||
addCached(recipeType);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addCached(IBaseRecipeType recipie)
|
private void addCached(IBaseRecipeType recipie) {
|
||||||
{
|
this.arecipes.add(new CachedGenericRecipe(recipie, getNeiBaseRecipe()));
|
||||||
this.arecipes.add(new CachedGenericRecipe(recipie, getNeiBaseRecipe()));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,38 +1,36 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this to make your neiHandler
|
* Use this to make your neiHandler
|
||||||
*/
|
*/
|
||||||
public interface INeiBaseRecipe {
|
public interface INeiBaseRecipe {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the inputs and the outputs
|
* Add the inputs and the outputs
|
||||||
* @param input add the input stacks to this
|
*
|
||||||
* @param outputs add this output stacks to this
|
* @param input add the input stacks to this
|
||||||
*/
|
* @param outputs add this output stacks to this
|
||||||
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType);
|
*/
|
||||||
|
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return the recipe name that is used for the recipe
|
||||||
* @return the recipe name that is used for the recipe
|
*/
|
||||||
*/
|
public String getRecipeName();
|
||||||
public String getRecipeName();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return the guiTexture location
|
||||||
* @return the guiTexture location
|
*/
|
||||||
*/
|
public String getGuiTexture();
|
||||||
public String getGuiTexture();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return the gui class for the recipe
|
||||||
* @return the gui class for the recipe
|
*/
|
||||||
*/
|
public Class<? extends GuiContainer> getGuiClass();
|
||||||
public Class<? extends GuiContainer> getGuiClass();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiImplosionCompressor;
|
import techreborn.client.gui.GuiImplosionCompressor;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ImplosionCompressorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class ImplosionCompressorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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)), 34 - offset, 16 - offset);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 34 - offset, 16 - 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)), 34 - offset, 34 - offset);
|
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 34 - offset, 34 - offset);
|
||||||
input.add(pStack2);
|
input.add(pStack2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(recipeType.getOutputs().size() > 0) {
|
if (recipeType.getOutputs().size() > 0) {
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 86 - offset, 25 - offset);
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 86 - offset, 25 - offset);
|
||||||
outputs.add(pStack3);
|
outputs.add(pStack3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(recipeType.getOutputs().size() > 1) {
|
if (recipeType.getOutputs().size() > 1) {
|
||||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 104 - offset, 25 - offset);
|
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 104 - offset, 25 - offset);
|
||||||
outputs.add(pStack4);
|
outputs.add(pStack4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "implosionCompressorRecipe";
|
return "implosionCompressorRecipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture() {
|
public String getGuiTexture() {
|
||||||
return "techreborn:textures/gui/implosion_compressor.png";
|
return "techreborn:textures/gui/implosion_compressor.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
return GuiImplosionCompressor.class;
|
return GuiImplosionCompressor.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,60 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiIndustrialSawmill;
|
import techreborn.client.gui.GuiIndustrialSawmill;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 32 - offset, 26 - offset);
|
if (recipeType.getInputs().size() > 0) {
|
||||||
input.add(pStack);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 32 - offset, 26 - offset);
|
||||||
|
input.add(pStack);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 32 - offset, 44 - offset);
|
if (recipeType.getInputs().size() > 1) {
|
||||||
input.add(pStack2);
|
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 32 - offset, 44 - offset);
|
||||||
|
input.add(pStack2);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 84 - offset, 35 - offset);
|
if (recipeType.getOutputs().size() > 0) {
|
||||||
outputs.add(pStack3);
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 84 - offset, 35 - offset);
|
||||||
|
outputs.add(pStack3);
|
||||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 102 - offset, 35 - offset);
|
}
|
||||||
outputs.add(pStack4);
|
|
||||||
|
|
||||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 120 - offset, 35 - offset);
|
|
||||||
outputs.add(pStack5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (recipeType.getOutputs().size() > 1) {
|
||||||
public String getRecipeName() {
|
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 102 - offset, 35 - offset);
|
||||||
return "industrialSawmillRecipe";
|
outputs.add(pStack4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
if (recipeType.getOutputs().size() > 2) {
|
||||||
public String getGuiTexture() {
|
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 120 - offset, 35 - offset);
|
||||||
return "techreborn:textures/gui/industrial_sawmill.png";
|
outputs.add(pStack5);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public String getRecipeName() {
|
||||||
return GuiIndustrialSawmill.class;
|
return "industrialSawmillRecipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
public String getGuiTexture() {
|
||||||
return this;
|
return "techreborn:textures/gui/industrial_sawmill.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
|
return GuiIndustrialSawmill.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,45 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiLathe;
|
import techreborn.client.gui.GuiLathe;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class LatheRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class LatheRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
|
if (recipeType.getInputs().size() > 0) {
|
||||||
input.add(pStack);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
|
||||||
|
input.add(pStack);
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
if (recipeType.getOutputs().size() > 0) {
|
||||||
outputs.add(pStack3);
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
||||||
}
|
outputs.add(pStack3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "latheRecipe";
|
return "latheRecipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture() {
|
public String getGuiTexture() {
|
||||||
return "techreborn:textures/gui/lathe.png";
|
return "techreborn:textures/gui/lathe.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
return GuiLathe.class;
|
return GuiLathe.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,44 @@
|
||||||
package techreborn.compat.nei.recipes;
|
package techreborn.compat.nei.recipes;
|
||||||
|
|
||||||
import java.util.List;
|
import codechicken.nei.PositionedStack;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import techreborn.api.recipe.IBaseRecipeType;
|
import techreborn.api.recipe.IBaseRecipeType;
|
||||||
import techreborn.client.gui.GuiPlateCuttingMachine;
|
import techreborn.client.gui.GuiPlateCuttingMachine;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PlateCuttingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
public class PlateCuttingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
|
if (recipeType.getInputs().size() > 0) {
|
||||||
input.add(pStack);
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
|
||||||
|
input.add(pStack);
|
||||||
|
}
|
||||||
|
if (recipeType.getOutputs().size() > 0) {
|
||||||
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
||||||
|
outputs.add(pStack3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
@Override
|
||||||
outputs.add(pStack3);
|
public String getRecipeName() {
|
||||||
}
|
return "plateCuttingMachineRecipe";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getGuiTexture() {
|
||||||
return "plateCuttingMachineRecipe";
|
return "techreborn:textures/gui/plate_cutting_machine.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture() {
|
public Class<? extends GuiContainer> getGuiClass() {
|
||||||
return "techreborn:textures/gui/plate_cutting_machine.png";
|
return GuiPlateCuttingMachine.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass() {
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||||
return GuiPlateCuttingMachine.class;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue