Added Armbot disk

This commit is contained in:
Calclavia 2014-01-23 21:47:44 +08:00
parent d3535903ab
commit 07d53200d5
14 changed files with 34 additions and 226 deletions

View file

@ -6,15 +6,15 @@ import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInductionTabs; import resonantinduction.core.ResonantInductionTabs;
import resonantinduction.core.Settings; import resonantinduction.core.Settings;
/** @author AidanBrady */ /** @author Calclavia */
public class ItemBase extends Item public class ItemRI extends Item
{ {
public ItemBase(String name) public ItemRI(String name)
{ {
this(name, Settings.getNextItemID()); this(name, Settings.getNextItemID());
} }
public ItemBase(String name, int id) public ItemRI(String name, int id)
{ {
super(Settings.CONFIGURATION.get(Configuration.CATEGORY_ITEM, name, id).getInt(id)); super(Settings.CONFIGURATION.get(Configuration.CATEGORY_ITEM, name, id).getInt(id));
this.setCreativeTab(ResonantInductionTabs.CORE); this.setCreativeTab(ResonantInductionTabs.CORE);

View file

@ -6,7 +6,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import resonantinduction.core.prefab.item.ItemBase; import resonantinduction.core.prefab.item.ItemRI;
import resonantinduction.core.resource.ResourceGenerator; import resonantinduction.core.resource.ResourceGenerator;
import calclavia.lib.utility.LanguageUtility; import calclavia.lib.utility.LanguageUtility;
import calclavia.lib.utility.nbt.NBTUtility; import calclavia.lib.utility.nbt.NBTUtility;
@ -19,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* @author Calclavia * @author Calclavia
* *
*/ */
public class ItemOreResource extends ItemBase public class ItemOreResource extends ItemRI
{ {
public ItemOreResource(int id, String name) public ItemOreResource(int id, String name)
{ {

View file

@ -9,7 +9,7 @@ import net.minecraft.util.Icon;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import resonantinduction.core.Settings; import resonantinduction.core.Settings;
import resonantinduction.core.prefab.item.ItemBase; import resonantinduction.core.prefab.item.ItemRI;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -17,7 +17,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* allow new crafting recipes to be created. * allow new crafting recipes to be created.
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
public class ItemParts extends ItemBase public class ItemParts extends ItemRI
{ {
public ItemParts() public ItemParts()
{ {

View file

@ -22,6 +22,7 @@ import resonantinduction.electrical.battery.BlockBattery;
import resonantinduction.electrical.battery.ItemBlockBattery; import resonantinduction.electrical.battery.ItemBlockBattery;
import resonantinduction.electrical.battery.TileBattery; import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.encoder.BlockEncoder; import resonantinduction.electrical.encoder.BlockEncoder;
import resonantinduction.electrical.encoder.ItemDisk;
import resonantinduction.electrical.encoder.TileEncoder; import resonantinduction.electrical.encoder.TileEncoder;
import resonantinduction.electrical.furnace.BlockAdvancedFurnace; import resonantinduction.electrical.furnace.BlockAdvancedFurnace;
import resonantinduction.electrical.furnace.TileAdvancedFurnace; import resonantinduction.electrical.furnace.TileAdvancedFurnace;
@ -41,7 +42,6 @@ import resonantinduction.electrical.wire.ItemWire;
import resonantinduction.mechanical.process.BlockGrinderWheel; import resonantinduction.mechanical.process.BlockGrinderWheel;
import resonantinduction.mechanical.process.TileGrinderWheel; import resonantinduction.mechanical.process.TileGrinderWheel;
import resonantinduction.mechanical.process.TilePurifier; import resonantinduction.mechanical.process.TilePurifier;
import universalelectricity.api.CompatibilityModule;
import calclavia.lib.content.ContentRegistry; import calclavia.lib.content.ContentRegistry;
import calclavia.lib.network.PacketHandler; import calclavia.lib.network.PacketHandler;
import calclavia.lib.recipe.UniversalRecipe; import calclavia.lib.recipe.UniversalRecipe;
@ -122,6 +122,7 @@ public class Electrical
blockEMLevitator = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class); blockEMLevitator = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class);
blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class); blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class);
blockEncoder = contentRegistry.createTile(BlockEncoder.class, TileEncoder.class); blockEncoder = contentRegistry.createTile(BlockEncoder.class, TileEncoder.class);
itemDisk = contentRegistry.createItem(ItemDisk.class);
// Machines // Machines
blockMachinePart = contentRegistry.createBlock(BlockMachinePart.class); blockMachinePart = contentRegistry.createBlock(BlockMachinePart.class);

View file

@ -1,92 +0,0 @@
package resonantinduction.electrical.encoder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import calclavia.lib.prefab.slot.SlotSpecific;
public class ContainerEncoder extends Container
{
public static final int Y_OFFSET = 0;
private ItemStack[] containingItems = new ItemStack[1];
private TileEncoder tileEntity;
public ContainerEncoder(InventoryPlayer inventoryPlayer, TileEncoder encoder)
{
this.tileEntity = encoder;
// Disk
this.addSlotToContainer(new SlotSpecific(encoder, 0, 80, 24 + Y_OFFSET, ItemDisk.class));
int row;
// Player Inventory
for (row = 0; row < 3; ++row)
{
for (int slot = 0; slot < 9; ++slot)
{
this.addSlotToContainer(new Slot(inventoryPlayer, slot + row * 9 + 9, 8 + slot * 18, 97 + row * 8));
}
}
for (row = 0; row < 9; ++row)
{
this.addSlotToContainer(new Slot(inventoryPlayer, row, 8 + row * 18, 145));
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return this.tileEntity.isUseableByPlayer(player);
}
/** Called to transfer a stack from one inventory to the other eg. when shift clicking. */
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
{
ItemStack copyStack = null;
Slot slotObj = (Slot) this.inventorySlots.get(slot);
if (slotObj != null && slotObj.getHasStack())
{
ItemStack slotStack = slotObj.getStack();
copyStack = slotStack.copy();
if (slot >= 1)
{
if (this.getSlot(0).isItemValid(slotStack))
{
if (!this.mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
}
else if (!this.mergeItemStack(slotStack, this.containingItems.length, 37, false))
{
return null;
}
if (slotStack.stackSize == 0)
{
slotObj.putStack((ItemStack) null);
}
else
{
slotObj.onSlotChanged();
}
if (slotStack.stackSize == copyStack.stackSize)
{
return null;
}
slotObj.onPickupFromSlot(player, slotStack);
}
return copyStack;
}
}

View file

@ -5,22 +5,21 @@ import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInductionTabs; import resonantinduction.core.ResonantInductionTabs;
import resonantinduction.core.Settings;
import resonantinduction.core.prefab.item.ItemRI;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class ItemDisk extends Item public class ItemDisk extends ItemRI
{ {
public ItemDisk(int id) public ItemDisk()
{ {
super(id); super("disk");
this.setUnlocalizedName("disk");
this.setCreativeTab(ResonantInductionTabs.CORE);
this.setHasSubtypes(true); this.setHasSubtypes(true);
} }

View file

@ -2,93 +2,24 @@ package resonantinduction.electrical.encoder.gui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import resonantinduction.electrical.encoder.ItemDisk; import resonantinduction.electrical.encoder.ItemDisk;
import resonantinduction.electrical.encoder.TileEncoder; import resonantinduction.electrical.encoder.TileEncoder;
import calclavia.lib.gui.ContainerBase;
import calclavia.lib.prefab.slot.SlotSpecific; import calclavia.lib.prefab.slot.SlotSpecific;
public class ContainerEncoder extends Container public class ContainerEncoder extends ContainerBase
{ {
public static final int Y_OFFSET = 0;
private ItemStack[] containingItems = new ItemStack[1]; private ItemStack[] containingItems = new ItemStack[1];
private TileEncoder tileEntity; private TileEncoder tileEntity;
public ContainerEncoder(InventoryPlayer inventoryPlayer, TileEncoder encoder) public ContainerEncoder(InventoryPlayer inventoryPlayer, TileEncoder encoder)
{ {
super(encoder);
this.tileEntity = encoder; this.tileEntity = encoder;
// Disk // Disk
this.addSlotToContainer(new SlotSpecific(encoder, 0, 80, 24 + Y_OFFSET, ItemDisk.class)); addSlotToContainer(new SlotSpecific(encoder, 0, 80, 24, ItemDisk.class));
addPlayerInventory(inventoryPlayer.player);
int row;
// Player Inventory
for (row = 0; row < 3; ++row)
{
for (int slot = 0; slot < 9; ++slot)
{
this.addSlotToContainer(new Slot(inventoryPlayer, slot + row * 9 + 9, 8 + slot * 18, 97 + row * 8));
}
}
for (row = 0; row < 9; ++row)
{
this.addSlotToContainer(new Slot(inventoryPlayer, row, 8 + row * 18, 145));
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return this.tileEntity.isUseableByPlayer(player);
}
/** Called to transfer a stack from one inventory to the other eg. when shift clicking. */
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
{
ItemStack copyStack = null;
Slot slotObj = (Slot) this.inventorySlots.get(slot);
if (slotObj != null && slotObj.getHasStack())
{
ItemStack slotStack = slotObj.getStack();
copyStack = slotStack.copy();
if (slot >= 1)
{
if (this.getSlot(0).isItemValid(slotStack))
{
if (!this.mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
}
else if (!this.mergeItemStack(slotStack, this.containingItems.length, 37, false))
{
return null;
}
if (slotStack.stackSize == 0)
{
slotObj.putStack((ItemStack) null);
}
else
{
slotObj.onSlotChanged();
}
if (slotStack.stackSize == copyStack.stackSize)
{
return null;
}
slotObj.onPickupFromSlot(player, slotStack);
}
return copyStack;
} }
} }

View file

@ -12,7 +12,7 @@ import resonantinduction.electrical.encoder.TileEncoder;
public class GuiEncoderCoder extends GuiEncoderBase public class GuiEncoderCoder extends GuiEncoderBase
{ {
private GuiTaskList taskListGui; private GuiEncoderTaskList taskListGui;
GuiButtonImage left, right, up, down; GuiButtonImage left, right, up, down;
GuiButton newTask, newTask2; GuiButton newTask, newTask2;
String helpMessage = ""; String helpMessage = "";
@ -79,7 +79,7 @@ public class GuiEncoderCoder extends GuiEncoderBase
} }
} }
protected GuiTaskList getTaskListElement(boolean renew) protected GuiEncoderTaskList getTaskListElement(boolean renew)
{ {
if (taskListGui == null || renew) if (taskListGui == null || renew)
{ {
@ -90,7 +90,7 @@ public class GuiEncoderCoder extends GuiEncoderBase
} }
else else
{ {
taskListGui = new GuiTaskList(this.tileEntity, this, this.containerWidth + 25, this.containerHeight + 15); taskListGui = new GuiEncoderTaskList(this.tileEntity, this, this.containerWidth + 25, this.containerHeight + 15);
} }
} }
return this.taskListGui; return this.taskListGui;
@ -144,7 +144,7 @@ public class GuiEncoderCoder extends GuiEncoderBase
} }
} }
protected GuiTaskList getTaskListElement() protected GuiEncoderTaskList getTaskListElement()
{ {
return this.getTaskListElement(false); return this.getTaskListElement(false);
} }

View file

@ -18,7 +18,7 @@ import calclavia.lib.gui.IMessageBoxDialog;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
public class GuiEditTask extends GuiBase implements IMessageBoxDialog public class GuiEncoderEditTask extends GuiBase implements IMessageBoxDialog
{ {
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.GUI_DIRECTORY + "gui_task_edit.png"); public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.GUI_DIRECTORY + "gui_task_edit.png");
@ -30,7 +30,7 @@ public class GuiEditTask extends GuiBase implements IMessageBoxDialog
int getFocus = -1; int getFocus = -1;
boolean newTask = false; boolean newTask = false;
public GuiEditTask(GuiEncoderCoder gui, ITask task, boolean newTask) public GuiEncoderEditTask(GuiEncoderCoder gui, ITask task, boolean newTask)
{ {
this.newTask = newTask; this.newTask = newTask;
this.ySize = 380 / 2; this.ySize = 380 / 2;

View file

@ -1,16 +0,0 @@
package resonantinduction.electrical.encoder.gui;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import resonantinduction.core.Reference;
import resonantinduction.electrical.encoder.TileEncoder;
public class GuiEncoderHelp extends GuiEncoderBase
{
public static final ResourceLocation TEXTURE_CODE_BACK = new ResourceLocation(Reference.DOMAIN, Reference.GUI_DIRECTORY + "gui_encoder_coder.png");
public GuiEncoderHelp(InventoryPlayer player, TileEncoder tileEntity)
{
super(player, tileEntity);
}
}

View file

@ -20,18 +20,4 @@ public class GuiEncoderInventory extends GuiEncoderBase
{ {
super(inventoryPlayer, tileEntity, new ContainerEncoder(inventoryPlayer, tileEntity)); super(inventoryPlayer, tileEntity, new ContainerEncoder(inventoryPlayer, tileEntity));
} }
/** Draw the background layer for the GuiContainer (everything behind the items) */
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int x, int y)
{
super.drawGuiContainerBackgroundLayer(par1, x, y);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int containerWidth = (this.width - this.xSize) / 2;
int containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight - 10, 0, 0, this.xSize, this.ySize);
}
} }

View file

@ -22,7 +22,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
* *
* @author DarkGuardsman * @author DarkGuardsman
*/ */
public class GuiTaskList extends Gui implements IScroll public class GuiEncoderTaskList extends Gui implements IScroll
{ {
protected int scrollY = 0, scrollX; protected int scrollY = 0, scrollX;
@ -35,7 +35,7 @@ public class GuiTaskList extends Gui implements IScroll
int countX = 6, countY = 6; int countX = 6, countY = 6;
GuiEncoderCoder coder; GuiEncoderCoder coder;
public GuiTaskList(TileEntity entity, GuiEncoderCoder coder, int x, int y) public GuiEncoderTaskList(TileEntity entity, GuiEncoderCoder coder, int x, int y)
{ {
this.xPos = x; this.xPos = x;
this.yPos = y; this.yPos = y;
@ -168,11 +168,11 @@ public class GuiTaskList extends Gui implements IScroll
t.setPosition(task.getCol(), task.getRow()); t.setPosition(task.getCol(), task.getRow());
} }
FMLCommonHandler.instance().showGuiScreen(new GuiEditTask(this.coder, t, true)); FMLCommonHandler.instance().showGuiScreen(new GuiEncoderEditTask(this.coder, t, true));
} }
else else
{ {
FMLCommonHandler.instance().showGuiScreen(new GuiEditTask(this.coder, task, false)); FMLCommonHandler.instance().showGuiScreen(new GuiEncoderEditTask(this.coder, task, false));
} }
} }
} }

View file

@ -14,10 +14,10 @@ import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.IReadOut; import resonantinduction.api.IReadOut;
import resonantinduction.api.IReadOut.EnumTools; import resonantinduction.api.IReadOut.EnumTools;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import resonantinduction.core.prefab.item.ItemBase; import resonantinduction.core.prefab.item.ItemRI;
import calclavia.lib.utility.FluidUtility; import calclavia.lib.utility.FluidUtility;
public class ItemPipeGauge extends ItemBase public class ItemPipeGauge extends ItemRI
{ {
Icon pipeGuage; Icon pipeGuage;

View file

@ -89,9 +89,8 @@ tile.resonantinduction\:encoder.name=Encoder
tile.resonantinduction\:solarPanel.name=Solar Panel tile.resonantinduction\:solarPanel.name=Solar Panel
tile.resonantinduction\:generator.name=Electric Generator tile.resonantinduction\:generator.name=Electric Generator
## Items #Transport
item.resonantinduction\:quantumEntangler.name=Quantum Entangler item.resonantinduction\:disk.name=Program Disk
item.resonantinduction\:linker.name=Electrostatic Linker
## Energy ## Energy
item.resonantinduction\:wire.copper.name=Copper Wire item.resonantinduction\:wire.copper.name=Copper Wire