Merge branch '1.8' of https://github.com/aidancbrady/Mekanism into 1.8
This commit is contained in:
commit
6271284436
18 changed files with 593 additions and 20 deletions
12
src/main/java/mekanism/api/lasers/ILaserReceptor.java
Normal file
12
src/main/java/mekanism/api/lasers/ILaserReceptor.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package mekanism.api.lasers;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface ILaserReceptor
|
||||
{
|
||||
public void receiveLaserEnergy(double energy, ForgeDirection side);
|
||||
|
||||
public boolean canLasersDig();
|
||||
|
||||
public double energyToDig();
|
||||
}
|
13
src/main/java/mekanism/api/lasers/LaserManager.java
Normal file
13
src/main/java/mekanism/api/lasers/LaserManager.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package mekanism.api.lasers;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class LaserManager
|
||||
{
|
||||
public static void fireLaser(Coord4D from, ForgeDirection direction, double energy)
|
||||
{
|
||||
//TODO: Implement this
|
||||
}
|
||||
}
|
22
src/main/java/mekanism/api/reactor/IFusionReactor.java
Normal file
22
src/main/java/mekanism/api/reactor/IFusionReactor.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package mekanism.api.reactor;
|
||||
|
||||
import mekanism.api.gas.GasTank;
|
||||
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
public interface IFusionReactor
|
||||
{
|
||||
public void addTemperature(double energyAdded);
|
||||
|
||||
public void simulate();
|
||||
|
||||
public FluidTank getWaterTank();
|
||||
|
||||
public FluidTank getSteamTank();
|
||||
|
||||
public GasTank getDeuteriumTank();
|
||||
|
||||
public GasTank getTritiumTank();
|
||||
|
||||
public GasTank getFuelTank();
|
||||
}
|
|
@ -1,7 +1,12 @@
|
|||
package mekanism.api.reactor;
|
||||
|
||||
|
||||
public interface IReactorBlock
|
||||
{
|
||||
public boolean isFrame();
|
||||
|
||||
public void setReactor(IFusionReactor reactor);
|
||||
|
||||
public IFusionReactor getReactor();
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import mekanism.common.tile.TileEntityEnergizedSmelter;
|
|||
import mekanism.common.tile.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.tile.TileEntityFluidicPlenisher;
|
||||
import mekanism.common.tile.TileEntityLaser;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
|
@ -123,6 +124,8 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
|||
* 1:9: Seismic Vibrator
|
||||
* 1:10: Pressurized Reaction Chamber
|
||||
* 1:11: Portable Tank
|
||||
* 1:12: Fluidic Plenisher
|
||||
* 1:13; Laser
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -188,6 +191,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
icons[5][2] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[9][0] = register.registerIcon("mekanism:SteelBlock");
|
||||
icons[9][1] = register.registerIcon("mekanism:SeismicVibrator");
|
||||
icons[13][0] = register.registerIcon("Mekanism:Laser");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1283,7 +1287,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
SEISMIC_VIBRATOR(Mekanism.MachineBlock2, 9, "SeismicVibrator", 39, 20000, TileEntitySeismicVibrator.class, true, true, false),
|
||||
PRESSURIZED_REACTION_CHAMBER(Mekanism.MachineBlock2, 10, "PressurizedReactionChamber", 40, 20000, TileEntityPRC.class, true, true, false),
|
||||
PORTABLE_TANK(Mekanism.MachineBlock2, 11, "PortableTank", 41, 0, TileEntityPortableTank.class, false, true, false),
|
||||
FLUIDIC_PLENISHER(Mekanism.MachineBlock2, 12, "FluidicPlenisher", 42, 10000, TileEntityFluidicPlenisher.class, true, true, false);
|
||||
FLUIDIC_PLENISHER(Mekanism.MachineBlock2, 12, "FluidicPlenisher", 42, 10000, TileEntityFluidicPlenisher.class, true, true, false),
|
||||
LASER(Mekanism.MachineBlock2, 13, "Laser", -1, 100000, TileEntityLaser.class, true, false, false);
|
||||
|
||||
public Block typeBlock;
|
||||
public int meta;
|
||||
|
|
25
src/main/java/mekanism/common/tile/TileEntityLaser.java
Normal file
25
src/main/java/mekanism/common/tile/TileEntityLaser.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.lasers.LaserManager;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityLaser extends TileEntityElectricBlock
|
||||
{
|
||||
public static final double LASER_ENERGY = 50000;
|
||||
|
||||
public TileEntityLaser()
|
||||
{
|
||||
super("Laser", 100000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if(getEnergy() >= LASER_ENERGY)
|
||||
{
|
||||
LaserManager.fireLaser(Coord4D.get(this), ForgeDirection.getOrientation(facing), LASER_ENERGY);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.api.lasers.LaserManager;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityLaserAmplifier extends TileEntity implements ILaserReceptor
|
||||
{
|
||||
public static final double MAX_ENERGY = 10000000;
|
||||
public double collectedEnergy = 0;
|
||||
public double threshold = 0;
|
||||
|
||||
public int ticks;
|
||||
public int time;
|
||||
|
||||
public ForgeDirection facing;
|
||||
|
||||
|
||||
public LaserEmitterMode mode;
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(double energy, ForgeDirection side)
|
||||
{
|
||||
collectedEnergy += energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLasersDig()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double energyToDig()
|
||||
{
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(shouldFire())
|
||||
{
|
||||
LaserManager.fireLaser(Coord4D.get(this), facing, collectedEnergy);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldFire()
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case THRESHOLD:
|
||||
return collectedEnergy > threshold;
|
||||
case REDSTONE:
|
||||
return false; //TODO implement
|
||||
case REDSTONE_PULSE:
|
||||
return false; // TODO implement
|
||||
case TIMER:
|
||||
return ticks > time;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static enum LaserEmitterMode
|
||||
{
|
||||
THRESHOLD,
|
||||
REDSTONE,
|
||||
REDSTONE_PULSE,
|
||||
TIMER;
|
||||
}
|
||||
}
|
|
@ -9,9 +9,10 @@ import java.util.Set;
|
|||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.reactor.IFusionReactor;
|
||||
import mekanism.api.reactor.INeutronCapture;
|
||||
import mekanism.api.reactor.IReactorBlock;
|
||||
import mekanism.generators.common.tile.TileEntityReactorController;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
@ -19,14 +20,14 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import static java.lang.Math.min;
|
||||
import static java.lang.Math.max;
|
||||
|
||||
public class FusionReactor
|
||||
public class FusionReactor implements IFusionReactor
|
||||
{
|
||||
public static final int MAX_WATER = 100 * FluidContainerRegistry.BUCKET_VOLUME;
|
||||
|
||||
public static final int MAX_FUEL = 100 * FluidContainerRegistry.BUCKET_VOLUME;
|
||||
|
||||
public FluidTank waterTank = new FluidTank(MAX_WATER);
|
||||
public GasTank steamTank = new GasTank(MAX_WATER*1000);
|
||||
public FluidTank steamTank = new FluidTank(MAX_WATER*1000);
|
||||
|
||||
public GasTank deuteriumTank = new GasTank(MAX_FUEL);
|
||||
public GasTank tritiumTank = new GasTank(MAX_FUEL);
|
||||
|
@ -47,10 +48,18 @@ public class FusionReactor
|
|||
public static double coolingCoefficient = 0.2;
|
||||
|
||||
public static double waterRatio = 10^-14;
|
||||
public static double inverseHeatCapacity = 1;
|
||||
|
||||
public boolean burning = false;
|
||||
public boolean hasHohlraum = false;
|
||||
|
||||
@Override
|
||||
public void addTemperature(double energyAdded)
|
||||
{
|
||||
temperature += energyAdded * inverseHeatCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulate()
|
||||
{
|
||||
if(temperature >= burnTemperature)
|
||||
|
@ -120,4 +129,34 @@ public class FusionReactor
|
|||
{
|
||||
temperature -= coolingCoefficient*temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getWaterTank()
|
||||
{
|
||||
return waterTank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getSteamTank()
|
||||
{
|
||||
return steamTank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasTank getDeuteriumTank()
|
||||
{
|
||||
return deuteriumTank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasTank getTritiumTank()
|
||||
{
|
||||
return tritiumTank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasTank getFuelTank()
|
||||
{
|
||||
return fuelTank;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import mekanism.common.Version;
|
|||
import mekanism.common.item.ItemMekanism;
|
||||
import mekanism.common.recipe.MekanismRecipe;
|
||||
import mekanism.generators.common.block.BlockGenerator;
|
||||
import mekanism.generators.common.block.BlockReactor;
|
||||
import mekanism.generators.common.item.ItemBlockGenerator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -55,6 +56,7 @@ public class MekanismGenerators implements IModule
|
|||
|
||||
//Blocks
|
||||
public static Block Generator;
|
||||
public static Block Reactor;
|
||||
|
||||
//Generation Configuration
|
||||
public static double advancedSolarGeneration;
|
||||
|
@ -138,8 +140,10 @@ public class MekanismGenerators implements IModule
|
|||
{
|
||||
//Declarations
|
||||
Generator = new BlockGenerator().setBlockName("Generator");
|
||||
Reactor = new BlockReactor().setBlockName("Reactor");
|
||||
|
||||
GameRegistry.registerBlock(Generator, ItemBlockGenerator.class, "Generator");
|
||||
GameRegistry.registerBlock(Reactor, "Reactor");
|
||||
}
|
||||
|
||||
public void addItems()
|
||||
|
|
|
@ -1,12 +1,180 @@
|
|||
package mekanism.generators.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockReactor extends Block
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IBoundingBlock;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.ISustainedTank;
|
||||
import mekanism.common.ItemAttacher;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.generators.client.GeneratorsClientProxy;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.tile.TileEntitySolarGenerator;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorFrame;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorGlass;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorLaserFocusMatrix;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorPort;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
public class BlockReactor extends BlockContainer
|
||||
{
|
||||
protected BlockReactor()
|
||||
public BlockReactor()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(3.5F);
|
||||
setResistance(8F);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item i, CreativeTabs creativetabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(i, 1, 0));
|
||||
list.add(new ItemStack(i, 1, 1));
|
||||
list.add(new ItemStack(i, 1, 2));
|
||||
list.add(new ItemStack(i, 1, 3));
|
||||
list.add(new ItemStack(i, 1, 4));
|
||||
list.add(new ItemStack(i, 1, 5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata)
|
||||
{
|
||||
ReactorBlockType type = ReactorBlockType.getFromMetadata(metadata);
|
||||
|
||||
if(type != null)
|
||||
{
|
||||
return type.create();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int j)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*This method is not used, metadata manipulation is required to create a Tile Entity.*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static enum ReactorBlockType
|
||||
{
|
||||
CONTROLLER(0, "ReactorController", 10, TileEntityReactorController.class),
|
||||
FRAME(1, "ReactorFrame", -1, TileEntityReactorFrame.class),
|
||||
GLASS(2, "ReactorGlass", -1, TileEntityReactorGlass.class),
|
||||
LASER_FOCUS_MATRIX(3, "ReactorLaserFocusMatrix", -1, TileEntityReactorLaserFocusMatrix.class),
|
||||
NEUTRON_CAPTURE(4, "ReactorNeutronCapturePlate", 11, TileEntityReactorNeutronCapture.class),
|
||||
PORT(5, "ReactorInOutPort", -1, TileEntityReactorPort.class);
|
||||
|
||||
public int meta;
|
||||
public String name;
|
||||
public int guiId;
|
||||
public Class<? extends TileEntity> tileEntityClass;
|
||||
|
||||
private ReactorBlockType(int i, String s, int j, Class<? extends TileEntity> tileClass)
|
||||
{
|
||||
meta = i;
|
||||
name = s;
|
||||
guiId = j;
|
||||
tileEntityClass = tileClass;
|
||||
}
|
||||
|
||||
public static ReactorBlockType getFromMetadata(int meta)
|
||||
{
|
||||
for(ReactorBlockType type : values())
|
||||
{
|
||||
if(type.meta == meta)
|
||||
return type;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TileEntity create()
|
||||
{
|
||||
try {
|
||||
return tileEntityClass.newInstance();
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Unable to indirectly create tile entity.");
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return MekanismUtils.localize("tooltip." + name);
|
||||
}
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return new ItemStack(MekanismGenerators.Reactor, 1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return Integer.toString(meta);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package mekanism.generators.common.tile;
|
||||
|
||||
import mekanism.api.reactor.IReactorBlock;
|
||||
|
||||
/**
|
||||
* Created by ben on 10/07/14.
|
||||
*/
|
||||
public abstract class TileEntityReactorBlock implements IReactorBlock
|
||||
{
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
import mekanism.api.reactor.IFusionReactor;
|
||||
import mekanism.api.reactor.IReactorBlock;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public abstract class TileEntityReactorBlock extends TileEntity implements IReactorBlock
|
||||
{
|
||||
public IFusionReactor fusionReactor;
|
||||
|
||||
@Override
|
||||
public void setReactor(IFusionReactor reactor)
|
||||
{
|
||||
fusionReactor = reactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFusionReactor getReactor()
|
||||
{
|
||||
return fusionReactor;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package mekanism.generators.common.tile;
|
||||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
public class TileEntityReactorController extends TileEntityReactorBlock
|
||||
{
|
||||
|
@ -10,6 +10,5 @@ public class TileEntityReactorController extends TileEntityReactorBlock
|
|||
|
||||
public void radiateNeutrons(int neutrons)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
public class TileEntityReactorFrame extends TileEntityReactorBlock
|
||||
{
|
||||
@Override
|
||||
public boolean isFrame()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
public class TileEntityReactorGlass extends TileEntityReactorBlock
|
||||
{
|
||||
@Override
|
||||
public boolean isFrame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.api.reactor.IFusionReactor;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityReactorLaserFocusMatrix extends TileEntityReactorBlock implements ILaserReceptor
|
||||
{
|
||||
public IFusionReactor fusionReactor;
|
||||
|
||||
@Override
|
||||
public boolean isFrame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(double energy, ForgeDirection side)
|
||||
{
|
||||
fusionReactor.addTemperature(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLasersDig()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double energyToDig()
|
||||
{
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
import mekanism.api.reactor.INeutronCapture;
|
||||
|
||||
public class TileEntityReactorNeutronCapture extends TileEntityReactorBlock implements INeutronCapture
|
||||
{
|
||||
@Override
|
||||
public boolean isFrame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int absorbNeutrons(int neutrons)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityReactorPort extends TileEntityReactorBlock implements IFluidHandler, IGasHandler
|
||||
{
|
||||
@Override
|
||||
public boolean isFrame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if(resource.getFluid() == FluidRegistry.WATER && getReactor() != null)
|
||||
{
|
||||
return getReactor().getWaterTank().fill(resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if(resource.getFluid() == FluidRegistry.getFluid("steam") && getReactor() != null)
|
||||
{
|
||||
getReactor().getSteamTank().drain(resource.amount, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
if(getReactor() != null)
|
||||
{
|
||||
getReactor().getSteamTank().drain(maxDrain, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return (getReactor() != null && fluid == FluidRegistry.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return (getReactor() != null && fluid == FluidRegistry.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
if(getReactor() == null)
|
||||
{
|
||||
return new FluidTankInfo[0];
|
||||
}
|
||||
return new FluidTankInfo[] {getReactor().getWaterTank().getInfo(), getReactor().getSteamTank().getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveGas(ForgeDirection side, GasStack stack)
|
||||
{
|
||||
if(getReactor() != null)
|
||||
{
|
||||
if(stack.getGas() == GasRegistry.getGas("deuterium"))
|
||||
{
|
||||
return getReactor().getDeuteriumTank().receive(stack, true);
|
||||
}
|
||||
else if(stack.getGas() == GasRegistry.getGas("tritium"))
|
||||
{
|
||||
return getReactor().getTritiumTank().receive(stack, true);
|
||||
}
|
||||
else if(stack.getGas() == GasRegistry.getGas("fusionFuel"))
|
||||
{
|
||||
return getReactor().getFuelTank().receive(stack, true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasStack drawGas(ForgeDirection side, int amount)
|
||||
{
|
||||
if(getReactor() != null)
|
||||
{
|
||||
if(getReactor().getSteamTank().getFluidAmount() > 0)
|
||||
{
|
||||
return new GasStack(GasRegistry.getGas("steam"), getReactor().getSteamTank().drain(amount, true).amount);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return (type == GasRegistry.getGas("deuterium") || type == GasRegistry.getGas("tritium") || type == GasRegistry.getGas("fusionFuel"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrawGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return (type == GasRegistry.getGas("steam"));
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue