mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 20:22:12 +00:00
Got NEI working for SAG Mill and Alloy Furnace Recipes again.
This commit is contained in:
1 parent
8bedb1d424
commit
da2c946f48
9 files changed
+20
-125
No files matched your search
+1
-1
@@ -43,6 +43,7 @@ minecraft {
|
||||
|
||||
dependencies {
|
||||
compile files('lib/cglib-nodep-2.2.3.jar')
|
||||
compile files('lib/NeiStub172.jar')
|
||||
}
|
||||
|
||||
// configure the source folders
|
||||
@@ -50,7 +51,6 @@ sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java'
|
||||
exclude '**/enderio/nei/**'
|
||||
exclude '**/enderio/trigger/**'
|
||||
// exclude 'some exclusion'
|
||||
// include 'some inclusion'
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or
|
||||
* implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer(int itemID) {
|
||||
|
||||
super(itemID);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int itemID, int capacity) {
|
||||
|
||||
this(itemID, capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int itemID, int capacity, int maxTransfer) {
|
||||
|
||||
this(itemID, capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int itemID, int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
super(itemID);
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if(container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if(!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if(container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if(!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
if(container == null || container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -90,6 +90,9 @@ public class EnderIoRecipe implements IEnderIoRecipe {
|
||||
|
||||
@Override
|
||||
public boolean isOutput(ItemStack output) {
|
||||
if(output == null) {
|
||||
return false;
|
||||
}
|
||||
for (IRecipeComponent rc : outputs) {
|
||||
if(rc.isEquivalent(output)) {
|
||||
return true;
|
||||
|
||||
@@ -38,8 +38,8 @@ public abstract class RecipeComponent implements IRecipeComponent {
|
||||
}
|
||||
|
||||
protected boolean isEqual(ItemStack left, ItemStack right) {
|
||||
if(left.isItemEqual(right)) {
|
||||
return left.stackTagCompound == null ? true : left.stackTagCompound.equals(right.stackTagCompound);
|
||||
if(left != null && left.isItemEqual(right)) {
|
||||
return left.stackTagCompound == null ? true : right.stackTagCompound != null && left.stackTagCompound.equals(right.stackTagCompound);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package crazypants.enderio.nei;
|
||||
|
||||
import static codechicken.core.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.core.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -56,6 +53,10 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
|
||||
if(result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<IEnderIoRecipe> recipes = RecipeReigistry.instance.getRecipesForOutput(IEnderIoRecipe.ALLOY_SMELTER_ID, result);
|
||||
|
||||
for (IEnderIoRecipe recipe : recipes) {
|
||||
@@ -103,8 +104,9 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
changeTexture(getGuiTexture());
|
||||
drawTexturedModalRect(0, 0, 5, 3, 166, 73);
|
||||
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 5, 3, 166, 73);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,7 +138,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, input);
|
||||
return getCycledIngredients(cycleticks / 20, input);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package crazypants.enderio.nei;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import crazypants.enderio.Config;
|
||||
@@ -14,14 +15,15 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
API.registerRecipeHandler(new SagMillRecipeHandler());
|
||||
API.registerUsageHandler(new AlloySmelterRecipeHandler());
|
||||
API.registerUsageHandler(new SagMillRecipeHandler());
|
||||
//TODO:
|
||||
API.setGuiOffset(GuiAlloySmelter.class, 5, 3);
|
||||
API.hideItem(EnderIO.blockConduitFacade.blockID);
|
||||
API.hideItem(EnderIO.itemEnderface.itemID);
|
||||
API.hideItem(new ItemStack(EnderIO.blockConduitFacade));
|
||||
API.hideItem(new ItemStack(EnderIO.itemEnderface));
|
||||
if(!Config.photovoltaicCellEnabled) {
|
||||
API.hideItem(EnderIO.blockSolarPanel.blockID);
|
||||
API.hideItem(new ItemStack(EnderIO.blockSolarPanel));
|
||||
}
|
||||
if(!Config.travelAnchorEnabled) {
|
||||
API.hideItem(EnderIO.itemTravelStaff.itemID);
|
||||
API.hideItem(new ItemStack(EnderIO.itemTravelStaff));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user