Moved some of stuff into core

This commit is contained in:
Calclavia 2014-01-11 17:22:03 +08:00
parent 66003e793a
commit 68e9b95ffb
60 changed files with 87 additions and 1133 deletions

View file

@ -1,167 +0,0 @@
package dark.lib.prefab.invgui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import universalelectricity.api.vector.Vector2;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public abstract class GuiBase extends GuiScreen
{
protected Vector2 c;
protected Vector2 guiSize = new Vector2(176, 166);
/** Adds the buttons (and other controls) to the screen in question. */
@Override
public void initGui()
{
super.initGui();
c = new Vector2((this.width - this.guiSize.intX()) / 2, (this.height - this.guiSize.intY()) / 2);
}
/** Draws the screen and all the components in it. */
@Override
public void drawScreen(int par1, int par2, float par3)
{
this.drawDefaultBackground();
int var4 = (int) this.c.x;
int var5 = (int) this.c.y;
this.drawBackgroundLayer(par1, par2, par3);
GL11.glPushMatrix();
GL11.glTranslatef(var4, var5, 0.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
short var7 = 240;
short var8 = 240;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var7 / 1.0F, var8 / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.drawForegroundLayer(par1, par2, par3);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPopMatrix();
super.drawScreen(par1, par2, par3);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
/** Draws the foreground layer for the GUI */
protected abstract void drawForegroundLayer(int var2, int var3, float var1);
/** Draws the background layer for the GUI */
protected abstract void drawBackgroundLayer(int var2, int var3, float var1);
/** Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */
@Override
protected void keyTyped(char x, int y)
{
if (y == 1 || y == this.mc.gameSettings.keyBindInventory.keyCode)
{
this.mc.thePlayer.closeScreen();
}
}
/** Returns true if this GUI should pause the game when it is displayed in single-player */
@Override
public boolean doesGuiPauseGame()
{
return false;
}
/** Called from the main game loop to update the screen. */
@Override
public void updateScreen()
{
super.updateScreen();
if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead)
{
this.mc.thePlayer.closeScreen();
}
}
public void drawTooltip(int x, int y, String... toolTips)
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
if (toolTips != null)
{
int var5 = 0;
int var6;
int var7;
for (var6 = 0; var6 < toolTips.length; ++var6)
{
var7 = this.fontRenderer.getStringWidth(toolTips[var6]);
if (var7 > var5)
{
var5 = var7;
}
}
var6 = x + 12;
var7 = y - 12;
int var9 = 8;
if (toolTips.length > 1)
{
var9 += 2 + (toolTips.length - 1) * 10;
}
if (this.c.intY() + var7 + var9 + 6 > this.height)
{
var7 = this.height - var9 - this.c.intY() - 6;
}
this.zLevel = 300.0F;
int var10 = -267386864;
this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10);
this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10);
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10);
this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10);
this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10);
int var11 = 1347420415;
int var12 = (var11 & 16711422) >> 1 | var11 & -16777216;
this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12);
this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12);
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11);
this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
for (int var13 = 0; var13 < toolTips.length; ++var13)
{
String var14 = toolTips[var13];
this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
if (var13 == 0)
{
var7 += 2;
}
var7 += 10;
}
this.zLevel = 0.0F;
}
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
}
}

View file

@ -1,109 +0,0 @@
package dark.lib.prefab.invgui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
public class GuiMessageBox extends GuiBase
{
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.GUI_DIRECTORY + "gui_message_box.png");
GuiBase returnGuiYes, returnGuiNo;
int id;
String title;
String message;
public GuiMessageBox(GuiBase returnGui, int id, String title, String message)
{
this.guiSize.y = 380 / 2;
this.returnGuiYes = returnGui;
this.returnGuiNo = returnGui;
this.id = id;
this.title = title;
this.message = message;
}
public GuiMessageBox(GuiBase returnGui, GuiBase returnGuiNo, int id, String title, String message)
{
this(returnGui, id, title, message);
this.returnGuiNo = returnGuiNo;
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
super.initGui();
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, (this.width - this.guiSize.intX()) / 2 + 25, (this.height - this.guiSize.intY()) / 2 + 35, 50, 20, "Yes"));
this.buttonList.add(new GuiButton(1, (this.width - this.guiSize.intX()) / 2 + 80, (this.height - this.guiSize.intY()) / 2 + 35, 50, 20, "no"));
}
@Override
public void onGuiClosed()
{
super.onGuiClosed();
}
@Override
protected void actionPerformed(GuiButton button)
{
super.actionPerformed(button);
switch (button.id)
{
case 0:
this.exit(true);
break;
case 1:
this.exit(false);
break;
}
}
@Override
protected void drawForegroundLayer(int var2, int var3, float var1)
{
this.fontRenderer.drawString("" + this.title, (this.guiSize.intX() / 2 - 30), 5, 4210752);
this.fontRenderer.drawString("\u00a77" + this.message, ((this.guiSize.intX() / 2) - 50), 20, 4210752);
}
@Override
protected void drawBackgroundLayer(int var2, int var3, float var1)
{
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int containerWidth = (this.width - this.guiSize.intX()) / 2;
int containerHeight = (this.height - this.guiSize.intY()) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.guiSize.intX(), this.guiSize.intY());
}
public void show()
{
FMLCommonHandler.instance().showGuiScreen(this);
}
public void exit(boolean yes)
{
if (yes)
{
FMLCommonHandler.instance().showGuiScreen(this.returnGuiYes);
}
else
{
FMLCommonHandler.instance().showGuiScreen(this.returnGuiNo);
}
if (this.returnGuiYes instanceof IMessageBoxDialog)
{
((IMessageBoxDialog) this.returnGuiYes).onMessageBoxClosed(this.id, yes);
}
}
}

View file

@ -1,6 +0,0 @@
package dark.lib.prefab.invgui;
public interface IMessageBoxDialog
{
public void onMessageBoxClosed(int id, boolean yes);
}

View file

@ -1,17 +0,0 @@
package dark.lib.prefab.invgui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/** TileEntities that wish to do something if an item is removed from a slot */
public interface ISlotPickResult
{
/**
* If the slot in the gui does something if the item is removed
*
* @param entityPlayer - player who removed the item, will pass null from automation
* @param slot - slot in the container class the item came from
* @param itemStack - item stack pulled from the slot
*/
public void onPickUpFromSlot(EntityPlayer entityPlayer, int slot, ItemStack itemStack);
}

View file

@ -1,8 +0,0 @@
package dark.lib.prefab.invgui;
/** Add this to a container class if using WatchedSlot to trigger the container on slot change */
public interface ISlotWatcher
{
/** Will trigger if the watched slot has changed */
public void slotContentsChanged(int slot);
}

View file

@ -1,37 +0,0 @@
package dark.lib.prefab.invgui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
/** Easy class to create a slot that is used for an event trigger or crafting based event */
public class SlotCraftingResult extends WatchedSlot
{
private ISlotPickResult tile;
public SlotCraftingResult(ISlotPickResult tile, ISlotWatcher container, IInventory inventory, int par2, int par3, int par4)
{
super(inventory, par2, par3, par4, container);
this.tile = tile;
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
return false;
}
@Override
public boolean canTakeStack(EntityPlayer player)
{
return true;
}
/** When the slot has changed it calls @ISlotPickResult 's method */
@Override
public void onPickupFromSlot(EntityPlayer entityPlayer, ItemStack itemStack)
{
this.tile.onPickUpFromSlot(entityPlayer, this.slotNumber, itemStack);
super.onPickupFromSlot(entityPlayer, itemStack);
}
}

View file

@ -1,26 +0,0 @@
package dark.lib.prefab.invgui;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import universalelectricity.api.CompatibilityModule;
/**
* Slot designed to only allow batery like items
*
* @author DarkGuardsman
*/
public class SlotEnergyItem extends Slot
{
public SlotEnergyItem(IInventory inventory, int slotID, int xPos, int yPos)
{
super(inventory, slotID, xPos, yPos);
}
@Override
public boolean isItemValid(ItemStack compareStack)
{
return compareStack != null && CompatibilityModule.isHandler(compareStack.getItem());
}
}

View file

@ -1,92 +0,0 @@
package dark.lib.prefab.invgui;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
/**
* Creates a slot with a specific amount of items that matches the slot's requirements. Allows easy
* shift right clicking management and slot blocking in classes. In your container you can use
* this.getSlot(i).isItemValid to justify the player's shift clicking actions to match the slot.
*
* @author Calclavia
*/
public class SlotSpecific extends Slot
{
public ItemStack[] validItemStacks = new ItemStack[0];
public Class[] validClasses = new Class[0];
public boolean isInverted = false;
public boolean isMetadataSensitive = false;
public SlotSpecific(IInventory inventory, int slotID, int xPos, int yPos, ItemStack... itemStacks)
{
super(inventory, slotID, xPos, yPos);
this.setItemStacks(itemStacks);
}
public SlotSpecific(IInventory inventory, int slotID, int xPos, int yPos, Class... validClasses)
{
super(inventory, slotID, xPos, yPos);
this.setClasses(validClasses);
}
public SlotSpecific setMetadataSensitive()
{
this.isMetadataSensitive = true;
return this;
}
public SlotSpecific setItemStacks(ItemStack... validItemStacks)
{
this.validItemStacks = validItemStacks;
return this;
}
public SlotSpecific setClasses(Class... validClasses)
{
this.validClasses = validClasses;
return this;
}
public SlotSpecific toggleInverted()
{
this.isInverted = !this.isInverted;
return this;
}
/** Check if the stack is a valid item for this slot. Always true beside for the armor slots. */
@Override
public boolean isItemValid(ItemStack compareStack)
{
boolean returnValue = false;
for (ItemStack itemStack : this.validItemStacks)
{
if (compareStack.isItemEqual(itemStack) || (!this.isMetadataSensitive && compareStack.itemID == itemStack.itemID))
{
returnValue = true;
break;
}
}
if (!returnValue)
{
for (Class clazz : this.validClasses)
{
if (clazz.equals(compareStack.getItem().getClass()) || clazz.isInstance(compareStack.getItem()))
{
returnValue = true;
break;
}
}
}
if (this.isInverted)
{
return !returnValue;
}
return returnValue;
}
}

View file

@ -1,26 +0,0 @@
package dark.lib.prefab.invgui;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
/** A slot that triggers the container class if changed */
public class WatchedSlot extends Slot
{
private ISlotWatcher slotWatcher;
public WatchedSlot(IInventory inventory, int id, int xPosition, int yPosition, ISlotWatcher slotWatcher)
{
super(inventory, id, xPosition, yPosition);
this.slotWatcher = slotWatcher;
}
@Override
public void onSlotChanged()
{
if (this.slotWatcher != null)
{
this.slotWatcher.slotContentsChanged(this.slotNumber);
}
}
}

View file

@ -1,313 +0,0 @@
package dark.lib.recipes;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import resonantinduction.old.api.IProcessable;
import calclavia.lib.utility.AutoCraftingManager;
import com.builtbroken.common.Pair;
/**
* Recipes for ore processor machines
*
* @author DarkGuardsman
*/
public class MachineRecipeHandler
{
private static Random random = new Random();
static
{
newProcessorRecipe(ProcessorType.CRUSHER, Block.stone, Block.cobblestone);
newProcessorRecipe(ProcessorType.CRUSHER, Block.oreDiamond, Item.diamond);
newProcessorRecipe(ProcessorType.CRUSHER, Block.oreLapis, new ItemStack(Item.dyePowder.itemID, 4, 4));
newProcessorRecipe(ProcessorType.CRUSHER, Block.oreRedstone, new ItemStack(Item.redstone.itemID, 4, 0));
newProcessorRecipe(ProcessorType.CRUSHER, Block.oreEmerald, new ItemStack(Item.redstone.itemID, 4, 0));
newProcessorRecipe(ProcessorType.GRINDER, new ItemStack(Block.cobblestone.blockID, 1, 0), new ItemStack(Block.sand.blockID, 1, 0));
newProcessorRecipe(ProcessorType.GRINDER, Block.glass, Block.sand);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.stone, Block.cobblestone);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.cobblestoneMossy, Block.cobblestone);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.glass, Block.sand);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Item.stick, null);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.stone, Block.cobblestone);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.cobblestoneMossy, Block.cobblestone);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Item.stick, null);
// TODO replace these with ItemOreDirv glass shards
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.glass, Block.sand);
}
/**
* Creates a new recipe for the type of processor machine
*
* @param type - machine type
* @param in - input item, stacksize is ignored
* @param out - output item
*/
public static void newProcessorRecipe(ProcessorType type, Object in, Object out)
{
newProcessorRecipe(type, in, out, -1, -1);
}
/**
* Creates a new recipe for the type of processor machine
*
* @param type - machine type
* @param in - input item, stacksize is ignored
* @param out - output item
* @param min - min stacksize to return as output
* @param max- max stacksize to return as output
*/
public static void newProcessorRecipe(ProcessorType type, Object in, Object out, int min, int max)
{
newProcessorRecipe(type, in, out, min, max, false);
}
/**
* Creates a new recipe for the type of processor machine
*
* @param type - machine type
* @param in - input item, stacksize is ignored
* @param out - output item
* @param min - min stacksize to return as output
* @param max- max stacksize to return as output
* @param ignoreNBT - only use this if your item's nbt doesn't play a factor in what items were
* used to craft it
*/
public static void newProcessorRecipe(ProcessorType type, Object in, Object out, int min, int max, boolean ignoreNBT)
{
if (in != null && out != null && type != null)
{
ItemStack input = convertToItemStack(in);
ItemStack output = convertToItemStack(out);
if (input != null && output != null && type.recipes != null)
{
if (!ignoreNBT && (input.getTagCompound() != null || input.isItemEnchanted()))
{
System.out.println("[MachineRecipeHandler]Error: NBT or Enchanted Items must use the IProccesable interface to properlly handle recipe outputs.");
System.out.println("[MachineRecipeHandler]Item>> Data: " + input.toString() + " Name: " + input.getItem().getUnlocalizedName());
return;
}
if (min == -1)
{
min = output.stackSize;
}
if (max == -1 || max < min)
{
max = output.stackSize;
}
type.recipes.put(new Pair<Integer, Integer>(input.itemID, input.getItemDamage()), new ProcessorRecipe(output, min, max));
}
}
}
/** Used to track items that should be converted to different items during salvaging. */
public static void newAltProcessorOutput(ProcessorType type, Object in, Object out)
{
if (in != null && out != null && type != null)
{
ItemStack input = convertToItemStack(in);
ItemStack output = convertToItemStack(out);
if (input != null && output != null && type.altOutput != null)
{
type.altOutput.put(new Pair<Integer, Integer>(input.itemID, input.getItemDamage()), output);
}
}
}
/** Marks an itemstack as unsalvagable by all processors */
public static void banProcessingOfItem(ItemStack stack)
{
if (stack != null)
{
for (ProcessorType type : ProcessorType.values())
{
banProcessingOfItem(type, stack);
}
}
}
/**
* Marks an itemstack as unusable by processors. This will jam the processor if the item enters
* it
*/
public static void banProcessingOfItem(ProcessorType type, ItemStack stack)
{
if (type != null && stack != null)
{
type.banList.add(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage()));
}
}
/** Converts an object input into an itemstack for use */
private static ItemStack convertToItemStack(Object object)
{
if (object instanceof ItemStack)
{
ItemStack stack = (ItemStack) object;
if (stack.getItemDamage() < 0)
{
stack.setItemDamage(0);
}
return stack;
}
if (object instanceof Block)
{
return new ItemStack(((Block) object).blockID, 1, -1);
}
if (object instanceof Item)
{
return new ItemStack(((Item) object).itemID, 1, -1);
}
return null;
}
/**
* Gets the lit of items that are created from the input item stack. General this will be an
* array of one item. However, in salavaging cases it can be up to 8 items.
*
* @param type - Processor type
* @param inputStack - item stack input ignores stacksize
* @return array of itemStacks
*/
public static ItemStack[] getProcessorOutput(ProcessorType type, ItemStack inputStack)
{
if (inputStack != null && type != null)
{
ItemStack[] reList = null;
if (inputStack.getItem() instanceof IProcessable)
{
if (!((IProcessable) inputStack.getItem()).canProcess(type, inputStack))
{
return null;
}
reList = ((IProcessable) inputStack.getItem()).getProcesserOutput(type, inputStack);
}
if (reList == null)
{
reList = getOuputNormal(type, inputStack);
}
if (reList == null)
{
// TODO Disabled due to bug and needs to be fixed to make the processors more
// functional
// reList = salvageItem(type, inputStack);
}
return reList;
}
return null;
}
/**
* Salvages an itemStack for the items used to craft it
*
* @param type - processor type used to determine damage results
* @param stack - itemStack being salvaged
* @return Array of all items salvaged
*/
public static ItemStack[] salvageItem(ProcessorType type, ItemStack stack)
{
return salvageItem(type, stack, true);
}
/**
* Salvages an itemStack for the items used to craft it
*
* @param type - processor type used to determine damage results
* @param stack - itemStack being salvaged
* @param damage - damage the output items. Eg ironIngot becomes ironDust, or ironScraps
* @return Array of all items salvaged
*/
public static ItemStack[] salvageItem(ProcessorType type, ItemStack stack, boolean damage)
{
float bar = 0.1f;
// Allow tools and armor to be salvaged but at a very low rate
if ((stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemTool) && stack.isItemDamaged())
{
bar = (stack.getItemDamage() / stack.getMaxDamage());
}
ItemStack[] reList = salvageItem(stack, bar);
if (damage && reList != null && type.altOutput != null)
{
for (int i = 0; i < reList.length; i++)
{
if (type.altOutput.containsKey(new Pair<Integer, Integer>(reList[i].itemID, reList[i].getItemDamage())))
{
reList[i] = convertToItemStack(type.altOutput.get(new Pair<Integer, Integer>(reList[i].itemID, reList[i].getItemDamage())));
}
}
}
return reList;
}
/**
* Salvages an itemStack for the items used to craft it
*
* @param stack - itemStack being salvaged
* @param bar - chance per item that the random must be above inorder to salvage the output
* @return Array of all items salvaged
*/
public static ItemStack[] salvageItem(ItemStack stack, float bar)
{
// TODO find a way around having to force recipe to be the same stack size of the salvage.
// Maybe percentage based salvaging or min stacksize from machine?
ItemStack[] recipeList = AutoCraftingManager.getReverseRecipe(stack.copy(), stack.stackSize);
if (recipeList != null)
{
ItemStack[] reList = new ItemStack[recipeList.length];
boolean items = false;
for (int i = 0; i < recipeList.length; i++)
{
if (random.nextFloat() >= bar)
{
reList[i] = recipeList[i].copy();
items = true;
if (recipeList[i].itemID < Block.blocksList.length && Block.blocksList[recipeList[i].itemID] != null && recipeList[i].getItemDamage() > 16)
{
reList[i].setItemDamage(0);
}
}
}
return items ? reList : null;
}
return null;
}
public static ItemStack[] getOuputNormal(ProcessorType type, ItemStack stack)
{
if (type.recipes != null)
{
ProcessorRecipe re = type.recipes.get(new Pair<Integer, Integer>(stack.itemID, -1));
if (re == null || re.output == null)
{
re = type.recipes.get(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage()));
}
if (type.altOutput != null && (re == null || re.output == null))
{
return new ItemStack[] { type.altOutput.get(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage())) };
}
if (re != null && re.output != null)
{
ItemStack output = re.output.copy();
output.stackSize = Math.min(re.maxItemsOut, re.minItemsOut + random.nextInt(re.minItemsOut));
if (re.chancePerItem < 1.0f)
{
}
return new ItemStack[] { output };
}
}
return null;
}
}

View file

@ -1,23 +0,0 @@
package dark.lib.recipes;
import net.minecraft.item.ItemStack;
/** Processor Recipe output Container. Input is controlled by the processor recipes class. */
public class ProcessorRecipe
{
/** Output of the recipe */
public ItemStack output;
/** Chance per item after the stack size has been calculated from min and max size */
public float chancePerItem = 1.0f;
/** Min the recipe can output */
public int minItemsOut = -1;
/** Max the recipe can output */
public int maxItemsOut = -1;
public ProcessorRecipe(ItemStack output, int min, int max)
{
this.output = output;
this.minItemsOut = min;
this.maxItemsOut = max;
}
}

View file

@ -1,30 +0,0 @@
package dark.lib.recipes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.minecraft.item.ItemStack;
import com.builtbroken.common.Pair;
/**
* Enum of machines that support a simple A -> B processor recipe format. More complex machine will
* have there own recipe handlers
*
* @author Darkguardsman
*/
public enum ProcessorType
{
/** Pistons that smash the object */
CRUSHER(),
/** Several disks that shred the item up */
GRINDER(),
/** Grinds the edge or surface of the item sharpening it */
SHARPENING_STONE(),
/** Breaks down an item carefully giving an almost complete output of item used to craft it */
SALVAGER();
public HashMap<Pair<Integer, Integer>, ProcessorRecipe> recipes = new HashMap();
public HashMap<Pair<Integer, Integer>, ItemStack> altOutput = new HashMap();
public List<Pair<Integer, Integer>> banList = new ArrayList();
}

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api;
package resonantinduction.api;
import java.util.HashMap;
import java.util.List;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api;
package resonantinduction.api;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.electrical.encoder.coding.IProgrammableMachine;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api;
package resonantinduction.api;
import java.util.List;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api;
package resonantinduction.api;
import java.util.List;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api;
package resonantinduction.api;
import net.minecraft.item.ItemStack;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api;
package resonantinduction.api;
/**
* Interface applied to the manipulator.

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api.fluid;
package resonantinduction.api.fluid;
import java.util.HashMap;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api.fluid;
package resonantinduction.api.fluid;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api.fluid;
package resonantinduction.api.fluid;
import java.util.Set;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api.fluid;
package resonantinduction.api.fluid;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.api.fluid;
package resonantinduction.api.fluid;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;

View file

@ -5,10 +5,10 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import dark.lib.prefab.invgui.ISlotWatcher;
import dark.lib.prefab.invgui.SlotCraftingResult;
import dark.lib.prefab.invgui.SlotSpecific;
import dark.lib.prefab.invgui.WatchedSlot;
import calclavia.lib.prefab.slot.ISlotWatcher;
import calclavia.lib.prefab.slot.SlotCraftingResult;
import calclavia.lib.prefab.slot.SlotSpecific;
import calclavia.lib.prefab.slot.SlotWatched;
public class ContainerEngineering extends Container implements ISlotWatcher
{
@ -26,14 +26,14 @@ public class ContainerEngineering extends Container implements ISlotWatcher
{
for (int y = 0; y < 3; y++)
{
this.addSlotToContainer(new WatchedSlot(this.tileEntity, y + x * 3, 9 + y * 18, 16 + x * 18, this));
this.addSlotToContainer(new SlotWatched(this.tileEntity, y + x * 3, 9 + y * 18, 16 + x * 18, this));
}
}
// Imprint Input for Imprinting
this.addSlotToContainer(new SlotSpecific(this.tileEntity, TileEngineering.IMPRINTER_MATRIX_START, 68, 34, ItemBlockFilter.class));
// Item to be imprinted
this.addSlotToContainer(new WatchedSlot(this.tileEntity, TileEngineering.IMPRINTER_MATRIX_START + 1, 92, 34, this));
this.addSlotToContainer(new SlotWatched(this.tileEntity, TileEngineering.IMPRINTER_MATRIX_START + 1, 92, 34, this));
// Result of Crafting/Imprinting
this.addSlotToContainer(new SlotCraftingResult(this.tileEntity, this, this.tileEntity, TileEngineering.IMPRINTER_MATRIX_START + 2, 148, 34));
@ -42,7 +42,7 @@ public class ContainerEngineering extends Container implements ISlotWatcher
{
for (int i = 0; i < 9; i++)
{
this.addSlotToContainer(new WatchedSlot(this.tileEntity, (i + ii * 9) + TileEngineering.INVENTORY_START, 8 + i * 18, 80 + ii * 18, this));
this.addSlotToContainer(new SlotWatched(this.tileEntity, (i + ii * 9) + TileEngineering.INVENTORY_START, 8 + i * 18, 80 + ii * 18, this));
}
}
@ -53,13 +53,13 @@ public class ContainerEngineering extends Container implements ISlotWatcher
{
for (int var4 = 0; var4 < 9; ++var4)
{
this.addSlotToContainer(new WatchedSlot(inventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 120 + var3 * 18, this));
this.addSlotToContainer(new SlotWatched(inventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 120 + var3 * 18, this));
}
}
for (var3 = 0; var3 < 9; ++var3)
{
this.addSlotToContainer(new WatchedSlot(inventoryPlayer, var3, 8 + var3 * 18, 178, this));
this.addSlotToContainer(new SlotWatched(inventoryPlayer, var3, 8 + var3 * 18, 178, this));
}
this.tileEntity.openChest();

View file

@ -10,11 +10,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import resonantinduction.api.IArmbot;
import resonantinduction.api.IArmbotUseable;
import resonantinduction.api.events.AutoCraftEvent;
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
import resonantinduction.old.api.IArmbot;
import resonantinduction.old.api.IArmbotUseable;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.prefab.slot.ISlotPickResult;
import calclavia.lib.prefab.tile.TileAdvanced;
import calclavia.lib.utility.AutoCraftingManager;
import calclavia.lib.utility.AutoCraftingManager.IAutoCrafter;
@ -22,8 +23,6 @@ import calclavia.lib.utility.LanguageUtility;
import com.builtbroken.common.Pair;
import dark.lib.prefab.invgui.ISlotPickResult;
public class TileEngineering extends TileAdvanced implements ISidedInventory, IArmbotUseable, ISlotPickResult, IAutoCrafter
{
public static final int IMPRINTER_MATRIX_START = 9;

View file

@ -8,9 +8,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import resonantinduction.api.IFilterable;
import resonantinduction.archaic.engineering.ItemBlockFilter;
import resonantinduction.core.prefab.tile.TileEntityFilterable;
import resonantinduction.old.api.IFilterable;
/**
* Extend this block class if a filter is allowed to be placed inside of this block.

View file

@ -19,7 +19,7 @@ import universalelectricity.api.vector.Vector3;
*
* @author DarkGuardsman
*/
public abstract class TileEntityAssembly extends TileEntityEnergyMachine implements INetworkEnergyPart
public abstract class TileAssembly extends TileEntityEnergyMachine implements INetworkEnergyPart
{
/** lowest value the network can update at */
public static int refresh_min_rate = 20;
@ -34,12 +34,12 @@ public abstract class TileEntityAssembly extends TileEntityEnergyMachine impleme
/** Random rate by which this tile updates its network connections */
private int updateTick = 1;
public TileEntityAssembly(long wattsPerTick)
public TileAssembly(long wattsPerTick)
{
super(wattsPerTick);
}
public TileEntityAssembly(long wattsPerTick, long maxEnergy)
public TileAssembly(long wattsPerTick, long maxEnergy)
{
super(wattsPerTick, maxEnergy);
}
@ -81,9 +81,9 @@ public abstract class TileEntityAssembly extends TileEntityEnergyMachine impleme
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tileEntity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
if (tileEntity instanceof TileEntityAssembly && ((TileEntityAssembly) tileEntity).canTileConnect(Connection.NETWORK, dir.getOpposite()))
if (tileEntity instanceof TileAssembly && ((TileAssembly) tileEntity).canTileConnect(Connection.NETWORK, dir.getOpposite()))
{
this.getTileNetwork().mergeNetwork(((TileEntityAssembly) tileEntity).getTileNetwork(), this);
this.getTileNetwork().mergeNetwork(((TileAssembly) tileEntity).getTileNetwork(), this);
connectedTiles.add(tileEntity);
}
}

View file

@ -5,11 +5,11 @@ import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.IFilterable;
import resonantinduction.archaic.engineering.ItemBlockFilter;
import resonantinduction.old.api.IFilterable;
import calclavia.lib.prefab.tile.IRotatable;
public abstract class TileEntityFilterable extends TileEntityAssembly implements IRotatable, IFilterable
public abstract class TileEntityFilterable extends TileAssembly implements IRotatable, IFilterable
{
private ItemStack filterItem;
private boolean inverted;

View file

@ -1,6 +1,6 @@
package resonantinduction.core.tilenetwork.prefab;
import resonantinduction.core.prefab.tile.TileEntityAssembly;
import resonantinduction.core.prefab.tile.TileAssembly;
import resonantinduction.core.tilenetwork.INetworkPart;
public class NetworkAssembly extends NetworkSharedPower
@ -31,10 +31,10 @@ public class NetworkAssembly extends NetworkSharedPower
this.lastUpdateTime = System.currentTimeMillis();
for (INetworkPart part : this.getMembers())
{
if (part instanceof TileEntityAssembly)
if (part instanceof TileAssembly)
{
networkPartEnergyRequest += ((TileEntityAssembly) part).getWattLoad();
networkPartEnergyRequest += ((TileEntityAssembly) part).getExtraLoad();
networkPartEnergyRequest += ((TileAssembly) part).getWattLoad();
networkPartEnergyRequest += ((TileAssembly) part).getExtraLoad();
}
}
}
@ -44,7 +44,7 @@ public class NetworkAssembly extends NetworkSharedPower
@Override
public boolean isValidMember(INetworkPart part)
{
return super.isValidMember(part) && part instanceof TileEntityAssembly;
return super.isValidMember(part) && part instanceof TileAssembly;
}
}

View file

@ -1,7 +1,7 @@
package resonantinduction.electrical.armbot;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.encoder.coding.IProgrammableMachine;
import resonantinduction.old.api.IArmbot;
public abstract class TaskBaseArmbot extends TaskBaseProcess
{

View file

@ -9,8 +9,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.IArmbot;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.prefab.tile.TileEntityAssembly;
import resonantinduction.core.prefab.tile.TileAssembly;
import resonantinduction.electrical.Electrical;
import resonantinduction.electrical.armbot.command.TaskDrop;
import resonantinduction.electrical.armbot.command.TaskGOTO;
@ -20,7 +21,6 @@ import resonantinduction.electrical.armbot.command.TaskRotateTo;
import resonantinduction.electrical.encoder.coding.IProgram;
import resonantinduction.electrical.encoder.coding.ProgramHelper;
import resonantinduction.mechanical.encoder.ItemDisk;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector2;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.multiblock.link.IBlockActivate;
@ -37,7 +37,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock, IArmbot, IBlockActivate
public class TileEntityArmbot extends TileAssembly implements IMultiBlock, IArmbot, IBlockActivate
{
protected int ROTATION_SPEED = 6;

View file

@ -7,10 +7,10 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.ITask;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.utility.HelperMethods;

View file

@ -1,8 +1,8 @@
package resonantinduction.electrical.armbot.command;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector2;
public class TaskDrop extends TaskBaseArmbot

View file

@ -9,10 +9,10 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.args.ArgumentFloatData;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.common.Pair;

View file

@ -8,11 +8,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.IProgrammableMachine;
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector2;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.utility.InvInteractionHelper;

View file

@ -8,10 +8,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import resonantinduction.api.EntityDictionary;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
import resonantinduction.old.api.EntityDictionary;
import resonantinduction.old.api.IArmbot;
public class TaskGrabEntity extends TaskGrabPrefab
{

View file

@ -6,9 +6,9 @@ import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
import resonantinduction.old.api.IArmbot;
import com.builtbroken.common.science.units.UnitHelper;

View file

@ -2,9 +2,9 @@ package resonantinduction.electrical.armbot.command;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.IArmbot;
import resonantinduction.api.IBelt;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.old.api.IArmbot;
import resonantinduction.old.api.IBelt;
import universalelectricity.api.vector.Vector2;
import universalelectricity.api.vector.Vector3;

View file

@ -6,9 +6,9 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.IPlantable;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector3;
/**

View file

@ -3,10 +3,10 @@ package resonantinduction.electrical.armbot.command;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector2;
import calclavia.lib.utility.MathUtility;

View file

@ -3,10 +3,10 @@ package resonantinduction.electrical.armbot.command;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector2;
import calclavia.lib.utility.MathUtility;

View file

@ -8,10 +8,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.IArmbot;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
import resonantinduction.old.api.IArmbot;
import universalelectricity.api.vector.Vector2;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.utility.InvInteractionHelper;

View file

@ -5,12 +5,12 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import resonantinduction.api.IArmbot;
import resonantinduction.api.IArmbotUseable;
import resonantinduction.electrical.armbot.TaskBaseArmbot;
import resonantinduction.electrical.armbot.TaskBaseProcess;
import resonantinduction.electrical.encoder.coding.IProcessTask;
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
import resonantinduction.old.api.IArmbot;
import resonantinduction.old.api.IArmbotUseable;
import com.builtbroken.common.science.units.UnitHelper;

View file

@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import resonantinduction.old.api.IArmbot;
import resonantinduction.api.IArmbot;
/**
* Used to both register task and fake machines for the encoder to use to create new programs.

View file

@ -10,10 +10,10 @@ import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.IBelt;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.prefab.tile.TileEntityAssembly;
import resonantinduction.core.prefab.tile.TileAssembly;
import resonantinduction.mechanical.Mechanical;
import resonantinduction.old.api.IBelt;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.prefab.tile.IRotatable;
@ -26,7 +26,7 @@ import cpw.mods.fml.common.network.Player;
*
* @author DarkGuardsman
*/
public class TileConveyorBelt extends TileEntityAssembly implements IBelt, IRotatable
public class TileConveyorBelt extends TileAssembly implements IBelt, IRotatable
{
public enum SlantType
@ -231,14 +231,14 @@ public class TileConveyorBelt extends TileEntityAssembly implements IBelt, IRota
}
front = face.getTileEntity(this.worldObj);
rear = back.getTileEntity(this.worldObj);
if (front instanceof TileEntityAssembly)
if (front instanceof TileAssembly)
{
this.getTileNetwork().mergeNetwork(((TileEntityAssembly) front).getTileNetwork(), this);
this.getTileNetwork().mergeNetwork(((TileAssembly) front).getTileNetwork(), this);
this.connectedTiles.add(front);
}
if (rear instanceof TileEntityAssembly)
if (rear instanceof TileAssembly)
{
this.getTileNetwork().mergeNetwork(((TileEntityAssembly) rear).getTileNetwork(), this);
this.getTileNetwork().mergeNetwork(((TileAssembly) rear).getTileNetwork(), this);
this.connectedTiles.add(rear);
}

View file

@ -5,7 +5,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import dark.lib.prefab.invgui.SlotSpecific;
import calclavia.lib.prefab.slot.SlotSpecific;
public class ContainerEncoder extends Container
{

View file

@ -6,10 +6,10 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.INetworkPipe;
import resonantinduction.core.tilenetwork.ITileConnector;
import resonantinduction.mechanical.fluid.network.NetworkPipes;
import resonantinduction.mechanical.fluid.prefab.TileEntityFluidDevice;
import resonantinduction.old.api.fluid.INetworkPipe;
import calclavia.lib.utility.HelperMethods;
import dark.lib.interfaces.IReadOut;

View file

@ -6,9 +6,9 @@ import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.INetworkFluidPart;
import resonantinduction.core.tilenetwork.INetworkPart;
import resonantinduction.core.tilenetwork.prefab.NetworkUpdateHandler;
import resonantinduction.old.api.fluid.INetworkFluidPart;
import calclavia.lib.utility.FluidHelper;
/**

View file

@ -12,12 +12,12 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.INetworkFluidPart;
import resonantinduction.core.tilenetwork.INetworkPart;
import resonantinduction.core.tilenetwork.ITileNetwork;
import resonantinduction.core.tilenetwork.prefab.NetworkTileEntities;
import resonantinduction.core.tilenetwork.prefab.NetworkUpdateHandler;
import resonantinduction.mechanical.fluid.FluidCraftingHandler;
import resonantinduction.old.api.fluid.INetworkFluidPart;
import calclavia.lib.utility.FluidHelper;
public class NetworkFluidTiles extends NetworkTileEntities

View file

@ -7,9 +7,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.INetworkPipe;
import resonantinduction.core.tilenetwork.INetworkPart;
import resonantinduction.core.tilenetwork.prefab.NetworkUpdateHandler;
import resonantinduction.old.api.fluid.INetworkPipe;
import calclavia.lib.utility.FluidHelper;
/**

View file

@ -17,11 +17,14 @@ import net.minecraftforge.fluids.FluidStack;
import resonantinduction.mechanical.Mechanical;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
import resonantinduction.mechanical.fluid.tank.TileTank;
import universalelectricity.api.energy.UnitDisplay;
import universalelectricity.api.energy.UnitDisplay.Unit;
import universalelectricity.api.energy.UnitDisplay.UnitPrefix;
import universalelectricity.api.vector.Vector3;
public class ItemBlockPipe extends ItemBlock
public class ItemBlockFluidContainer extends ItemBlock
{
public ItemBlockPipe(int id)
public ItemBlockFluidContainer(int id)
{
super(id);
this.setMaxDamage(0);
@ -40,10 +43,11 @@ public class ItemBlockPipe extends ItemBlock
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
{
FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid"));
if (fluid != null)
{
list.add("Fluid: " + fluid.getFluid().getName());
list.add("Vol: " + fluid.amount);
list.add("Volume: " + UnitDisplay.getDisplay(fluid.amount, Unit.LITER, UnitPrefix.MILLI));
}
}
}
@ -91,7 +95,8 @@ public class ItemBlockPipe extends ItemBlock
{
return 1;
}
return this.getItemStackLimit();
return this.maxStackSize;
}
@Override

View file

@ -5,11 +5,11 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.INetworkPipe;
import resonantinduction.core.tilenetwork.ITileConnector;
import resonantinduction.core.tilenetwork.ITileNetwork;
import resonantinduction.mechanical.fluid.network.NetworkPipes;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
import resonantinduction.old.api.fluid.INetworkPipe;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.utility.FluidHelper;
import dark.lib.helpers.ColorCode;

View file

@ -20,14 +20,14 @@ import net.minecraftforge.fluids.FluidTankInfo;
import org.bouncycastle.util.Arrays;
import resonantinduction.api.fluid.FluidMasterList;
import resonantinduction.api.fluid.INetworkFluidPart;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.network.ISimplePacketReceiver;
import resonantinduction.core.tilenetwork.INetworkPart;
import resonantinduction.core.tilenetwork.ITileNetwork;
import resonantinduction.mechanical.fluid.network.NetworkFluidTiles;
import resonantinduction.mechanical.fluid.pipe.FluidContainerMaterial;
import resonantinduction.old.api.fluid.FluidMasterList;
import resonantinduction.old.api.fluid.INetworkFluidPart;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.PacketHandler;

View file

@ -15,10 +15,10 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.IDrain;
import resonantinduction.api.fluid.INetworkPipe;
import resonantinduction.core.tilenetwork.ITileConnector;
import resonantinduction.mechanical.fluid.network.NetworkFluidTiles;
import resonantinduction.old.api.fluid.IDrain;
import resonantinduction.old.api.fluid.INetworkPipe;
import universalelectricity.api.vector.Vector3;
import universalelectricity.api.vector.VectorHelper;

View file

@ -15,8 +15,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.IDrain;
import resonantinduction.mechanical.fluid.prefab.TileEntityFluidDevice;
import resonantinduction.old.api.fluid.IDrain;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.utility.FluidHelper;

View file

@ -10,9 +10,9 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.fluid.IDrain;
import resonantinduction.core.prefab.tile.TileEntityEnergyMachine;
import resonantinduction.core.tilenetwork.ITileConnector;
import resonantinduction.old.api.fluid.IDrain;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.utility.FluidHelper;

View file

@ -11,7 +11,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import resonantinduction.core.prefab.block.BlockRI;
import resonantinduction.mechanical.fluid.pipe.FluidContainerMaterial;
import resonantinduction.mechanical.fluid.pipe.ItemBlockPipe;
import resonantinduction.mechanical.fluid.pipe.ItemBlockFluidContainer;
import resonantinduction.mechanical.fluid.pipe.TilePipe;
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
import universalelectricity.api.vector.Vector3;
@ -114,7 +114,7 @@ public class BlockTank extends BlockRI
{
if (!world.isRemote)
{
ItemStack dropStack = ItemBlockPipe.getWrenchedItem(world, new Vector3(x, y, z));
ItemStack dropStack = ItemBlockFluidContainer.getWrenchedItem(world, new Vector3(x, y, z));
if (dropStack != null)
{
if (entityPlayer.getHeldItem() == null)

View file

@ -2,11 +2,11 @@ package resonantinduction.mechanical.fluid.tank;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.fluid.INetworkFluidPart;
import resonantinduction.core.tilenetwork.INetworkPart;
import resonantinduction.core.tilenetwork.ITileNetwork;
import resonantinduction.mechanical.fluid.network.NetworkFluidContainers;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
import resonantinduction.old.api.fluid.INetworkFluidPart;
public class TileTank extends TileFluidNetworkTile
{

View file

@ -1,27 +0,0 @@
package resonantinduction.old.api;
import net.minecraft.item.ItemStack;
import dark.lib.recipes.ProcessorType;
/**
* Simple interface that allows an item to control how its salvaged, processed, or refined by a
* processor. This is 100% optional as the processor by default can break down most items. The only
* reason to use this is for more complex processing or were the item was created with NBT.
*
* @author Darkgaurdsman
*/
public interface IProcessable
{
/** Can this item be Processed by the machine */
public boolean canProcess(ProcessorType type, ItemStack stack);
/**
* Gets the output array of items when this item is processed by a processor machine
*
* @param type - type of machine see ProcessorTypes enum for info
* @param stack - ItemStack of this item or block
* @return Array of all item outputed, Make sure to return less than or equal to the amount of
* items it takes to craft only one of this item
*/
public ItemStack[] getProcesserOutput(ProcessorType type, ItemStack stack);
}

View file

@ -1,169 +0,0 @@
package resonantinduction.old.core;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.oredict.OreDictionary;
import resonantinduction.api.events.LaserEvent;
import resonantinduction.core.Reference;
import resonantinduction.core.Settings;
import resonantinduction.core.prefab.item.ItemBase;
import calclavia.lib.content.IExtraInfo.IExtraItemInfo;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.lib.EnumMaterial;
import dark.lib.EnumOrePart;
/**
* A series of items that are derived from a basic material
*
* @author DarkGuardsman
*/
public class ItemOreDirv extends ItemBase implements IExtraItemInfo
{
public ItemOreDirv()
{
super("Metal_Parts", Settings.getNextItemID());
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTabs.tabMaterials);
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
if (itemStack != null)
{
return "item." + Reference.PREFIX + EnumOrePart.getFullName(itemStack.getItemDamage());
}
else
{
return this.getUnlocalizedName();
}
}
@Override
public Icon getIconFromDamage(int i)
{
return EnumMaterial.getIcon(i);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconRegister)
{
for (EnumMaterial mat : EnumMaterial.values())
{
mat.itemIcons = new Icon[EnumOrePart.values().length];
for (EnumOrePart part : EnumOrePart.values())
{
if (mat.shouldCreateItem(part))
{
mat.itemIcons[part.ordinal()] = iconRegister.registerIcon(Reference.PREFIX + mat.simpleName + part.simpleName);
}
}
}
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (EnumMaterial mat : EnumMaterial.values())
{
for (EnumOrePart part : EnumOrePart.values())
{
ItemStack stack = EnumMaterial.getStack(this, mat, part, 1);
if (stack != null && mat.shouldCreateItem(part) && mat.itemIcons[part.ordinal()] != null)
{
par3List.add(stack);
}
}
}
}
@Override
public boolean hasExtraConfigs()
{
return false;
}
@Override
public void loadExtraConfigs(Configuration config)
{
// TODO Auto-generated method stub
}
@Override
public void loadOreNames()
{
for (EnumMaterial mat : EnumMaterial.values())
{
// System.out.println(" [OrenameDebug]Mat:" + mat.simpleName);
for (EnumOrePart part : EnumOrePart.values())
{
if (mat.shouldCreateItem(part))
{
String name = mat.getOreName(part);
ItemStack stack = mat.getStack(this, part, 1);
// System.out.println(" [OrenameDebug]Name:" + name + " Stack:" +
// stack.toString());
OreDictionary.registerOre(name, stack);
}
}
}
}
@ForgeSubscribe
public void LaserSmeltEvent(LaserEvent.LaserDropItemEvent event)
{
if (event.items != null)
{
for (int i = 0; i < event.items.size(); i++)
{
if (event.items.get(i).itemID == Block.blockIron.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9));
}
else if (event.items.get(i).itemID == Block.blockGold.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9));
}
else if (event.items.get(i).itemID == Block.oreIron.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
}
else if (event.items.get(i).itemID == Block.oreGold.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
}
String oreName = OreDictionary.getOreName(OreDictionary.getOreID(event.items.get(i)));
if (oreName != null)
{
for (EnumMaterial mat : EnumMaterial.values())
{
if (oreName.equalsIgnoreCase("ore" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ore"))
{
event.items.set(i, mat.getStack(this, EnumOrePart.MOLTEN, event.items.get(i).stackSize + 1 + event.world.rand.nextInt(3)));
break;
}
else if (oreName.equalsIgnoreCase("ingot" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ingot"))
{
event.items.set(i, mat.getStack(this, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
break;
}
}
}
}
}
}
}