Merge branch 'development' into 1.8

Conflicts:
	src/main/java/mekanism/common/block/BlockMachine.java
	src/main/java/mekanism/common/item/ItemBlockMachine.java
	src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java
	src/main/java/mekanism/common/tile/TileEntityPRC.java
This commit is contained in:
Aidan C. Brady 2014-07-26 18:57:18 -04:00
commit ce5bddbdd1
16 changed files with 333 additions and 228 deletions

View file

@ -27,7 +27,7 @@ public class FuelHandler
return fuels.get(gas.getName());
}
if(ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|fuel") && gas.hasFluid())
if(ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|fuels") && gas.hasFluid())
{
Fuel bcFuel = IronEngineFuel.getFuelForFluid(gas.getFluid());

View file

@ -0,0 +1,10 @@
package mekanism.common;
import net.minecraft.item.ItemStack;
public interface ISustainedData
{
public void writeSustainedData(ItemStack itemStack);
public void readSustainedData(ItemStack itemStack);
}

View file

@ -14,12 +14,12 @@ import mekanism.common.IFactory.RecipeType;
import mekanism.common.IInvConfiguration;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISpecialBounds;
import mekanism.common.ISustainedData;
import mekanism.common.ISustainedInventory;
import mekanism.common.ISustainedTank;
import mekanism.common.IUpgradeTile;
import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism;
import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
@ -58,9 +58,7 @@ import mekanism.common.tile.TileEntityPurificationChamber;
import mekanism.common.tile.TileEntityRotaryCondensentrator;
import mekanism.common.tile.TileEntitySeismicVibrator;
import mekanism.common.tile.TileEntityTeleporter;
import mekanism.common.transporter.TransporterFilter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.TransporterUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -74,7 +72,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
@ -1020,61 +1017,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
itemStack.stackTagCompound.setByte("config"+i, config.getConfiguration()[i]);
}
}
if(tileEntity instanceof TileEntityDigitalMiner)
if(tileEntity instanceof ISustainedData)
{
TileEntityDigitalMiner miner = (TileEntityDigitalMiner)tileEntity;
itemStack.stackTagCompound.setBoolean("hasMinerConfig", true);
itemStack.stackTagCompound.setInteger("radius", miner.radius);
itemStack.stackTagCompound.setInteger("minY", miner.minY);
itemStack.stackTagCompound.setInteger("maxY", miner.maxY);
itemStack.stackTagCompound.setBoolean("doEject", miner.doEject);
itemStack.stackTagCompound.setBoolean("doPull", miner.doPull);
itemStack.stackTagCompound.setBoolean("silkTouch", miner.silkTouch);
itemStack.stackTagCompound.setBoolean("inverse", miner.inverse);
NBTTagList filterTags = new NBTTagList();
for(MinerFilter filter : miner.filters)
{
filterTags.appendTag(filter.write(new NBTTagCompound()));
}
if(filterTags.tagCount() != 0)
{
itemStack.stackTagCompound.setTag("filters", filterTags);
}
}
if(tileEntity instanceof TileEntityLogisticalSorter)
{
TileEntityLogisticalSorter sorter = (TileEntityLogisticalSorter)tileEntity;
itemStack.stackTagCompound.setBoolean("hasSorterConfig", true);
if(sorter.color != null)
{
itemStack.stackTagCompound.setInteger("color", TransporterUtils.colors.indexOf(sorter.color));
}
itemStack.stackTagCompound.setBoolean("autoEject", sorter.autoEject);
itemStack.stackTagCompound.setBoolean("roundRobin", sorter.roundRobin);
NBTTagList filterTags = new NBTTagList();
for(TransporterFilter filter : sorter.filters)
{
NBTTagCompound tagCompound = new NBTTagCompound();
filter.write(tagCompound);
filterTags.appendTag(tagCompound);
}
if(filterTags.tagCount() != 0)
{
itemStack.stackTagCompound.setTag("filters", filterTags);
}
((ISustainedData)tileEntity).writeSustainedData(itemStack);
}
if(tileEntity instanceof IRedstoneControl)
@ -1120,46 +1066,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
factoryItem.setRecipeType(((TileEntityFactory)tileEntity).recipeType, itemStack);
}
if(tileEntity instanceof TileEntityRotaryCondensentrator)
{
TileEntityRotaryCondensentrator condensentrator = (TileEntityRotaryCondensentrator)tileEntity;
if(condensentrator.gasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("gasStack", condensentrator.gasTank.getGas().write(new NBTTagCompound()));
}
}
if(tileEntity instanceof TileEntityChemicalOxidizer)
{
TileEntityChemicalOxidizer formulator = (TileEntityChemicalOxidizer)tileEntity;
if(formulator.gasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("gasTank", formulator.gasTank.getGas().write(new NBTTagCompound()));
}
}
if(tileEntity instanceof TileEntityChemicalInfuser)
{
TileEntityChemicalInfuser infuser = (TileEntityChemicalInfuser)tileEntity;
if(infuser.leftTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("leftTank", infuser.leftTank.getGas().write(new NBTTagCompound()));
}
if(infuser.rightTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("rightTank", infuser.rightTank.getGas().write(new NBTTagCompound()));
}
if(infuser.centerTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("leftTank", infuser.centerTank.getGas().write(new NBTTagCompound()));
}
}
return itemStack;
}

View file

@ -12,13 +12,13 @@ import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.energy.EnergizedItemManager;
import mekanism.api.energy.IEnergizedItem;
import mekanism.api.gas.GasStack;
import mekanism.client.MekanismKeyHandler;
import mekanism.common.IElectricChest;
import mekanism.common.IFactory;
import mekanism.common.IInvConfiguration;
import mekanism.common.IRedstoneControl;
import mekanism.common.IRedstoneControl.RedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.ISustainedInventory;
import mekanism.common.ISustainedTank;
import mekanism.common.IUpgradeTile;
@ -27,23 +27,15 @@ import mekanism.common.Upgrade;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.integration.IC2ItemManager;
import mekanism.common.inventory.InventoryElectricChest;
import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.tile.TileEntityChemicalInfuser;
import mekanism.common.tile.TileEntityChemicalOxidizer;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.tile.TileEntityElectricBlock;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.tile.TileEntityPortableTank;
import mekanism.common.tile.TileEntityRotaryCondensentrator;
import mekanism.common.transporter.TransporterFilter;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.TransporterUtils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
@ -276,56 +268,12 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
}
}
}
if(tileEntity instanceof TileEntityDigitalMiner)
if(tileEntity instanceof ISustainedData)
{
TileEntityDigitalMiner miner = (TileEntityDigitalMiner)tileEntity;
if(stack.stackTagCompound != null && stack.stackTagCompound.hasKey("hasMinerConfig"))
if(stack.stackTagCompound != null)
{
miner.radius = stack.stackTagCompound.getInteger("radius");
miner.minY = stack.stackTagCompound.getInteger("minY");
miner.maxY = stack.stackTagCompound.getInteger("maxY");
miner.doEject = stack.stackTagCompound.getBoolean("doEject");
miner.doPull = stack.stackTagCompound.getBoolean("doPull");
miner.silkTouch = stack.stackTagCompound.getBoolean("silkTouch");
miner.inverse = stack.stackTagCompound.getBoolean("inverse");
if(stack.stackTagCompound.hasKey("filters"))
{
NBTTagList tagList = stack.stackTagCompound.getTagList("filters", NBT.TAG_COMPOUND);
for(int i = 0; i < tagList.tagCount(); i++)
{
miner.filters.add(MinerFilter.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i)));
}
}
}
}
if(tileEntity instanceof TileEntityLogisticalSorter)
{
TileEntityLogisticalSorter sorter = (TileEntityLogisticalSorter)tileEntity;
if(stack.stackTagCompound != null && stack.stackTagCompound.hasKey("hasSorterConfig"))
{
if(stack.stackTagCompound.hasKey("color"))
{
sorter.color = TransporterUtils.colors.get(stack.stackTagCompound.getInteger("color"));
}
sorter.autoEject = stack.stackTagCompound.getBoolean("autoEject");
sorter.roundRobin = stack.stackTagCompound.getBoolean("roundRobin");
if(stack.stackTagCompound.hasKey("filters"))
{
NBTTagList tagList = stack.stackTagCompound.getTagList("filters", NBT.TAG_COMPOUND);
for(int i = 0; i < tagList.tagCount(); i++)
{
sorter.filters.add(TransporterFilter.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i)));
}
}
((ISustainedData)tileEntity).readSustainedData(stack);
}
}
@ -358,33 +306,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
((TileEntityElectricChest)tileEntity).password = getPassword(stack);
}
if(tileEntity instanceof TileEntityRotaryCondensentrator)
{
if(stack.stackTagCompound != null && stack.stackTagCompound.hasKey("gasStack"))
{
GasStack gasStack = GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("gasStack"));
((TileEntityRotaryCondensentrator)tileEntity).gasTank.setGas(gasStack);
}
}
if(tileEntity instanceof TileEntityChemicalOxidizer)
{
if(stack.stackTagCompound != null)
{
((TileEntityChemicalOxidizer)tileEntity).gasTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("gasTank")));
}
}
if(tileEntity instanceof TileEntityChemicalInfuser)
{
if(stack.stackTagCompound != null)
{
((TileEntityChemicalInfuser)tileEntity).leftTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("leftTank")));
((TileEntityChemicalInfuser)tileEntity).rightTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("rightTank")));
((TileEntityChemicalInfuser)tileEntity).centerTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("centerTank")));
}
}
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
if(tileEntity instanceof TileEntityElectricBlock)
@ -751,8 +672,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
MachineType type = MachineType.get((ItemStack)data[0]);
return type == MachineType.ELECTRIC_PUMP || type == MachineType.ROTARY_CONDENSENTRATOR
|| type == MachineType.PORTABLE_TANK || type == MachineType.FLUIDIC_PLENISHER;
return type == MachineType.ELECTRIC_PUMP || type == MachineType.PORTABLE_TANK || type == MachineType.FLUIDIC_PLENISHER;
}
@Override

View file

@ -19,6 +19,7 @@ import mekanism.common.IActiveState;
import mekanism.common.IEjector;
import mekanism.common.IInvConfiguration;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.SideData;
@ -38,7 +39,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IInvConfiguration, IUpgradeTile
public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IInvConfiguration, IUpgradeTile, ISustainedData
{
public static final int MAX_GAS = 10000;
public static final int MAX_FLUID = 10000;
@ -507,4 +508,19 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
{
return upgradeComponent;
}
@Override
public void writeSustainedData(ItemStack itemStack)
{
if(inputTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("inputTank", inputTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
inputTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("inputTank")));
}
}

View file

@ -16,6 +16,7 @@ import mekanism.api.gas.ITubeConnection;
import mekanism.client.sound.IHasSound;
import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
@ -31,7 +32,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IGasHandler, IUpgradeTile
public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IGasHandler, IUpgradeTile, ISustainedData
{
public GasTank injectTank = new GasTank(MAX_GAS);
public GasTank outputTank = new GasTank(MAX_GAS);
@ -439,4 +440,25 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
{
return upgradeComponent;
}
@Override
public void writeSustainedData(ItemStack itemStack)
{
if(injectTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("injectTank", injectTank.getGas().write(new NBTTagCompound()));
}
if(outputTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("outputTank", outputTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
injectTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("injectTank")));
outputTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("outputTank")));
}
}

View file

@ -16,6 +16,7 @@ import mekanism.api.gas.ITubeConnection;
import mekanism.client.sound.IHasSound;
import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -30,7 +31,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChemicalInfuser extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound
public class TileEntityChemicalInfuser extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, ISustainedData
{
public GasTank leftTank = new GasTank(MAX_GAS);
public GasTank rightTank = new GasTank(MAX_GAS);
@ -476,4 +477,31 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
{
return 1;
}
@Override
public void writeSustainedData(ItemStack itemStack)
{
if(leftTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("leftTank", leftTank.getGas().write(new NBTTagCompound()));
}
if(rightTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("rightTank", rightTank.getGas().write(new NBTTagCompound()));
}
if(centerTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("centerTank", centerTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
leftTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("leftTank")));
rightTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("rightTank")));
centerTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("centerTank")));
}
}

View file

@ -15,6 +15,7 @@ import mekanism.api.gas.ITubeConnection;
import mekanism.client.sound.IHasSound;
import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
@ -30,7 +31,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IUpgradeTile
public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IUpgradeTile, ISustainedData
{
public GasTank gasTank = new GasTank(MAX_GAS);
@ -365,4 +366,19 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
{
return upgradeComponent;
}
@Override
public void writeSustainedData(ItemStack itemStack)
{
if(gasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("gasTank", gasTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
gasTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("gasTank")));
}
}

View file

@ -16,6 +16,7 @@ import mekanism.api.gas.ITubeConnection;
import mekanism.client.sound.IHasSound;
import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -40,7 +41,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
public class TileEntityChemicalWasher extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IFluidHandler
public class TileEntityChemicalWasher extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IFluidHandler, ISustainedData
{
public FluidTank fluidTank = new FluidTank(MAX_FLUID);
public GasTank inputTank = new GasTank(MAX_GAS);
@ -587,4 +588,31 @@ public class TileEntityChemicalWasher extends TileEntityElectricBlock implements
return PipeUtils.EMPTY;
}
@Override
public void writeSustainedData(ItemStack itemStack)
{
if(fluidTank.getFluid() != null)
{
itemStack.stackTagCompound.setTag("fluidTank", fluidTank.getFluid().writeToNBT(new NBTTagCompound()));
}
if(inputTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("inputTank", inputTank.getGas().write(new NBTTagCompound()));
}
if(outputTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("outputTank", outputTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("fluidTank")));
inputTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("inputTank")));
outputTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("outputTank")));
}
}

View file

@ -17,6 +17,7 @@ import mekanism.common.IActiveState;
import mekanism.common.IAdvancedBoundingBlock;
import mekanism.common.ILogisticalTransporter;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
@ -57,7 +58,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityDigitalMiner extends TileEntityElectricBlock implements IPeripheral, IUpgradeTile, IRedstoneControl, IActiveState, IAdvancedBoundingBlock
public class TileEntityDigitalMiner extends TileEntityElectricBlock implements IPeripheral, IUpgradeTile, IRedstoneControl, IActiveState, ISustainedData, IAdvancedBoundingBlock
{
public static int[] EJECT_INV;
@ -1355,4 +1356,54 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
{
return false;
}
public void writeSustainedData(ItemStack itemStack)
{
itemStack.stackTagCompound.setBoolean("hasMinerConfig", true);
itemStack.stackTagCompound.setInteger("radius", radius);
itemStack.stackTagCompound.setInteger("minY", minY);
itemStack.stackTagCompound.setInteger("maxY", maxY);
itemStack.stackTagCompound.setBoolean("doEject", doEject);
itemStack.stackTagCompound.setBoolean("doPull", doPull);
itemStack.stackTagCompound.setBoolean("silkTouch", silkTouch);
itemStack.stackTagCompound.setBoolean("inverse", inverse);
NBTTagList filterTags = new NBTTagList();
for(MinerFilter filter : filters)
{
filterTags.appendTag(filter.write(new NBTTagCompound()));
}
if(filterTags.tagCount() != 0)
{
itemStack.stackTagCompound.setTag("filters", filterTags);
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
if(itemStack.stackTagCompound.hasKey("hasMinerConfig"))
{
radius = itemStack.stackTagCompound.getInteger("radius");
minY = itemStack.stackTagCompound.getInteger("minY");
maxY = itemStack.stackTagCompound.getInteger("maxY");
doEject = itemStack.stackTagCompound.getBoolean("doEject");
doPull = itemStack.stackTagCompound.getBoolean("doPull");
silkTouch = itemStack.stackTagCompound.getBoolean("silkTouch");
inverse = itemStack.stackTagCompound.getBoolean("inverse");
if(itemStack.stackTagCompound.hasKey("filters"))
{
NBTTagList tagList = itemStack.stackTagCompound.getTagList("filters", NBT.TAG_COMPOUND);
for(int i = 0; i < tagList.tagCount(); i++)
{
filters.add(MinerFilter.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i)));
}
}
}
}
}

View file

@ -14,7 +14,7 @@ import mekanism.api.gas.GasTransmission;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.IGasItem;
import mekanism.api.gas.ITubeConnection;
import mekanism.common.ISustainedTank;
import mekanism.common.ISustainedData;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -43,7 +43,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IFluidHandler, IPeripheral, ITubeConnection, ISustainedTank, IGasHandler
public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IFluidHandler, IPeripheral, ITubeConnection, ISustainedData, IGasHandler
{
/** This separator's water slot. */
public FluidTank fluidTank = new FluidTank(24000);
@ -575,21 +575,30 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
}
@Override
public void setFluidStack(FluidStack fluidStack, Object... data)
public void writeSustainedData(ItemStack itemStack)
{
fluidTank.setFluid(fluidStack);
if(fluidTank.getFluid() != null)
{
itemStack.stackTagCompound.setTag("fluidTank", fluidTank.getFluid().writeToNBT(new NBTTagCompound()));
}
if(leftTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("leftTank", leftTank.getGas().write(new NBTTagCompound()));
}
if(rightTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("rightTank", rightTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public FluidStack getFluidStack(Object... data)
public void readSustainedData(ItemStack itemStack)
{
return fluidTank.getFluid();
}
@Override
public boolean hasTank(Object... data)
{
return true;
fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("fluidTank")));
leftTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("leftTank")));
rightTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("rightTank")));
}
@Override

View file

@ -12,6 +12,7 @@ import mekanism.common.HashList;
import mekanism.common.IActiveState;
import mekanism.common.ILogisticalTransporter;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedData;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -33,7 +34,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityLogisticalSorter extends TileEntityElectricBlock implements IRedstoneControl, IActiveState, IFilterAccess
public class TileEntityLogisticalSorter extends TileEntityElectricBlock implements IRedstoneControl, IActiveState, IFilterAccess, ISustainedData
{
public HashList<TransporterFilter> filters = new HashList<TransporterFilter>();
@ -620,4 +621,57 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{
return "tooltip.filterCard.logisticalSorter";
}
@Override
public void writeSustainedData(ItemStack itemStack)
{
itemStack.stackTagCompound.setBoolean("hasSorterConfig", true);
if(color != null)
{
itemStack.stackTagCompound.setInteger("color", TransporterUtils.colors.indexOf(color));
}
itemStack.stackTagCompound.setBoolean("autoEject", autoEject);
itemStack.stackTagCompound.setBoolean("roundRobin", roundRobin);
NBTTagList filterTags = new NBTTagList();
for(TransporterFilter filter : filters)
{
NBTTagCompound tagCompound = new NBTTagCompound();
filter.write(tagCompound);
filterTags.appendTag(tagCompound);
}
if(filterTags.tagCount() != 0)
{
itemStack.stackTagCompound.setTag("filters", filterTags);
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
if(itemStack.stackTagCompound.hasKey("hasSorterConfig"))
{
if(itemStack.stackTagCompound.hasKey("color"))
{
color = TransporterUtils.colors.get(itemStack.stackTagCompound.getInteger("color"));
}
autoEject = itemStack.stackTagCompound.getBoolean("autoEject");
roundRobin = itemStack.stackTagCompound.getBoolean("roundRobin");
if(itemStack.stackTagCompound.hasKey("filters"))
{
NBTTagList tagList = itemStack.stackTagCompound.getTagList("filters", NBT.TAG_COMPOUND);
for(int i = 0; i < tagList.tagCount(); i++)
{
filters.add(TransporterFilter.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i)));
}
}
}
}
}

View file

@ -15,10 +15,11 @@ import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection;
import mekanism.common.IUpgradeItem;
import mekanism.common.ISustainedData;
import mekanism.common.Mekanism;
import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.item.ItemUpgrade;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.tile.component.TileComponentUpgrade;
@ -41,7 +42,7 @@ import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandler, IGasHandler, ITubeConnection
public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandler, IGasHandler, ITubeConnection, ISustainedData
{
public FluidTank inputFluidTank = new FluidTank(10000);
public GasTank inputGasTank = new GasTank(10000);
@ -140,7 +141,7 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
}
else if(slotID == 3)
{
return itemstack.getItem() instanceof IUpgradeItem;
return itemstack.getItem() instanceof ItemUpgrade;
}
return false;
@ -438,4 +439,31 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
{
return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing);
}
@Override
public void writeSustainedData(ItemStack itemStack)
{
if(inputFluidTank.getFluid() != null)
{
itemStack.stackTagCompound.setTag("inputFluidTank", inputFluidTank.getFluid().writeToNBT(new NBTTagCompound()));
}
if(inputGasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("inputGasTank", inputGasTank.getGas().write(new NBTTagCompound()));
}
if(outputGasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("outputGasTank", outputGasTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public void readSustainedData(ItemStack itemStack)
{
inputFluidTank.setFluid(FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("inputFluidTank")));
inputGasTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("inputGasTank")));
outputGasTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("outputGasTank")));
}
}

View file

@ -14,7 +14,7 @@ import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection;
import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedTank;
import mekanism.common.ISustainedData;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -36,7 +36,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock implements IActiveState, ISustainedTank, IFluidHandler, IGasHandler, ITubeConnection, IRedstoneControl
public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock implements IActiveState, ISustainedData, IFluidHandler, IGasHandler, ITubeConnection, IRedstoneControl
{
public GasTank gasTank = new GasTank(MAX_FLUID);
@ -501,23 +501,26 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp
{
return mode == 0 && side == MekanismUtils.getLeft(facing) ? gasTank.canReceive(type) : false;
}
@Override
public void setFluidStack(FluidStack fluidStack, Object... data)
public void writeSustainedData(ItemStack itemStack)
{
fluidTank.setFluid(fluidStack);
if(fluidTank.getFluid() != null)
{
itemStack.stackTagCompound.setTag("fluidTank", fluidTank.getFluid().writeToNBT(new NBTTagCompound()));
}
if(gasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("gasTank", gasTank.getGas().write(new NBTTagCompound()));
}
}
@Override
public FluidStack getFluidStack(Object... data)
public void readSustainedData(ItemStack itemStack)
{
return fluidTank.getFluid();
}
@Override
public boolean hasTank(Object... data)
{
return true;
fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("fluidTank")));
gasTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("gasTank")));
}
@Override

View file

@ -526,7 +526,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
{
HEAT_GENERATOR(0, "HeatGenerator", 0, 160000, TileEntityHeatGenerator.class, true),
SOLAR_GENERATOR(1, "SolarGenerator", 1, 96000, TileEntitySolarGenerator.class, true),
GAS_GENERATOR(3, "GasGenerator", 3, 40000, TileEntityGasGenerator.class, true),
GAS_GENERATOR(3, "GasGenerator", 3, Mekanism.FROM_H2*100, TileEntityGasGenerator.class, true),
BIO_GENERATOR(4, "BioGenerator", 4, 160000, TileEntityBioGenerator.class, true),
ADVANCED_SOLAR_GENERATOR(5, "AdvancedSolarGenerator", 1, 200000, TileEntityAdvancedSolarGenerator.class, true),
WIND_TURBINE(6, "WindTurbine", 5, 200000, TileEntityWindTurbine.class, true);

View file

@ -137,6 +137,7 @@ tile.OreBlock.OsmiumOre.name=Осмиевая руда
tile.OreBlock.CopperOre.name=Медная руда
tile.OreBlock.TinOre.name=Оловянная руда
//Transmitters
item.MultipartTransmitter.PressurizedTube.name=Герметичная труба
item.MultipartTransmitter.BasicUniversalCable.name=Основной универсальный провод
item.MultipartTransmitter.AdvancedUniversalCable.name=Продвинутый универсальный провод
@ -268,6 +269,7 @@ fluid.sulfuricAcid=Жидкая серная кислота
fluid.hydrogenChloride=Жидкий хлороводород
fluid.brine=Рапа
fluid.ethene=Жидкий этилен
fluid.sodium=Жидкий натрий
//OreGas names
oregas.iron=Железная руда
@ -291,6 +293,10 @@ update.outdated=Используется устаревшая версия од
key.mode=Переключить режим
key.voice=Голос
//Config Gui
mekanism.configgui.ctgy.general.tooltip=Общие настройки, касающиеся Mekanism и всех его модулей
mekanism.configgui.ctgy.usage.tooltip=Настройки, касающиеся машин, и использования ими же энергии
//Gui text
gui.removeSpeedUpgrade=Удалить улучшение скорости
gui.removeEnergyUpgrade=Удалить улучшение энергии
@ -383,12 +389,6 @@ gui.materialFilter.details=Используется материал
gui.portableTeleporter=Переносной телепортер
gui.teleporter.notReady=Не готов
gui.teleporter.ready=Готов
gui.teleporter.needsEnergy=Нужна энергия
gui.teleporter.linksCapacity=Соединения > 2
gui.teleporter.noLink=Соединение не найдено
gui.robit=«Робит»
entity.Robit.name=«Робит»
gui.robit.smelting=«Робит»: Плавка
@ -417,6 +417,13 @@ gui.logisticalSorter.roundRobin=Цикл
gui.electricChest.editPassword=Редактировать пароль
gui.teleporter.notReady=Не готов
gui.teleporter.ready=Готов
gui.teleporter.noFrame=Нет рамки
gui.teleporter.noLink=Нет ссылки
gui.teleporter.exceeds=Ссылок больше двух
gui.teleporter.needsEnergy=Требуется энергия
gui.digitalMinerConfig=Настройки цифрового шахтёра
gui.digitalMiner.autoPull=Авто-тяга
@ -535,6 +542,8 @@ tooltip.PrecisionSawmill=Этот механизм используется дл
tooltip.ChemicalDissolutionChamber=Максимальный механизм используется для !nхимического растворения всех примесей !nруды, оставляя необработанный расплав.
tooltip.ChemicalWasher=Максимальный механизм, который очищает необработанные !nрасплавленные руды и подготавливает их для кристаллизации.
tooltip.ChemicalCrystalizer=Максимальный механизм, который используется для кристаллизации !nочищенной расплавленной руды в кристаллы.
tooltip.ChemicalOxidizer=Механизм, который окисляет !nтвердые материалы в газ.
tooltip.ChemicalInfuser=Механизм, который производит !nновый газ, путём инфузии двух других газов.
tooltip.SeismicVibrator=Механизм, который использует сейсмические колебания, чтобы !nпредоставить информацию о различных слоях мира.
tooltip.PressurizedReactionChamber=Продвинутый механизм, который обрабатывает твёрдые, жидкие и газообразные смеси и создаёт как газообразный, так и твёрдый продукт.
tooltip.PortableTank=Удобный, переносной резервуар, который позволяет переносить 14 !nвёдер жидкости, где бы Вы !nне были. Также служит в качестве ведра!
@ -559,6 +568,11 @@ control.disabled.desc=Всегда активен
control.high.desc=Активен по сигналу
control.low.desc=Активен без сигнала
//Container edit modes
fluidedit.both=Both
fluidedit.fill=Заполнять
fluidedit.empty=Выливать
//Colors
color.black=Чёрный
color.darkBlue=Тёмно-синий