v5.5.4 Beta #4
*Default minecraft ISidedInventory support in all machines. *Fancied up Universal Cable texture. *Electrolytic Separators and Bio-Generators use LiquidTanks instead of LiquidSlots. *Fixed IInventory support. *Fixed Universal Cable BuildCraft crash. *Added the Electric Pump, a machine that can pump any kind of liquid and automatically outputs into adjacent pipes.
This commit is contained in:
parent
96b4c4ec0b
commit
de3679def5
31 changed files with 768 additions and 49 deletions
BIN
bin/minecraft/mods/mekanism/gui/GuiElectricPump.png
Executable file
BIN
bin/minecraft/mods/mekanism/gui/GuiElectricPump.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
bin/minecraft/mods/mekanism/textures/blocks/ElectricPumpSide.png
Normal file
BIN
bin/minecraft/mods/mekanism/textures/blocks/ElectricPumpSide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -12,10 +12,14 @@ public class SideData
|
|||
/** How many slots this side contains */
|
||||
public int slotAmount;
|
||||
|
||||
public SideData(EnumColor colour, int start, int amount)
|
||||
/** Int[] of available side slots */
|
||||
public int[] availableSlots;
|
||||
|
||||
public SideData(EnumColor colour, int start, int amount, int[] slots)
|
||||
{
|
||||
color = colour;
|
||||
slotStart = start;
|
||||
slotAmount = amount;
|
||||
availableSlots = slots;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.TileEntityAdvancedElectricMachine;
|
||||
import mekanism.common.TileEntityControlPanel;
|
||||
import mekanism.common.TileEntityElectricMachine;
|
||||
import mekanism.common.TileEntityElectricPump;
|
||||
import mekanism.common.TileEntityEnergyCube;
|
||||
import mekanism.common.TileEntityGasTank;
|
||||
import mekanism.common.TileEntityMetallurgicInfuser;
|
||||
|
@ -140,6 +141,8 @@ public class ClientProxy extends CommonProxy
|
|||
return new GuiPurificationChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
||||
case 16:
|
||||
return new GuiEnergizedSmelter(player.inventory, (TileEntityElectricMachine)tileEntity);
|
||||
case 17:
|
||||
return new GuiElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
95
src/minecraft/mekanism/client/GuiElectricPump.java
Normal file
95
src/minecraft/mekanism/client/GuiElectricPump.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
package mekanism.client;
|
||||
|
||||
import mekanism.common.ContainerElectricPump;
|
||||
import mekanism.common.TileEntityElectricPump;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
public class GuiElectricPump extends GuiContainer
|
||||
{
|
||||
public TileEntityElectricPump tileEntity;
|
||||
|
||||
private int guiWidth;
|
||||
private int guiHeight;
|
||||
|
||||
public GuiElectricPump(InventoryPlayer inventory, TileEntityElectricPump tentity)
|
||||
{
|
||||
super(new ContainerElectricPump(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 94) + 2, 0x404040);
|
||||
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.liquidTank.getLiquid() != null ? tileEntity.liquidTank.getLiquidName() + ": " + tileEntity.liquidTank.getLiquid().amount : "No liquid.", 51, 35, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiElectricPump.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
guiWidth = (width - xSize) / 2;
|
||||
guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int displayInt;
|
||||
|
||||
displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
if(tileEntity.getScaledLiquidLevel(58) > 0)
|
||||
{
|
||||
displayGauge(guiWidth, guiHeight, 14, 7, tileEntity.getScaledLiquidLevel(58), tileEntity.liquidTank.getLiquid());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Credit to BuildCraft for both the gauge texture and parts of the code.
|
||||
*/
|
||||
public void displayGauge(int width, int height, int xPos, int yPos, int scale, LiquidStack liquid)
|
||||
{
|
||||
if(liquid == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int start = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
int renderRemaining = 0;
|
||||
|
||||
if(scale > 16)
|
||||
{
|
||||
renderRemaining = 16;
|
||||
scale -= 16;
|
||||
}
|
||||
else {
|
||||
renderRemaining = scale;
|
||||
scale = 0;
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(liquid.canonical().getTextureSheet());
|
||||
drawTexturedModelRectFromIcon(width + yPos, height + xPos + 58 - renderRemaining - start, liquid.canonical().getRenderingIcon(), 16, 16 - (16 - renderRemaining));
|
||||
start = start + 16;
|
||||
|
||||
if (renderRemaining == 0 || scale == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiElectricPump.png");
|
||||
drawTexturedModalRect(width + yPos, height + xPos, 176, 52, 16, 60);
|
||||
}
|
||||
}
|
|
@ -45,6 +45,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
* 9: Purification Chamber
|
||||
* 10: Energized Smelter
|
||||
* 11: Teleporter
|
||||
* 12: Electric Pump
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -100,6 +101,8 @@ public class BlockMachine extends BlockContainer implements IDismantleable
|
|||
icons[10][1] = register.registerIcon("mekanism:EnergizedSmelterFrontOn");
|
||||
icons[10][2] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[11][0] = register.registerIcon("mekanism:Teleporter");
|
||||
icons[12][0] = register.registerIcon("mekanism:ElectricPumpFront");
|
||||
icons[12][1] = register.registerIcon("mekanism:ElectricPumpSide");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -304,6 +307,16 @@ public class BlockMachine extends BlockContainer implements IDismantleable
|
|||
{
|
||||
return icons[11][0];
|
||||
}
|
||||
else if(meta == 12)
|
||||
{
|
||||
if(side == 1)
|
||||
{
|
||||
return icons[12][0];
|
||||
}
|
||||
else {
|
||||
return icons[12][1];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -441,6 +454,16 @@ public class BlockMachine extends BlockContainer implements IDismantleable
|
|||
{
|
||||
return icons[11][0];
|
||||
}
|
||||
else if(metadata == 12)
|
||||
{
|
||||
if(side == 1)
|
||||
{
|
||||
return icons[12][0];
|
||||
}
|
||||
else {
|
||||
return icons[12][1];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -479,6 +502,7 @@ public class BlockMachine extends BlockContainer implements IDismantleable
|
|||
list.add(new ItemStack(i, 1, 9));
|
||||
list.add(new ItemStack(i, 1, 10));
|
||||
list.add(new ItemStack(i, 1, 11));
|
||||
list.add(new ItemStack(i, 1, 12));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -709,7 +733,8 @@ public class BlockMachine extends BlockContainer implements IDismantleable
|
|||
METALLURGIC_INFUSER(8, 12, 2000, TileEntityMetallurgicInfuser.class, false),
|
||||
PURIFICATION_CHAMBER(9, 15, 12000, TileEntityPurificationChamber.class, false),
|
||||
ENERGIZED_SMELTER(10, 16, 2000, TileEntityEnergizedSmelter.class, false),
|
||||
TELEPORTER(11, 13, 5000000, TileEntityTeleporter.class, false);
|
||||
TELEPORTER(11, 13, 5000000, TileEntityTeleporter.class, false),
|
||||
ELECTRIC_PUMP(12, 17, 16000, TileEntityElectricPump.class, false);
|
||||
|
||||
public int meta;
|
||||
public int guiId;
|
||||
|
|
|
@ -158,6 +158,8 @@ public class CommonProxy
|
|||
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
||||
case 16:
|
||||
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
|
||||
case 17:
|
||||
return new ContainerElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
101
src/minecraft/mekanism/common/ContainerElectricPump.java
Normal file
101
src/minecraft/mekanism/common/ContainerElectricPump.java
Normal file
|
@ -0,0 +1,101 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import mekanism.common.SlotEnergy.SlotDischarge;
|
||||
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.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
|
||||
public class ContainerElectricPump extends Container
|
||||
{
|
||||
private TileEntityElectricPump tileEntity;
|
||||
|
||||
public ContainerElectricPump(InventoryPlayer inventory, TileEntityElectricPump tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new Slot(tentity, 0, 28, 20));
|
||||
addSlotToContainer(new Slot(tentity, 1, 28, 51));
|
||||
addSlotToContainer(new SlotDischarge(tentity, 2, 143, 35));
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; ++slotX)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
||||
tileEntity.openChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onCraftGuiClosed(entityplayer);
|
||||
tileEntity.closeChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot currentSlot = (Slot)inventorySlots.get(slotID);
|
||||
|
||||
if(currentSlot != null && currentSlot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = currentSlot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if((slotStack.getItem() instanceof IElectricItem && ((IElectricItem)slotStack.getItem()).canProvideEnergy(slotStack)) || (slotStack.getItem() instanceof IItemElectric && ((IItemElectric)slotStack.getItem()).getProvideRequest(slotStack).amperes != 0) || slotStack.itemID == Item.redstone.itemID)
|
||||
{
|
||||
if(slotID != 1)
|
||||
{
|
||||
if (!mergeItemStack(slotStack, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0)
|
||||
{
|
||||
currentSlot.putStack((ItemStack)null);
|
||||
}
|
||||
else {
|
||||
currentSlot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == stack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
currentSlot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
|
@ -104,7 +104,7 @@ public class EnergyTransferProtocol
|
|||
{
|
||||
if(((IPowerReceptor)acceptor).getPowerProvider() != null)
|
||||
{
|
||||
if((((IPowerReceptor)acceptor).powerRequest(acceptorDirections.get(acceptor).getOpposite())*Mekanism.FROM_BC) > 0)
|
||||
if((((IPowerReceptor)acceptor).powerRequest(ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)).getOpposite())*Mekanism.FROM_BC) > 0)
|
||||
{
|
||||
availableAcceptors.add(acceptor);
|
||||
acceptorDirections.put(acceptor, ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)));
|
||||
|
|
|
@ -39,6 +39,7 @@ import net.minecraft.world.World;
|
|||
* 9: Purification Chamber
|
||||
* 10: Energized Smelter
|
||||
* 11: Teleporter
|
||||
* 12: Electric Pump
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -103,6 +104,9 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
|
|||
case 11:
|
||||
name = "Teleporter";
|
||||
break;
|
||||
case 12:
|
||||
name = "ElectricPump";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ItemStorageTank extends ItemMekanism implements IStorageTank
|
|||
{
|
||||
ItemStack itemstack = (ItemStack)data[0];
|
||||
|
||||
if(getGasType(itemstack) == type)
|
||||
if(getGasType(itemstack) == type || type == EnumGas.NONE)
|
||||
{
|
||||
if(itemstack.stackTagCompound == null)
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ public class ItemStorageTank extends ItemMekanism implements IStorageTank
|
|||
ItemStack itemStack = (ItemStack)data[0];
|
||||
IStorageTank tank = (IStorageTank)itemStack.getItem();
|
||||
|
||||
if(getGasType(itemStack) == EnumGas.NONE || getGasType(itemStack) == type)
|
||||
if(getGasType(itemStack) == EnumGas.NONE || getGasType(itemStack) == type || type == EnumGas.NONE)
|
||||
{
|
||||
return MAX_GAS;
|
||||
}
|
||||
|
|
|
@ -453,6 +453,7 @@ public class Mekanism
|
|||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.PurificationChamber.name", "Purification Chamber");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.EnergizedSmelter.name", "Energized Smelter");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Teleporter.name", "Teleporter");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.ElectricPump.name", "Electric Pump");
|
||||
|
||||
//Localization for OreBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.OreBlock.OsmiumOre.name", "Osmium Ore");
|
||||
|
@ -922,6 +923,7 @@ public class Mekanism
|
|||
GameRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter");
|
||||
GameRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber");
|
||||
GameRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter");
|
||||
GameRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump");
|
||||
|
||||
//Load tile entities that have special renderers.
|
||||
proxy.registerSpecialTileEntities();
|
||||
|
|
|
@ -48,12 +48,12 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
{
|
||||
super(soundPath, name, path, perTick, ticksRequired, maxEnergy);
|
||||
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 0, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.PURPLE, 1, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 2, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 3, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 4, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 0, 1, new int[] {0}));
|
||||
sideOutputs.add(new SideData(EnumColor.PURPLE, 1, 1, new int[] {1}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 2, 1, new int[] {2}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 3, 1, new int[] {3}));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 4, 1, new int[] {4}));
|
||||
|
||||
sideConfig = new byte[] {2, 1, 0, 4, 5, 3};
|
||||
|
||||
|
@ -231,7 +231,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return RecipeHandler.getOutput(inventory[0], false, getRecipes()) != null;
|
||||
return RecipeHandler.getOutput(itemstack, false, getRecipes()) != null;
|
||||
}
|
||||
else if(slotID == 3)
|
||||
{
|
||||
|
@ -345,6 +345,24 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
{
|
||||
return secondaryEnergyStored*i / MAX_SECONDARY_ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 3)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
(!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(slotID == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames()
|
||||
|
|
|
@ -10,11 +10,11 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
|
|||
{
|
||||
super(FactoryTier.ADVANCED);
|
||||
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 5));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 7, 5));
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 5, new int[] {2, 3, 4, 5, 6}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 7, 5, new int[] {7, 8, 9, 10, 11}));
|
||||
|
||||
sideConfig = new byte[] {4, 3, 0, 0, 2, 1};
|
||||
}
|
||||
|
|
|
@ -372,6 +372,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
@Override
|
||||
public void detach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return sideOutputs.get(sideConfig[MekanismUtils.getBaseOrientation(side, facing)]).availableSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -2,13 +2,13 @@ package mekanism.common;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
|
||||
public abstract class TileEntityContainerBlock extends TileEntityBasicBlock implements ISidedInventory, IInventory, ISustainedInventory
|
||||
public abstract class TileEntityContainerBlock extends TileEntityBasicBlock implements net.minecraftforge.common.ISidedInventory, ISidedInventory, IInventory, ISustainedInventory
|
||||
{
|
||||
/** The inventory slot itemstacks used by this block. */
|
||||
public ItemStack[] inventory;
|
||||
|
@ -122,14 +122,13 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
|
|||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotID)
|
||||
{
|
||||
if (inventory[slotID] != null)
|
||||
if(inventory[slotID] != null)
|
||||
{
|
||||
ItemStack var2 = inventory[slotID];
|
||||
inventory[slotID] = null;
|
||||
return var2;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +138,7 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
|
|||
{
|
||||
inventory[slotID] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
if(itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
@ -186,6 +185,24 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102007_a(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
return isStackValidForSlot(slotID, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventory(NBTTagList nbtTags, Object... data)
|
||||
|
|
|
@ -28,11 +28,11 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
{
|
||||
super(soundPath, name, path, perTick, ticksRequired, maxEnergy);
|
||||
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 0, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 2, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 3, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 0, 1, new int[] {0}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 2, 1, new int[] {2}));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 3, 1, new int[] {3}));
|
||||
|
||||
sideConfig = new byte[] {2, 1, 0, 0, 4, 3};
|
||||
|
||||
|
@ -169,7 +169,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return RecipeHandler.getOutput(inventory[0], false, getRecipes()) != null;
|
||||
return RecipeHandler.getOutput(itemstack, false, getRecipes()) != null;
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
|
@ -227,6 +227,24 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
return inventory[2].stackSize + itemstack.stackSize <= inventory[2].getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
(!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(slotID == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames()
|
||||
|
|
166
src/minecraft/mekanism/common/TileEntityElectricPump.java
Normal file
166
src/minecraft/mekanism/common/TileEntityElectricPump.java
Normal file
|
@ -0,0 +1,166 @@
|
|||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import mekanism.api.InfusionType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
|
||||
public class TileEntityElectricPump extends TileEntityElectricBlock
|
||||
{
|
||||
public LiquidTank liquidTank;
|
||||
|
||||
public TileEntityElectricPump()
|
||||
{
|
||||
super("Electric Pump", 16000);
|
||||
liquidTank = new LiquidTank(16000);
|
||||
inventory = new ItemStack[3];
|
||||
liquidTank.setLiquid(new LiquidStack(Block.waterStill.blockID, 8000, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if(inventory[2] != null)
|
||||
{
|
||||
if(electricityStored < MAX_ELECTRICITY)
|
||||
{
|
||||
setJoules(getJoules() + ElectricItemHelper.dechargeItem(inventory[2], getMaxJoules() - getJoules(), getVoltage()));
|
||||
|
||||
if(Mekanism.hooks.IC2Loaded && inventory[2].getItem() instanceof IElectricItem)
|
||||
{
|
||||
IElectricItem item = (IElectricItem)inventory[2].getItem();
|
||||
if(item.canProvideEnergy(inventory[2]))
|
||||
{
|
||||
double gain = ElectricItem.discharge(inventory[2], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
|
||||
setJoules(electricityStored + gain);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(inventory[2].itemID == Item.redstone.itemID && electricityStored+1000 <= MAX_ELECTRICITY)
|
||||
{
|
||||
setJoules(electricityStored + 1000);
|
||||
inventory[2].stackSize--;
|
||||
|
||||
if(inventory[2].stackSize <= 0)
|
||||
{
|
||||
inventory[2] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(inventory[0] != null)
|
||||
{
|
||||
if(liquidTank.getLiquid() != null && liquidTank.getLiquid().amount >= 1000)
|
||||
{
|
||||
if(LiquidContainerRegistry.isEmptyContainer(inventory[0]))
|
||||
{
|
||||
ItemStack tempStack = LiquidContainerRegistry.fillLiquidContainer(liquidTank.getLiquid(), inventory[0]);
|
||||
|
||||
if(tempStack != null)
|
||||
{
|
||||
if(inventory[1] == null)
|
||||
{
|
||||
liquidTank.drain(1000, true);
|
||||
|
||||
inventory[1] = tempStack;
|
||||
inventory[0].stackSize--;
|
||||
|
||||
if(inventory[0].stackSize <= 0)
|
||||
{
|
||||
inventory[0] = null;
|
||||
}
|
||||
}
|
||||
else if(tempStack.isItemEqual(inventory[1]) && tempStack.getMaxStackSize() > inventory[1].stackSize)
|
||||
{
|
||||
liquidTank.drain(1000, true);
|
||||
|
||||
inventory[1].stackSize++;
|
||||
inventory[0].stackSize--;
|
||||
|
||||
if(inventory[0].stackSize <= 0)
|
||||
{
|
||||
inventory[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
try {
|
||||
int amount = dataStream.readInt();
|
||||
int itemID = dataStream.readInt();
|
||||
int itemMeta = dataStream.readInt();
|
||||
|
||||
liquidTank.setLiquid(new LiquidStack(itemID, amount, itemMeta));
|
||||
} catch(Exception e) {}
|
||||
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
if(liquidTank.getLiquid() != null)
|
||||
{
|
||||
data.add(liquidTank.getLiquid().amount);
|
||||
data.add(liquidTank.getLiquid().itemID);
|
||||
data.add(liquidTank.getLiquid().itemMeta);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getScaledEnergyLevel(int i)
|
||||
{
|
||||
return (int)(electricityStored*i / MAX_ELECTRICITY);
|
||||
}
|
||||
|
||||
public int getScaledLiquidLevel(int i)
|
||||
{
|
||||
return liquidTank.getLiquid() != null ? liquidTank.getLiquid().amount*i / 16000 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
if(liquidTank.getLiquid() != null)
|
||||
{
|
||||
nbtTags.setTag("liquidTank", liquidTank.getLiquid().writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
if(nbtTags.hasKey("liquidTank"))
|
||||
{
|
||||
//liquidTank.setLiquid(LiquidStack.loadLiquidStackFromNBT(nbtTags));
|
||||
}
|
||||
|
||||
liquidTank.setLiquid(new LiquidStack(Block.waterStill.blockID, 8000, 0));
|
||||
}
|
||||
}
|
|
@ -10,11 +10,11 @@ public class TileEntityEliteFactory extends TileEntityFactory
|
|||
{
|
||||
super(FactoryTier.ELITE);
|
||||
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 7));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 9, 7));
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 7, new int[] {2, 3, 4, 5, 6, 7, 8}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 9, 7, new int[] {9, 10, 11, 12, 13, 14, 15}));
|
||||
|
||||
sideConfig = new byte[] {4, 3, 0, 0, 2, 1};
|
||||
}
|
||||
|
|
|
@ -300,6 +300,32 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
return tier.MAX_ELECTRICITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return side == 1 ? new int[] {0} : new int[] {1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
(!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -81,11 +81,11 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
{
|
||||
this(FactoryTier.BASIC);
|
||||
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 3));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 5, 3));
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 3, new int[] {2, 3, 4}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 5, 3, new int[] {5, 6, 7}));
|
||||
|
||||
sideConfig = new byte[] {4, 3, 0, 0, 2, 1};
|
||||
}
|
||||
|
@ -253,6 +253,32 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
(!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(tier == FactoryTier.BASIC && slotID >= 5 && slotID <= 7)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(tier == FactoryTier.ADVANCED && slotID >= 7 && slotID <= 11)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(tier == FactoryTier.ELITE && slotID >= 9 && slotID <= 15)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -264,7 +290,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
}
|
||||
else if(slotID >= 2 && slotID <= 4)
|
||||
{
|
||||
return RecipeType.values()[recipeType].getCopiedOutput(inventory[slotID], false) != null;
|
||||
return RecipeType.values()[recipeType].getCopiedOutput(itemstack, false) != null;
|
||||
}
|
||||
}
|
||||
else if(tier == FactoryTier.ADVANCED)
|
||||
|
@ -275,7 +301,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
}
|
||||
else if(slotID >= 2 && slotID <= 6)
|
||||
{
|
||||
return RecipeType.values()[recipeType].getCopiedOutput(inventory[slotID], false) != null;
|
||||
return RecipeType.values()[recipeType].getCopiedOutput(itemstack, false) != null;
|
||||
}
|
||||
}
|
||||
else if(tier == FactoryTier.ELITE)
|
||||
|
@ -286,7 +312,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
}
|
||||
else if(slotID >= 2 && slotID <= 8)
|
||||
{
|
||||
return RecipeType.values()[recipeType].getCopiedOutput(inventory[slotID], false) != null;
|
||||
return RecipeType.values()[recipeType].getCopiedOutput(itemstack, false) != null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,6 +710,12 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
return (int)Math.min(((MekanismUtils.getEnergy(energyMultiplier, MAX_ELECTRICITY)-electricityStored)*Mekanism.TO_BC), 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return sideOutputs.get(sideConfig[MekanismUtils.getBaseOrientation(side, facing)]).availableSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<SideData> getSideData()
|
||||
{
|
||||
|
|
|
@ -139,6 +139,22 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasS
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IStorageTank && ((IStorageTank)itemstack.getItem()).getGas(EnumGas.NONE, itemstack) == 0);
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IStorageTank &&
|
||||
((IStorageTank)itemstack.getItem()).getGas(EnumGas.NONE, itemstack) == ((IStorageTank)itemstack.getItem()).getMaxGas(EnumGas.NONE, itemstack));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -153,6 +169,12 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasS
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return side == 1 ? new int[] {0} : new int[] {1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -88,12 +88,12 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
{
|
||||
super("Metallurgic Infuser", 2000);
|
||||
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.PURPLE, 1, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 3, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 4, 1));
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
|
||||
sideOutputs.add(new SideData(EnumColor.PURPLE, 1, 1, new int[] {1}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 1, new int[] {2}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 3, 1, new int[] {3}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 4, 1, new int[] {4}));
|
||||
|
||||
sideConfig = new byte[] {0, 1, 0, 5, 3, 4};
|
||||
|
||||
|
@ -292,6 +292,24 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 4)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
(!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(slotID == 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -584,6 +602,12 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
|
||||
@Override
|
||||
public void detach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return sideOutputs.get(sideConfig[MekanismUtils.getBaseOrientation(side, facing)]).availableSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxJoules()
|
||||
|
|
|
@ -120,6 +120,12 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return new int[] {0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -233,6 +239,12 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventorySide(ForgeDirection side)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
|
@ -380,6 +392,14 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(double amount)
|
||||
{
|
||||
|
|
|
@ -170,6 +170,23 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return LiquidContainerRegistry.isEmptyContainer(itemstack);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -229,6 +246,12 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
|||
return bioFuelSlot.liquidStored*i / bioFuelSlot.MAX_LIQUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return ForgeDirection.getOrientation(side) == MekanismUtils.getRight(facing) ? new int[] {1} : new int[] {0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -247,6 +247,32 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 3)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() > 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
(!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).getWatts() > 0));
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return LiquidContainerRegistry.isEmptyContainer(itemstack);
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
return itemstack.getItem() instanceof IStorageTank && ((IStorageTank)itemstack.getItem()).getGas(EnumGas.HYDROGEN, itemstack) == ((IStorageTank)itemstack.getItem()).getMaxGas(EnumGas.HYDROGEN, itemstack);
|
||||
}
|
||||
else if(slotID == 2)
|
||||
{
|
||||
return itemstack.getItem() instanceof IStorageTank && ((IStorageTank)itemstack.getItem()).getGas(EnumGas.OXYGEN, itemstack) == ((IStorageTank)itemstack.getItem()).getMaxGas(EnumGas.HYDROGEN, itemstack);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -271,6 +297,21 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
if(ForgeDirection.getOrientation(side) == MekanismUtils.getLeft(facing))
|
||||
{
|
||||
return new int[] {3};
|
||||
}
|
||||
else if(side == facing || ForgeDirection.getOrientation(side) == ForgeDirection.getOrientation(facing).getOpposite())
|
||||
{
|
||||
return new int[] {1, 2};
|
||||
}
|
||||
|
||||
return new int[] {0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -178,6 +178,23 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
nbtTags.setInteger("fuelStored", fuelSlot.liquidStored);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return LiquidContainerRegistry.isEmptyContainer(itemstack);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnvironmentBoost()
|
||||
{
|
||||
|
@ -209,6 +226,12 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
return TileEntityFurnace.getItemBurnTime(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return ForgeDirection.getOrientation(side) == MekanismUtils.getRight(facing) ? new int[] {1} : new int[] {0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ import mekanism.common.MekanismUtils;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
|
@ -98,6 +99,23 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IStorageTank && ((IStorageTank)itemstack.getItem()).getGas(EnumGas.NONE, itemstack) == 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -114,6 +132,12 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return ForgeDirection.getOrientation(side) == MekanismUtils.getRight(facing) ? new int[] {1} : new int[] {0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -7,8 +7,12 @@ import universalelectricity.core.item.IItemElectric;
|
|||
|
||||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import mekanism.api.EnumGas;
|
||||
import mekanism.api.IStorageTank;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import mekanism.generators.common.BlockGenerator.GeneratorType;
|
||||
import micdoodle8.mods.galacticraft.API.ISolarLevel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
|
@ -41,6 +45,12 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
|
|||
@Override
|
||||
public void updateSound() {/* No super - prevent sound updating */}
|
||||
|
||||
@Override
|
||||
public int[] getSizeInventorySide(int side)
|
||||
{
|
||||
return new int[] {0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
@ -91,6 +101,19 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).getWatts() == 0));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
|
@ -112,7 +135,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
|
|||
@Override
|
||||
public int getEnvironmentBoost()
|
||||
{
|
||||
return seesSun ? GENERATION_RATE : 0;
|
||||
return seesSun ? (GENERATION_RATE*(worldObj.provider instanceof ISolarLevel ? (int)((ISolarLevel)worldObj.provider).getSolorEnergyMultiplier() : 1)) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue