Merge branch 'master' of https://github.com/TechReborn/TechReborn
This commit is contained in:
commit
3605fa7f66
62 changed files with 1636 additions and 117 deletions
|
@ -44,8 +44,7 @@ public class Core {
|
|||
public static Core INSTANCE;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event)
|
||||
{
|
||||
public void preinit(FMLPreInitializationEvent event){
|
||||
INSTANCE = this;
|
||||
String path = event.getSuggestedConfigurationFile().getAbsolutePath()
|
||||
.replace(ModInfo.MOD_ID, "TechReborn");
|
||||
|
@ -55,8 +54,7 @@ public class Core {
|
|||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
public void init(FMLInitializationEvent event){
|
||||
// Register ModBlocks
|
||||
ModBlocks.init();
|
||||
// Register Fluids
|
||||
|
@ -86,8 +84,7 @@ public class Core {
|
|||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postinit(FMLPostInitializationEvent event)
|
||||
{
|
||||
public void postinit(FMLPostInitializationEvent event){
|
||||
// Has to be done here as Buildcraft registers there recipes late
|
||||
RecipeManager.init();
|
||||
//Has to be done after the recipes have been added
|
||||
|
@ -102,13 +99,9 @@ public class Core {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(
|
||||
ConfigChangedEvent.OnConfigChangedEvent cfgChange)
|
||||
{
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent cfgChange){
|
||||
if (cfgChange.modID.equals("TechReborn")) {
|
||||
ConfigTechReborn.Configs();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
|
|||
|
||||
public ArrayList<ItemStack> inputs;
|
||||
|
||||
public ArrayList<ItemStack> outputs;
|
||||
private ArrayList<ItemStack> outputs;
|
||||
|
||||
public String name;
|
||||
|
||||
|
@ -31,10 +31,20 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return (List<ItemStack>) outputs.clone();
|
||||
public ItemStack getOutput(int i) {
|
||||
return outputs.get(i).copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOutputsSize() {
|
||||
return outputs.size();
|
||||
}
|
||||
|
||||
public void addOutput(ItemStack stack){
|
||||
outputs.add(stack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return inputs;
|
||||
|
|
|
@ -18,11 +18,17 @@ public interface IBaseRecipeType {
|
|||
public List<ItemStack> getInputs();
|
||||
|
||||
/**
|
||||
* Use this to get all of the outputs
|
||||
* This gets the output form the array list
|
||||
*
|
||||
* @return the List of outputs
|
||||
* @return the output
|
||||
*/
|
||||
public List<ItemStack> getOutputs();
|
||||
public ItemStack getOutput(int i);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The ammount of outputs
|
||||
*/
|
||||
public int getOutputsSize();
|
||||
|
||||
/**
|
||||
* This is the name to check that the recipe is the one that should be used in
|
||||
|
|
|
@ -118,8 +118,8 @@ public class RecipeCrafter {
|
|||
for (IBaseRecipeType recipe : RecipeHanderer.getRecipeClassFromName(recipeName)) {
|
||||
if (recipe.canCraft(parentTile) && hasAllInputs(recipe)) {//This checks to see if it has all of the inputs
|
||||
boolean canGiveInvAll = true;
|
||||
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])) {
|
||||
for (int i = 0; i < recipe.getOutputsSize(); i++) {//This checks to see if it can fit all of the outputs
|
||||
if (!canFitStack(recipe.getOutput(i), outputSlots[i])) {
|
||||
canGiveInvAll = false;
|
||||
break;
|
||||
}
|
||||
|
@ -142,17 +142,17 @@ public class RecipeCrafter {
|
|||
}
|
||||
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
|
||||
boolean canGiveInvAll = true;
|
||||
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])) {
|
||||
for (int i = 0; i < currentRecipe.getOutputsSize(); i++) {//Checks to see if it can fit the output
|
||||
if (!canFitStack(currentRecipe.getOutput(i), outputSlots[i])) {
|
||||
canGiveInvAll = false;
|
||||
}
|
||||
}
|
||||
ArrayList<Integer> filledSlots = new ArrayList<Integer>();//The slots that have been filled
|
||||
if (canGiveInvAll && currentRecipe.onCraft(parentTile)) {
|
||||
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {
|
||||
System.out.println(currentRecipe.getOutputs().get(i).stackSize);
|
||||
for (int i = 0; i < currentRecipe.getOutputsSize(); i++) {
|
||||
System.out.println(currentRecipe.getOutput(i).stackSize);
|
||||
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.getOutput(i).copy(), outputSlots[i]);//fills the slot with the output stack
|
||||
filledSlots.add(outputSlots[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@ public class AlloySmelterRecipe extends BaseRecipe {
|
|||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@ public class AssemblingMachineRecipe extends BaseRecipe {
|
|||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ public class CentrifugeRecipe extends BaseRecipe {
|
|||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
outputs.add(output2);
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
outputs.add(output3);
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
outputs.add(output4);
|
||||
addOutput(output4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@ public class ChemicalReactorRecipe extends BaseRecipe {
|
|||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ public class GrinderRecipe extends BaseRecipe {
|
|||
if( input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
outputs.add(output2);
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
outputs.add(output3);
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
outputs.add(output4);
|
||||
addOutput(output4);
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ public class ImplosionCompressorRecipe extends BaseRecipe {
|
|||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
outputs.add(output2);
|
||||
addOutput(output2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ public class IndustrialSawmillRecipe extends BaseRecipe {
|
|||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
outputs.add(output2);
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
outputs.add(output3);
|
||||
addOutput(output3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@ public class LatheRecipe extends BaseRecipe {
|
|||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@ public class PlateCuttingMachineRecipe extends BaseRecipe {
|
|||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
outputs.add(output1);
|
||||
addOutput(output1);
|
||||
}
|
||||
}
|
||||
|
|
68
src/main/java/techreborn/blocks/BlockDigitalChest.java
Normal file
68
src/main/java/techreborn/blocks/BlockDigitalChest.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileDigitalChest;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockDigitalChest extends BlockMachineBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockDigitalChest()
|
||||
{
|
||||
super(Material.rock);
|
||||
setBlockName("techreborn.digitalChest");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileDigitalChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.digitalChestID, world, x,
|
||||
y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/qchest_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/quantum_chest");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
}
|
|
@ -1,12 +1,16 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -102,4 +106,51 @@ public class BlockMachineBase extends BlockContainer {
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
protected void dropInventory(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack != null && itemStack.stackSize > 0)
|
||||
{
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -21,9 +18,27 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class BlockOre extends Block {
|
||||
|
||||
public static ItemStack getOreByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModBlocks.ore, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name)
|
||||
{
|
||||
return getOreByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar",
|
||||
"Sphalerite", "Tungston", "Sheldonite", "Peridot", "Sodalite",
|
||||
|
|
|
@ -21,6 +21,7 @@ import techreborn.client.container.ContainerMatterFabricator;
|
|||
import techreborn.client.container.ContainerPlateCuttingMachine;
|
||||
import techreborn.client.container.ContainerQuantumChest;
|
||||
import techreborn.client.container.ContainerQuantumTank;
|
||||
import techreborn.client.container.ContainerDigitalChest;
|
||||
import techreborn.client.container.ContainerRollingMachine;
|
||||
import techreborn.client.container.ContainerThermalGenerator;
|
||||
import techreborn.client.container.ContainerSemifluidGenerator;
|
||||
|
@ -43,6 +44,7 @@ import techreborn.client.gui.GuiMatterFabricator;
|
|||
import techreborn.client.gui.GuiPlateCuttingMachine;
|
||||
import techreborn.client.gui.GuiQuantumChest;
|
||||
import techreborn.client.gui.GuiQuantumTank;
|
||||
import techreborn.client.gui.GuiDigitalChest;
|
||||
import techreborn.client.gui.GuiRollingMachine;
|
||||
import techreborn.client.gui.GuiThermalGenerator;
|
||||
import techreborn.client.gui.GuiSemifluidGenerator;
|
||||
|
@ -76,6 +78,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
public static final int chemicalReactorID = 20;
|
||||
public static final int semifluidGeneratorID = 21;
|
||||
public static final int gasTurbineID = 22;
|
||||
public static final int digitalChestID = 23;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
|
@ -97,6 +100,10 @@ public class GuiHandler implements IGuiHandler {
|
|||
{
|
||||
return new ContainerQuantumTank(
|
||||
(TileQuantumTank) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == digitalChestID)
|
||||
{
|
||||
return new ContainerDigitalChest(
|
||||
(TileDigitalChest) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == quantumChestID)
|
||||
{
|
||||
return new ContainerQuantumChest(
|
||||
|
@ -197,6 +204,10 @@ public class GuiHandler implements IGuiHandler {
|
|||
{
|
||||
return new GuiQuantumTank(player,
|
||||
(TileQuantumTank) world.getTileEntity(x, y, z));
|
||||
} else if (ID == digitalChestID)
|
||||
{
|
||||
return new GuiDigitalChest(player,
|
||||
(TileDigitalChest) world.getTileEntity(x, y, z));
|
||||
} else if (ID == quantumChestID)
|
||||
{
|
||||
return new GuiQuantumChest(player,
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotOutput;
|
||||
import techreborn.tiles.TileDigitalChest;
|
||||
|
||||
public class ContainerDigitalChest extends TechRebornContainer {
|
||||
public TileDigitalChest tileDigitalChest;
|
||||
public EntityPlayer player;
|
||||
|
||||
public ContainerDigitalChest(TileDigitalChest tileDigitalChest,
|
||||
EntityPlayer player)
|
||||
{
|
||||
super();
|
||||
this.tileDigitalChest = tileDigitalChest;
|
||||
this.player = player;
|
||||
|
||||
this.addSlotToContainer(new Slot(tileDigitalChest.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotOutput(tileDigitalChest.inventory, 1,
|
||||
80, 53));
|
||||
this.addSlotToContainer(new SlotFake(tileDigitalChest.inventory, 2, 59,
|
||||
42, false, false, Integer.MAX_VALUE));
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
49
src/main/java/techreborn/client/gui/GuiDigitalChest.java
Normal file
49
src/main/java/techreborn/client/gui/GuiDigitalChest.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import techreborn.client.container.ContainerDigitalChest;
|
||||
import techreborn.tiles.TileDigitalChest;
|
||||
|
||||
public class GuiDigitalChest extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/ThermalGenerator.png");
|
||||
|
||||
TileDigitalChest tile;
|
||||
|
||||
public GuiDigitalChest(EntityPlayer player, TileDigitalChest tile)
|
||||
{
|
||||
super(new ContainerDigitalChest(tile, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.digitalChest.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
|
||||
if (tile.storedItem != null)
|
||||
this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10,
|
||||
30, 16448255);
|
||||
}
|
||||
}
|
|
@ -9,8 +9,8 @@ public class EmcValues {
|
|||
public static void init()
|
||||
{
|
||||
for(IBaseRecipeType recipeType : RecipeHanderer.recipeList){
|
||||
if(recipeType.getOutputs().size() == 1){
|
||||
RecipeRegistryProxy.addRecipe(recipeType.getOutputs().get(0), recipeType.getInputs());
|
||||
if(recipeType.getOutputsSize() == 1){
|
||||
RecipeRegistryProxy.addRecipe(recipeType.getOutput(0), recipeType.getInputs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class AlloySmelterRecipeHandler extends GenericRecipeHander implements IN
|
|||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
|
||||
input.add(pStack2);
|
||||
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ public class AssemblingMachineRecipeHandler extends GenericRecipeHander implemen
|
|||
input.add(pStack2);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,23 +21,23 @@ public class CentrifugeRecipeHandler extends GenericRecipeHander implements INei
|
|||
input.add(pStack2);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 80 - offset, 5 - offset);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 80 - offset, 5 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 110 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 110 - offset, 35 - offset);
|
||||
outputs.add(pStack4);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 2) {
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 80 - offset, 65 - offset);
|
||||
if (recipeType.getOutputsSize() > 2) {
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutput(2), 80 - offset, 65 - offset);
|
||||
outputs.add(pStack5);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 3) {
|
||||
PositionedStack pStack6 = new PositionedStack(recipeType.getOutputs().get(3), 50 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 3) {
|
||||
PositionedStack pStack6 = new PositionedStack(recipeType.getOutput(3), 50 - offset, 35 - offset);
|
||||
outputs.add(pStack6);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public class ChemicalReactorRecipeHandler extends GenericRecipeHander implements
|
|||
input.add(pStack2);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 80 - offset, 51 - offset);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 80 - offset, 51 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,8 +113,8 @@ public abstract class GenericRecipeHander extends TemplateRecipeHandler {
|
|||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (IBaseRecipeType recipeType : RecipeHanderer.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
|
||||
for (ItemStack output : recipeType.getOutputs()) {
|
||||
if (ItemUtils.isItemEqual(output, result, true, false, true)) {
|
||||
for (int i = 0; i < recipeType.getOutputsSize(); i++) {
|
||||
if (ItemUtils.isItemEqual(recipeType.getOutput(i), result, true, false, true)) {
|
||||
addCached(recipeType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,23 +28,23 @@ public class GrinderRecipeHandler extends GenericRecipeHander implements INeiBas
|
|||
input.add(pStack2);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 2 - offset, 77 - offset);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 2 - offset, 77 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
if (recipeType.getInputs().size() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 2 - offset, 95 - offset);
|
||||
if (recipeType.getOutputsSize() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 2 - offset, 95 - offset);
|
||||
outputs.add(pStack4);
|
||||
}
|
||||
|
||||
if (recipeType.getInputs().size() > 2) {
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 4 - offset, 113 - offset);
|
||||
if (recipeType.getOutputsSize() > 2) {
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutput(2), 4 - offset, 113 - offset);
|
||||
outputs.add(pStack5);
|
||||
}
|
||||
|
||||
if (recipeType.getInputs().size() > 3) {
|
||||
PositionedStack pStack6 = new PositionedStack(recipeType.getOutputs().get(3), 5 - offset, 131 - offset);
|
||||
if (recipeType.getOutputsSize() > 3) {
|
||||
PositionedStack pStack6 = new PositionedStack(recipeType.getOutput(3), 5 - offset, 131 - offset);
|
||||
outputs.add(pStack6);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ public class ImplosionCompressorRecipeHandler extends GenericRecipeHander implem
|
|||
input.add(pStack2);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 93 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 93 - offset, 35 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 111 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 111 - offset, 35 - offset);
|
||||
outputs.add(pStack4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,18 +22,18 @@ public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implemen
|
|||
input.add(pStack2);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 84 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 84 - offset, 35 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 102 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 102 - offset, 35 - offset);
|
||||
outputs.add(pStack4);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 2) {
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 120 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 2) {
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutput(2), 120 - offset, 35 - offset);
|
||||
outputs.add(pStack5);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ public class LatheRecipeHandler extends GenericRecipeHander implements INeiBaseR
|
|||
input.add(pStack);
|
||||
}
|
||||
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ public class PlateCuttingMachineRecipeHandler extends GenericRecipeHander implem
|
|||
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);
|
||||
if (recipeType.getOutputsSize() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import techreborn.init.ModItems;
|
|||
import techreborn.util.CraftingHelper;
|
||||
import techreborn.util.LogHelper;
|
||||
import techreborn.util.RecipeRemover;
|
||||
import techreborn.items.ItemParts;
|
||||
|
||||
public class RecipesIC2 {
|
||||
public static ConfigTechReborn config;
|
||||
|
@ -106,6 +107,22 @@ public class RecipesIC2 {
|
|||
'C', "circuitBasic",
|
||||
'G', IC2Items.getItem("geothermalGenerator")});
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.Gasturbine),
|
||||
new Object[]
|
||||
{"IAI", "WGW", "IAI",
|
||||
'I', "plateInvar",
|
||||
'A', IC2Items.getItem("advancedCircuit"),
|
||||
'W', IC2Items.getItem("windMill"),
|
||||
'G', IC2Items.getItem("reinforcedGlass")});
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.Gasturbine),
|
||||
new Object[]
|
||||
{"IAI", "WGW", "IAI",
|
||||
'I', "plateAluminum",
|
||||
'A', IC2Items.getItem("advancedCircuit"),
|
||||
'W', IC2Items.getItem("windMill"),
|
||||
'G', IC2Items.getItem("reinforcedGlass")});
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.Semifluidgenerator),
|
||||
new Object[]
|
||||
{"III", "IHI", "CGC",
|
||||
|
@ -365,14 +382,55 @@ public class RecipesIC2 {
|
|||
'C', "circuitElite",
|
||||
'B', ModBlocks.HighAdvancedMachineBlock});
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.quantumTank),
|
||||
new Object[]
|
||||
{"EPE", "PCP", "EPE",
|
||||
'P', "platePlatinum",
|
||||
'E', "circuitMaster",
|
||||
'C', ModBlocks.quantumChest});
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.quantumChest),
|
||||
new Object[]
|
||||
{"DCD", "ATA", "DQD",
|
||||
'D', ItemParts.getPartByName("dataOrb"),
|
||||
'C', ItemParts.getPartByName("computerMonitor"),
|
||||
'A', ModBlocks.HighAdvancedMachineBlock,
|
||||
'Q', ModBlocks.digitalChest,
|
||||
'T', IC2Items.getItem("teleporter")});
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.digitalChest),
|
||||
new Object[]
|
||||
{"PPP", "PDP", "PCP",
|
||||
'P', "plateSteel",
|
||||
'D', ItemParts.getPartByName("dataOrb"),
|
||||
'C', ItemParts.getPartByName("computerMonitor")
|
||||
}
|
||||
);
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.digitalChest),
|
||||
new Object[]
|
||||
{"PPP", "PDP", "PCP",
|
||||
'P', "plateAluminum",
|
||||
'D', ItemParts.getPartByName("dataOrb"),
|
||||
'C', ItemParts.getPartByName("computerMonitor")
|
||||
}
|
||||
);
|
||||
|
||||
LogHelper.info("Added Expensive IC2 Recipes");
|
||||
}
|
||||
|
||||
public static void addShapedTrRecipes()
|
||||
{
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 40),
|
||||
new Object[]
|
||||
{ "PLP", "RGB", "PYP",
|
||||
'P', "plateAluminum",
|
||||
'L', "dyeLime",
|
||||
'R', "dyeRed",
|
||||
'G', "paneGlass",
|
||||
'B', "dyeBlue",
|
||||
'Y', Items.glowstone_dust});
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 6),
|
||||
new Object[]
|
||||
{ "EEE", "EAE", "EEE",
|
||||
|
|
|
@ -57,6 +57,7 @@ import techreborn.tiles.TileMachineCasing;
|
|||
import techreborn.tiles.TileMatterFabricator;
|
||||
import techreborn.tiles.TilePlateCuttingMachine;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
import techreborn.tiles.TileDigitalChest;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import techreborn.tiles.TileRollingMachine;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
|
@ -70,6 +71,7 @@ public class ModBlocks {
|
|||
public static Block thermalGenerator;
|
||||
public static Block quantumTank;
|
||||
public static Block quantumChest;
|
||||
public static Block digitalChest;
|
||||
public static Block centrifuge;
|
||||
public static Block RollingMachine;
|
||||
public static Block MachineCasing;
|
||||
|
@ -127,6 +129,10 @@ public class ModBlocks {
|
|||
GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class, "techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChestTR");
|
||||
|
||||
digitalChest = new BlockDigitalChest();
|
||||
GameRegistry.registerBlock(digitalChest, ItemBlockDigitalChest.class, "techreborn.digitalChest");
|
||||
GameRegistry.registerTileEntity(TileDigitalChest.class, "TileDigitalChestTR");
|
||||
|
||||
centrifuge = new BlockCentrifuge();
|
||||
GameRegistry.registerBlock(centrifuge, "techreborn.centrifuge");
|
||||
GameRegistry.registerTileEntity(TileCentrifuge.class, "TileCentrifugeTR");
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package techreborn.itemblocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileDigitalChest;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockDigitalChest extends ItemBlock {
|
||||
|
||||
public ItemBlockDigitalChest(Block p_i45328_1_)
|
||||
{
|
||||
super(p_i45328_1_);
|
||||
}
|
||||
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list,
|
||||
boolean par4)
|
||||
{
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
|
||||
list.add(stack.getTagCompound().getCompoundTag("tileEntity")
|
||||
.getInteger("storedQuantity")
|
||||
+ " items");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
|
||||
World world, int x, int y, int z, int side, float hitX, float hitY,
|
||||
float hitZ, int metadata)
|
||||
{
|
||||
if (!world.setBlock(x, y, z, ModBlocks.digitalChest, metadata, 3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == ModBlocks.digitalChest)
|
||||
{
|
||||
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player,
|
||||
stack);
|
||||
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
((TileDigitalChest) world.getTileEntity(x, y, z))
|
||||
.readFromNBTWithoutCoords(stack.getTagCompound()
|
||||
.getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -8,8 +8,26 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemCells extends ItemTR {
|
||||
public static ItemStack getCellByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.cells, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getCellByName(String name)
|
||||
{
|
||||
return getCellByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "Berylium", "biomass", "calciumCarbonate", "calcium", "carbon",
|
||||
"chlorine", "deuterium", "diesel", "ethanol", "glyceryl",
|
||||
|
|
|
@ -8,8 +8,26 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemCrushedOre extends Item {
|
||||
public static ItemStack getCrushedOreByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.crushedOre, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getCrushedOreByName(String name)
|
||||
{
|
||||
return getCrushedOreByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "Aluminum", "Ardite", "Bauxite", "Cadmium", "Cinnabar", "Cobalt", "DarkIron",
|
||||
"Indium", "Iridium", "Nickel", "Osmium", "Platinum",
|
||||
|
|
|
@ -8,8 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemDustTiny extends ItemTR {
|
||||
|
||||
public static ItemStack getTinyDustByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.tinyDusts, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getTinyDustByName(String name)
|
||||
{
|
||||
return getTinyDustByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "Almandine", "AluminumBrass", "Aluminum", "Alumite", "Andradite",
|
||||
"Antimony", "Ardite", "Ashes", "Basalt", "Bauxite", "Biotite",
|
||||
|
|
|
@ -8,8 +8,26 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemDusts extends ItemTR {
|
||||
public static ItemStack getDustByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.dusts, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getDustByName(String name)
|
||||
{
|
||||
return getDustByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "almandine", "aluminumBrass", "aluminum", "alumite", "andradite",
|
||||
"antimony", "ardite", "ashes", "basalt", "bauxite", "biotite",
|
||||
|
|
|
@ -8,8 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemDustsSmall extends ItemTR {
|
||||
|
||||
public static ItemStack getSmallDustByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.smallDusts, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getSmallDustByName(String name)
|
||||
{
|
||||
return getSmallDustByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "Almandine", "AluminumBrass", "Aluminum", "Alumite", "Andradite",
|
||||
"Antimony", "Ardite", "Ashes", "Basalt", "Bauxite", "Biotite",
|
||||
|
|
|
@ -8,8 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemGems extends Item {
|
||||
|
||||
public static ItemStack getGemByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.gems, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getGemByName(String name)
|
||||
{
|
||||
return getGemByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "ruby", "sapphire", "peridot", "redGarnet",
|
||||
"yellowGarnet" };
|
||||
|
|
|
@ -8,8 +8,26 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemIngots extends Item {
|
||||
public static ItemStack getIngotByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.ingots, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getIngotByName(String name)
|
||||
{
|
||||
return getIngotByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "aluminum", "antimony", "batteryAlloy", "redAlloy", "blueAlloy", "brass",
|
||||
"bronze", "cadmium", "chrome", "copper", "cupronickel", "electrum", "indium",
|
||||
|
|
|
@ -8,8 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemNuggets extends Item {
|
||||
|
||||
public static ItemStack getNuggetByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.nuggets, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getNuggetByName(String name)
|
||||
{
|
||||
return getNuggetByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "aluminum", "antimony", "brass", "bronze", "chrome", "copper",
|
||||
"electrum", "invar", "iridium", "iron", "lead",
|
||||
|
|
|
@ -8,8 +8,26 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemParts extends Item {
|
||||
public static ItemStack getPartByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.parts, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getPartByName(String name)
|
||||
{
|
||||
return getPartByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "advancedCircuitParts", "basicCircuitBoard", "advancedCircuitBoard", "processorCircuitBoard",
|
||||
"energyFlowCircuit", "dataControlCircuit", "dataOrb", "dataStorageCircuit",
|
||||
|
@ -20,7 +38,7 @@ public class ItemParts extends Item {
|
|||
"bronzeGear", "ironGear", "titaniumGear", "steelGear", "tungstensteelGear",
|
||||
"laserFocus", "ductTape", "lazuriteChunk", "iridiumAlloyIngot", "rockCutterBlade", "superconductor",
|
||||
"thoriumCell", "doubleThoriumCell", "quadThoriumCell", "plutoniumCell", "doublePlutoniumCell",
|
||||
"quadPlutoniumCell", "destructoPack", "iridiumNeutronReflector", "massHoleDevice" };
|
||||
"quadPlutoniumCell", "destructoPack", "iridiumNeutronReflector", "massHoleDevice", "computerMonitor" };
|
||||
|
||||
private IIcon[] textures;
|
||||
|
||||
|
|
|
@ -8,8 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemPlates extends ItemTR {
|
||||
|
||||
public static ItemStack getPlateByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.plate, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getPlateByName(String name)
|
||||
{
|
||||
return getPlateByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "aluminum", "batteryAlloy", "brass", "bronze", "carbon",
|
||||
"chrome", "copper", "diamond", "electrum", "emerald",
|
||||
|
|
|
@ -8,8 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemPurifiedCrushedOre extends Item {
|
||||
|
||||
public static ItemStack getPurifiedCrushedOreByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.purifiedCrushedOre, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getPurifiedCrushedOreByName(String name)
|
||||
{
|
||||
return getPurifiedCrushedOreByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "Aluminum", "Ardite", "Bauxite", "Cadmium", "Cinnabar", "Cobalt", "DarkIron",
|
||||
"Indium", "Iridium", "Nickel", "Osmium", "Platinum", "Pyrite", "Sphalerite",
|
||||
|
|
|
@ -8,8 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemRods extends Item {
|
||||
|
||||
public static ItemStack getRodByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.rods, count, index);
|
||||
}
|
||||
|
||||
public static ItemStack getRodByName(String name)
|
||||
{
|
||||
return getRodByName(name, 1);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "brass", "bronze", "copper", "electrum", "gold", "invar",
|
||||
"iridium", "iron", "lead", "nickel", "platinum",
|
||||
|
|
|
@ -2,12 +2,14 @@ package techreborn.tiles;
|
|||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import sun.awt.IconInfo;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.util.Inventory;
|
||||
|
||||
public class TileAlloyFurnace extends TileMachineBase implements IWrenchable {
|
||||
public class TileAlloyFurnace extends TileMachineBase implements IWrenchable , IInventory{
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(4, "TileAlloyFurnace", 64);
|
||||
|
@ -82,4 +84,64 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable {
|
|||
inventory.writeToNBT(tagCompound);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import ic2.api.energy.prefab.BasicSink;
|
|||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
|
@ -12,7 +13,7 @@ import techreborn.util.Inventory;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IEnergyTile {
|
||||
public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
|
@ -112,4 +113,64 @@ public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IE
|
|||
info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import ic2.api.energy.prefab.BasicSink;
|
|||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
|
@ -13,7 +14,7 @@ import techreborn.util.Inventory;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEnergyTile{
|
||||
public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory{
|
||||
|
||||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
|
@ -131,4 +132,64 @@ public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEn
|
|||
info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
}
|
|
@ -4,11 +4,12 @@ import ic2.api.energy.prefab.BasicSink;
|
|||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.util.Inventory;
|
||||
|
||||
public class TileChunkLoader extends TileMachineBase implements IWrenchable, IEnergyTile {
|
||||
public class TileChunkLoader extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public BasicSink energy;
|
||||
public Inventory inventory = new Inventory(1, "TileChunkLoader", 64);
|
||||
|
@ -88,4 +89,64 @@ public class TileChunkLoader extends TileMachineBase implements IWrenchable, IEn
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
291
src/main/java/techreborn/tiles/TileDigitalChest.java
Normal file
291
src/main/java/techreborn/tiles/TileDigitalChest.java
Normal file
|
@ -0,0 +1,291 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.util.Inventory;
|
||||
import techreborn.util.ItemUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileDigitalChest extends TileMachineBase implements IInventory,
|
||||
IWrenchable {
|
||||
|
||||
// Slot 0 = Input
|
||||
// Slot 1 = Output
|
||||
// Slot 2 = Fake Item
|
||||
|
||||
//TODO use long so we can have 9,223,372,036,854,775,807 items instead of 2,147,483,647
|
||||
int storage = 32767;
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileDigitalChest",
|
||||
storage);
|
||||
|
||||
public ItemStack storedItem;
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(!worldObj.isRemote){
|
||||
if (storedItem != null)
|
||||
{
|
||||
ItemStack fakeStack = storedItem.copy();
|
||||
fakeStack.stackSize = 1;
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else
|
||||
{
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
|
||||
if (getStackInSlot(0) != null)
|
||||
{
|
||||
if (storedItem == null)
|
||||
{
|
||||
storedItem = getStackInSlot(0);
|
||||
setInventorySlotContents(0, null);
|
||||
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0),
|
||||
true, true))
|
||||
{
|
||||
if (storedItem.stackSize <= Integer.MAX_VALUE
|
||||
- getStackInSlot(0).stackSize)
|
||||
{
|
||||
storedItem.stackSize += getStackInSlot(0).stackSize;
|
||||
decrStackSize(0, getStackInSlot(0).stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (storedItem != null && getStackInSlot(1) == null)
|
||||
{
|
||||
ItemStack itemStack = storedItem.copy();
|
||||
itemStack.stackSize = itemStack.getMaxStackSize();
|
||||
setInventorySlotContents(1, itemStack);
|
||||
storedItem.stackSize -= itemStack.getMaxStackSize();
|
||||
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true,
|
||||
true))
|
||||
{
|
||||
int wanted = getStackInSlot(1).getMaxStackSize()
|
||||
- getStackInSlot(1).stackSize;
|
||||
if (storedItem.stackSize >= wanted)
|
||||
{
|
||||
decrStackSize(1, -wanted);
|
||||
storedItem.stackSize -= wanted;
|
||||
} else
|
||||
{
|
||||
decrStackSize(1, -storedItem.stackSize);
|
||||
storedItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncWithAll();
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord,
|
||||
this.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.readFromNBT(tagCompound);
|
||||
readFromNBTWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound)
|
||||
{
|
||||
inventory.readFromNBT(tagCompound);
|
||||
|
||||
storedItem = null;
|
||||
|
||||
if (tagCompound.hasKey("storedStack"))
|
||||
{
|
||||
storedItem = ItemStack
|
||||
.loadItemStackFromNBT((NBTTagCompound) tagCompound
|
||||
.getTag("storedStack"));
|
||||
}
|
||||
|
||||
if (storedItem != null)
|
||||
{
|
||||
storedItem.stackSize = tagCompound.getInteger("storedQuantity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
writeToNBTWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
public void writeToNBTWithoutCoords(NBTTagCompound tagCompound)
|
||||
{
|
||||
inventory.writeToNBT(tagCompound);
|
||||
if (storedItem != null)
|
||||
{
|
||||
tagCompound.setTag("storedStack",
|
||||
storedItem.writeToNBT(new NBTTagCompound()));
|
||||
tagCompound.setInteger("storedQuantity", storedItem.stackSize);
|
||||
} else
|
||||
tagCompound.setInteger("storedQuantity", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotId, int count)
|
||||
{
|
||||
return inventory.decrStackSize(slotId, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||
{
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||
{
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getFacing()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(short facing)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (entityPlayer.isSneaking())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
return getDropWithNBT();
|
||||
}
|
||||
|
||||
public ItemStack getDropWithNBT()
|
||||
{
|
||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
ItemStack dropStack = new ItemStack(ModBlocks.digitalChest, 1);
|
||||
writeToNBTWithoutCoords(tileEntity);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
dropStack.stackTagCompound.setTag("tileEntity", tileEntity);
|
||||
return dropStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWailaInfo(List<String> info)
|
||||
{
|
||||
super.addWailaInfo(info);
|
||||
int size = 0;
|
||||
String name = "of nothing";
|
||||
if (storedItem != null)
|
||||
{
|
||||
name = storedItem.getDisplayName();
|
||||
size += storedItem.stackSize;
|
||||
}
|
||||
if (getStackInSlot(1) != null)
|
||||
{
|
||||
name = getStackInSlot(1).getDisplayName();
|
||||
size += getStackInSlot(1).stackSize;
|
||||
}
|
||||
info.add(size + " " + name);
|
||||
|
||||
}
|
||||
}
|
|
@ -5,13 +5,14 @@ import ic2.api.energy.tile.IEnergyTile;
|
|||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.util.Inventory;
|
||||
|
||||
public class TileDragonEggSiphoner extends TileMachineBase implements IWrenchable, IEnergyTile {
|
||||
public class TileDragonEggSiphoner extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public BasicSource energy;
|
||||
public Inventory inventory = new Inventory(3, "TileAlloySmelter", 64);
|
||||
|
@ -110,4 +111,64 @@ public class TileDragonEggSiphoner extends TileMachineBase implements IWrenchabl
|
|||
energy.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -174,7 +174,11 @@ public class TileGasTurbine extends TileEntity implements IWrenchable,
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote){
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
energySource.updateEntity();
|
||||
if (tank.getFluidAmount() > 0
|
||||
&& energySource.getCapacity() - energySource.getEnergyStored() >= euTick)
|
||||
|
|
|
@ -4,6 +4,7 @@ import ic2.api.energy.prefab.BasicSink;
|
|||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
@ -16,7 +17,7 @@ import techreborn.util.FluidUtils;
|
|||
import techreborn.util.Inventory;
|
||||
import techreborn.util.Tank;
|
||||
|
||||
public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergyTile, IFluidHandler {
|
||||
public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergyTile, IFluidHandler, IInventory {
|
||||
|
||||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
|
@ -158,4 +159,64 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy
|
|||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import ic2.api.energy.prefab.BasicSink;
|
|||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
|
@ -12,7 +13,7 @@ import techreborn.util.Inventory;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileImplosionCompressor extends TileMachineBase implements IWrenchable, IEnergyTile {
|
||||
public class TileImplosionCompressor extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
|
@ -119,4 +120,64 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha
|
|||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import ic2.api.energy.prefab.BasicSink;
|
|||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
|
@ -12,7 +13,7 @@ import techreborn.util.Inventory;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileIndustrialSawmill extends TileMachineBase implements IWrenchable, IEnergyTile {
|
||||
public class TileIndustrialSawmill extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
|
@ -127,4 +128,64 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,14 @@ import ic2.api.energy.prefab.BasicSink;
|
|||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.util.Inventory;
|
||||
|
||||
public class TileMatterFabricator extends TileMachineBase implements IWrenchable, IEnergyTile {
|
||||
public class TileMatterFabricator extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
|
@ -96,4 +97,64 @@ public class TileMatterFabricator extends TileMachineBase implements IWrenchable
|
|||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import ic2.api.energy.tile.IEnergyTile;
|
|||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -14,7 +15,7 @@ import techreborn.util.Inventory;
|
|||
import techreborn.util.ItemUtils;
|
||||
|
||||
//TODO add tick and power bars.
|
||||
public class TileRollingMachine extends TileMachineBase implements IWrenchable, IEnergyTile {
|
||||
public class TileRollingMachine extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public BasicSink energy;
|
||||
public Inventory inventory = new Inventory(2, "TileRollingMachine", 64);
|
||||
|
@ -205,4 +206,64 @@ public class TileRollingMachine extends TileMachineBase implements IWrenchable,
|
|||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,25 +97,26 @@ public class TileSemifluidGenerator extends TileEntity implements IWrenchable,
|
|||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
int filled = tank.fill(resource, doFill);
|
||||
return filled;
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource,
|
||||
boolean doDrain)
|
||||
{
|
||||
FluidStack drained = tank.drain(resource.amount, doDrain);
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drained;
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drained;
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,20 +77,26 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable,
|
|||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
return tank.fill(resource, doFill);
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource,
|
||||
boolean doDrain)
|
||||
{
|
||||
return tank.drain(resource.amount, doDrain);
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return tank.drain(maxDrain, doDrain);
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,6 +59,9 @@ public class Tank extends FluidTank {
|
|||
}
|
||||
|
||||
public void compareAndUpdate() {
|
||||
if(tile.getWorldObj().isRemote){
|
||||
return;
|
||||
}
|
||||
FluidStack current = this.getFluid();
|
||||
if (current != null) {
|
||||
if (lastBeforeUpdate != null) {
|
||||
|
|
|
@ -6,6 +6,7 @@ tile.techreborn.industrialBlock.name=Industrial
|
|||
tile.techreborn.thermalGenerator.name=Thermal Generator
|
||||
tile.techreborn.quantumTank.name=Quantum Tank
|
||||
tile.techreborn.quantumChest.name=Quantum Chest
|
||||
tile.techreborn.digitalChest.name=Digital Chest
|
||||
tile.techreborn.centrifuge.name=Centrifuge
|
||||
tile.techreborn.rollingmachine.name=Rolling machine
|
||||
tile.techreborn.machineCasing.standard.name=Standard Machine Casing
|
||||
|
@ -636,6 +637,7 @@ item.techreborn.part.quadPlutoniumCell.name=Quad Fuel Rod (Plutonium)
|
|||
item.techreborn.part.destructoPack.name=Destructopack
|
||||
item.techreborn.part.iridiumNeutronReflector.name=Iridium Neutron Reflector
|
||||
item.techreborn.part.massHoleDevice.name=Mass Hole Device
|
||||
item.techreborn.part.computerMonitor.name=Computer Monitor
|
||||
|
||||
|
||||
#Tools
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 250 B |
Loading…
Reference in a new issue