Removed unused classes
This commit is contained in:
parent
805dfe3db0
commit
10c2794e35
40 changed files with 30 additions and 2354 deletions
|
@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import resonantinduction.archaic.blocks.BlockMachineMaterial;
|
||||
import resonantinduction.archaic.blocks.BlockTurntable;
|
||||
import resonantinduction.archaic.crate.BlockCrate;
|
||||
import resonantinduction.archaic.crate.ItemBlockCrate;
|
||||
|
@ -26,7 +27,6 @@ import resonantinduction.core.Reference;
|
|||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.part.BlockMachineMaterial;
|
||||
import calclavia.lib.content.ContentRegistry;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.prefab.item.ItemBlockMetadata;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.part;
|
||||
package resonantinduction.archaic.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package resonantinduction.core.network;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
/**
|
||||
* Simplified version of IPackerReceiver for tiles that only need a packet ID, data, and player
|
||||
* Reference
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ISimplePacketReceiver
|
||||
{
|
||||
/**
|
||||
* Simplified version of IPacketReceiver's HandlePacketData
|
||||
*
|
||||
* @param id - packet ID as a string
|
||||
* @param data - data from the packet, after location has been read
|
||||
* @param player - player that the packet was sent to or came from
|
||||
* @return true if the packet was used
|
||||
*/
|
||||
public boolean simplePacket(String id, ByteArrayDataInput data, Player player);
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package resonantinduction.core.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.PacketType;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/**
|
||||
* Packet handler for blocks and tile entities.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
public class PacketIDTile extends PacketType
|
||||
{
|
||||
public PacketIDTile(String channel)
|
||||
{
|
||||
super(channel);
|
||||
}
|
||||
|
||||
public Packet getPacket(TileEntity tileEntity, String id, Object... args)
|
||||
{
|
||||
return this.getPacket(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, id, args);
|
||||
}
|
||||
|
||||
public Packet getPacket(int x, int y, int z, String id, Object... args)
|
||||
{
|
||||
List newArgs = new ArrayList();
|
||||
|
||||
newArgs.add(x);
|
||||
newArgs.add(y);
|
||||
newArgs.add(z);
|
||||
newArgs.add(id);
|
||||
|
||||
for (Object obj : args)
|
||||
{
|
||||
newArgs.add(obj);
|
||||
}
|
||||
|
||||
return super.getPacket(newArgs.toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receivePacket(ByteArrayDataInput data, EntityPlayer player)
|
||||
{
|
||||
int x = data.readInt();
|
||||
int y = data.readInt();
|
||||
int z = data.readInt();
|
||||
String id = data.readUTF();
|
||||
TileEntity tileEntity = player.worldObj.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof IPacketReceiver)
|
||||
{
|
||||
((IPacketReceiver) tileEntity).onReceivePacket(data, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
int blockID = player.worldObj.getBlockId(x, y, z);
|
||||
|
||||
if (Block.blocksList[blockID] instanceof IPacketReceiver)
|
||||
{
|
||||
((IPacketReceiver) Block.blocksList[blockID]).onReceivePacket(data, player, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.prefab.block;
|
||||
package resonantinduction.core.prefab;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -10,7 +10,6 @@ import net.minecraft.util.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import resonantinduction.api.IFilterable;
|
||||
import resonantinduction.archaic.imprint.ItemImprint;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import calclavia.lib.prefab.block.BlockRotatable;
|
||||
|
||||
/**
|
||||
|
@ -75,9 +74,9 @@ public abstract class BlockImprintable extends BlockRotatable
|
|||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (tileEntity instanceof TileEntityFilterable)
|
||||
if (tileEntity instanceof TileFilterable)
|
||||
{
|
||||
((TileEntityFilterable) tileEntity).toggleInversion();
|
||||
((TileFilterable) tileEntity).toggleInversion();
|
||||
world.markBlockForRenderUpdate(x, y, z);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package resonantinduction.core.prefab;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/**
|
||||
* Tank that has a filter on the fluid ids it will accept
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class FilteredTank extends FluidTank
|
||||
{
|
||||
private List<Integer> fluidIds = new ArrayList<Integer>();
|
||||
boolean gas = true;
|
||||
boolean liquid = true;
|
||||
|
||||
public FilteredTank(int capacity, int... fluidIds)
|
||||
{
|
||||
this(capacity, true, true, fluidIds);
|
||||
}
|
||||
|
||||
public FilteredTank(int capacity, boolean gas, boolean liquid, int... fluidIds)
|
||||
{
|
||||
super(capacity);
|
||||
this.gas = gas;
|
||||
this.liquid = liquid;
|
||||
for (int id : fluidIds)
|
||||
{
|
||||
this.fluidIds.add(id);
|
||||
}
|
||||
}
|
||||
|
||||
public FilteredTank(FluidStack stack, int capacity)
|
||||
{
|
||||
super(stack, capacity);
|
||||
}
|
||||
|
||||
public FilteredTank(Fluid fluid, int amount, int capacity)
|
||||
{
|
||||
super(fluid, amount, capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource != null && resource.getFluid() != null && (!gas || gas && resource.getFluid().isGaseous()) && (!liquid || liquid && !resource.getFluid().isGaseous()))
|
||||
{
|
||||
if (fluidIds.contains(resource.fluidID))
|
||||
{
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package resonantinduction.core.prefab;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/**
|
||||
* Version of the fluid tank that is restricted to gases only
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class GasTank extends FluidTank
|
||||
{
|
||||
|
||||
public GasTank(int capacity)
|
||||
{
|
||||
super(capacity);
|
||||
}
|
||||
|
||||
public GasTank(FluidStack stack, int capacity)
|
||||
{
|
||||
super(stack, capacity);
|
||||
}
|
||||
|
||||
public GasTank(Fluid fluid, int amount, int capacity)
|
||||
{
|
||||
super(fluid, amount, capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource != null && resource.getFluid() != null && resource.getFluid().isGaseous())
|
||||
{
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package resonantinduction.core.prefab;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/**
|
||||
* Version of the fluid tank that only supports liquids
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class LiquidTank extends FluidTank
|
||||
{
|
||||
|
||||
public LiquidTank(int capacity)
|
||||
{
|
||||
super(capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(FluidStack stack, int capacity)
|
||||
{
|
||||
super(stack, capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(Fluid fluid, int amount, int capacity)
|
||||
{
|
||||
super(fluid, amount, capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource != null && resource.getFluid() != null && !resource.getFluid().isGaseous())
|
||||
{
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.core.prefab.tile;
|
||||
package resonantinduction.core.prefab;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -10,14 +10,14 @@ import resonantinduction.archaic.imprint.ItemImprint;
|
|||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
import calclavia.lib.prefab.tile.TileExternalInventory;
|
||||
|
||||
public abstract class TileEntityFilterable extends TileExternalInventory implements IRotatable, IFilterable
|
||||
public abstract class TileFilterable extends TileExternalInventory implements IRotatable, IFilterable
|
||||
{
|
||||
private ItemStack filterItem;
|
||||
private boolean inverted;
|
||||
public static final int FILTER_SLOT = 0;
|
||||
public static final int BATERY_DRAIN_SLOT = 1;
|
||||
|
||||
public TileEntityFilterable()
|
||||
public TileFilterable()
|
||||
{
|
||||
this.maxSlots = 2;
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package resonantinduction.core.prefab.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import resonantinduction.core.Settings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockColorGlass extends BlockColored
|
||||
{
|
||||
|
||||
public BlockColorGlass(String name)
|
||||
{
|
||||
super(name, Settings.CONFIGURATION.getBlock(name, Settings.getNextBlockID()).getInt(), Material.glass);
|
||||
this.setCreativeTab(CreativeTabs.tabDecorations);
|
||||
this.setHardness(.5f);
|
||||
this.setResistance(.5f);
|
||||
this.setStepSound(soundGlassFootstep);
|
||||
}
|
||||
|
||||
public BlockColorGlass()
|
||||
{
|
||||
this("StainedGlass");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package resonantinduction.core.prefab.block;
|
||||
|
||||
public class BlockColorGlowGlass extends BlockColorGlass
|
||||
{
|
||||
|
||||
public BlockColorGlowGlass()
|
||||
{
|
||||
super("GlowGlass");
|
||||
this.setLightOpacity(2);
|
||||
this.setLightValue(1);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package resonantinduction.core.prefab.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Settings;
|
||||
|
||||
//TODO fix instant falling sand
|
||||
public class BlockColorSand extends BlockColored
|
||||
{
|
||||
public BlockColorSand()
|
||||
{
|
||||
super("colorSand", Settings.CONFIGURATION.getBlock("colorSand", Settings.getNextBlockID()).getInt(), Material.sand);
|
||||
this.setCreativeTab(CreativeTabs.tabDecorations);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(.5f);
|
||||
}
|
||||
|
||||
public static boolean fallInstantly = true;
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
this.tryToFall(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
private void tryToFall(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
if (canFallBelow(par1World, par2, par3 - 1, par4) && par3 >= 0)
|
||||
{
|
||||
byte var8 = 32;
|
||||
|
||||
if (!fallInstantly && par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8))
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlock(par2, par3, par4, 0);
|
||||
|
||||
while (canFallBelow(par1World, par2, par3 - 1, par4) && par3 > 0)
|
||||
{
|
||||
--par3;
|
||||
}
|
||||
|
||||
if (par3 > 0)
|
||||
{
|
||||
par1World.setBlock(par2, par3, par4, this.blockID, meta, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int tickRate()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public static boolean canFallBelow(World par0World, int par1, int par2, int par3)
|
||||
{
|
||||
int var4 = par0World.getBlockId(par1, par2, par3);
|
||||
|
||||
if (var4 == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (var4 == Block.fire.blockID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Material var5 = Block.blocksList[var4].blockMaterial;
|
||||
return var5 == Material.water ? true : var5 == Material.lava;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package resonantinduction.core.prefab.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import resonantinduction.core.Reference;
|
||||
import calclavia.lib.render.ColorCode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Prefab class to make any block have 16 separate color instances similar to wool block
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class BlockColored extends Block
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] icons;
|
||||
|
||||
/** Use a single icon to create all 16 colors */
|
||||
boolean colorized = true;
|
||||
|
||||
public BlockColored(String name, int id, Material par2Material)
|
||||
{
|
||||
super(id, par2Material);
|
||||
this.setUnlocalizedName(name);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getIcon(int side, int meta)
|
||||
{
|
||||
if (colorized)
|
||||
{
|
||||
return this.blockIcon;
|
||||
}
|
||||
return this.icons[~meta & 15];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs tab, List contentList)
|
||||
{
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
contentList.add(new ItemStack(par1, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconReg)
|
||||
{
|
||||
if (colorized)
|
||||
{
|
||||
this.blockIcon = iconReg.registerIcon(Reference.PREFIX + this.getUnlocalizedName().replace("tile.", ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.icons = new Icon[16];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconReg.registerIcon(Reference.PREFIX + ColorCode.get(~i & 15).name + this.getUnlocalizedName().replace("tile.", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return this.getRenderColor(world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderColor(int meta)
|
||||
{
|
||||
if (this.colorized)
|
||||
{
|
||||
return ColorCode.get(~meta & 15).color.getRGB();
|
||||
}
|
||||
return super.getRenderColor(meta);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,147 +0,0 @@
|
|||
package resonantinduction.core.prefab.tile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiverWithID;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.prefab.tile.TileElectrical;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/**
|
||||
* Prefab for general machines
|
||||
*
|
||||
* @author Darkguardsman
|
||||
*/
|
||||
public class TileMachine extends TileElectrical implements IPacketReceiverWithID
|
||||
{
|
||||
/** Is the machine functioning normally */
|
||||
protected boolean functioning = false;
|
||||
/** Prev state of function of last update */
|
||||
protected boolean prevFunctioning = false;
|
||||
|
||||
protected long joulesPerTick = 0;
|
||||
|
||||
public static final int IS_RUN_PACKET_ID = 0;
|
||||
public static final int NBT_PACKET_ID = 1;
|
||||
public static final int ENERGY_PACKET_ID = 2;
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.prevFunctioning = this.functioning;
|
||||
this.functioning = this.isFunctioning();
|
||||
|
||||
if (prevFunctioning != this.functioning)
|
||||
{
|
||||
this.sendRunningPacket();
|
||||
}
|
||||
if (this.isFunctioning())
|
||||
{
|
||||
this.consumePower(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean consumePower(boolean doConsume)
|
||||
{
|
||||
return this.consumePower(this.joulesPerTick, doConsume);
|
||||
}
|
||||
|
||||
public boolean consumePower(long joules, boolean doConsume)
|
||||
{
|
||||
return this.energy.extractEnergy(joules, doConsume) >= joules;
|
||||
}
|
||||
|
||||
/** Can this tile function, or run threw normal processes */
|
||||
public boolean canFunction()
|
||||
{
|
||||
return this.consumePower(false);
|
||||
}
|
||||
|
||||
/** Called too see if the machine is functioning, server side it redirects to canFunction */
|
||||
public boolean isFunctioning()
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
return this.functioning;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.canFunction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
if (id == IS_RUN_PACKET_ID)
|
||||
{
|
||||
this.functioning = data.readBoolean();
|
||||
return true;
|
||||
}
|
||||
if (id == NBT_PACKET_ID)
|
||||
{
|
||||
this.readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||
return true;
|
||||
}
|
||||
if (id == ENERGY_PACKET_ID)
|
||||
{
|
||||
this.energy.readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Sends the tileEntity save data to the client */
|
||||
public void sendNBTPacket()
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.writeToNBT(tag);
|
||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, NBT_PACKET_ID, this, tag), worldObj, new Vector3(this), 64);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sends a simple true/false am running power update */
|
||||
public void sendRunningPacket()
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, IS_RUN_PACKET_ID, this, this.functioning), worldObj, new Vector3(this), 64);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendPowerPacket()
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, ENERGY_PACKET_ID, this, this.energy.writeToNBT(new NBTTagCompound())), worldObj, new Vector3(this), 64);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning);
|
||||
}
|
||||
}
|
|
@ -23,9 +23,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderRIItem implements IItemRenderer
|
||||
public class RIRenderItem implements IItemRenderer
|
||||
{
|
||||
public static final RenderRIItem INSTANCE = new RenderRIItem();
|
||||
public static final RIRenderItem INSTANCE = new RIRenderItem();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
|
@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import resonantinduction.archaic.imprint.ItemImprint;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import resonantinduction.core.prefab.TileFilterable;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -26,9 +26,9 @@ public abstract class RenderImprintable extends TileEntitySpecialRenderer
|
|||
{
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (tileEntity instanceof TileEntityFilterable)
|
||||
if (tileEntity instanceof TileFilterable)
|
||||
{
|
||||
TileEntityFilterable tileFilterable = (TileEntityFilterable) tileEntity;
|
||||
TileFilterable tileFilterable = (TileFilterable) tileEntity;
|
||||
|
||||
ItemStack filter = tileFilterable.getFilter();
|
||||
|
||||
|
@ -46,7 +46,7 @@ public abstract class RenderImprintable extends TileEntitySpecialRenderer
|
|||
int i = 0;
|
||||
for (ItemStack filterStack : filters)
|
||||
{
|
||||
if (((TileEntityFilterable) tileEntity).isInverted())
|
||||
if (((TileFilterable) tileEntity).isInverted())
|
||||
{
|
||||
RenderUtility.renderFloatingText(filterStack.getTooltip(player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips).get(0).toString(), new Vector3(x, y, z).translate(0.5, i * 0.25f - 1f, z + 0.5f), 0xFF8888);
|
||||
}
|
||||
|
|
|
@ -1,196 +0,0 @@
|
|||
package resonantinduction.core.resource;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialTransparent;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.mechanical.fluid.EnumGas;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Gas that is designed to generate underground in the same way as an ore
|
||||
*
|
||||
* TODO code actual gas behavior such as expanding to fill an area but at the same time losing
|
||||
* volume
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class BlockGasOre extends Block implements IFluidBlock
|
||||
{
|
||||
public static final int[] volumePerMeta = new int[] { 10, 35, 75, 125, 250, 500, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 12800, 256000, 512000 };
|
||||
public static final Material gas = new MaterialTransparent(MapColor.airColor).setReplaceable();
|
||||
|
||||
public BlockGasOre()
|
||||
{
|
||||
super(Settings.CONFIGURATION.getBlock("GasBlock", Settings.getNextBlockID()).getInt(), gas);
|
||||
this.setUnlocalizedName("BlockGas");
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate(World par1World)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
|
||||
final Vector3 vec = new Vector3(x, y, z);
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
Vector3 sVec = vec.clone().modifyPositionFromSide(dir);
|
||||
int sMeta = sVec.getBlockMetadata(world);
|
||||
int blockID = sVec.getBlockID(world);
|
||||
Block block = Block.blocksList[blockID];
|
||||
|
||||
if (blockID == 0 || block == null || block != null && block.isAirBlock(world, x, y, z) && blockID != this.blockID)
|
||||
{
|
||||
if (meta == 0)
|
||||
{
|
||||
world.setBlockToAir(x, y, z);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlock(x, y, z, this.blockID, meta / 2, 2);
|
||||
sVec.setBlock(world, this.blockID, meta / 2, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (blockID == this.blockID && meta > sMeta)
|
||||
{
|
||||
meta += sMeta;
|
||||
world.setBlock(x, y, z, this.blockID, meta / 2, 2);
|
||||
sVec.setBlock(world, this.blockID, meta / 2, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* IFluidBlock */
|
||||
@Override
|
||||
public FluidStack drain(World world, int x, int y, int z, boolean doDrain)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
FluidStack fluid = new FluidStack(EnumGas.NATURAL_GAS.getGas(), volumePerMeta[meta]);
|
||||
if (doDrain || fluid == null)
|
||||
{
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(World world, int x, int y, int z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getFluid()
|
||||
{
|
||||
return EnumGas.NATURAL_GAS.getGas();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollidable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int par1, int par2)
|
||||
{
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(Reference.PREFIX + "gas");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockColor()
|
||||
{
|
||||
return Color.yellow.getRGB();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int par1)
|
||||
{
|
||||
// TODO make the color darker as the meta value goes higher
|
||||
return this.getBlockColor();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return this.getRenderColor(world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int blockID, CreativeTabs tab, List creativeTabList)
|
||||
{
|
||||
creativeTabList.add(new ItemStack(blockID, 1, 15));
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork;
|
||||
|
||||
/**
|
||||
* Used on tiles that can contain more than one tile network. Currently WIP so don't use unless you
|
||||
* know what your doing. When using this use networks like items and store them in slots.
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public interface INetworkContainer
|
||||
{
|
||||
/**
|
||||
* Gets a list of all networks slots and their connected networks. Used both to see the max
|
||||
* limit of networks this tile may contain, and if there are networks currently in use
|
||||
*/
|
||||
public ITileNetwork[] getContainedNetworks();
|
||||
|
||||
/** Sets the network in the given slot */
|
||||
public boolean setNetwork(int slot, ITileNetwork network);
|
||||
|
||||
/** Gets the network in the slot */
|
||||
public ITileNetwork getNetwork(int slot);
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork;
|
||||
|
||||
import universalelectricity.api.energy.IEnergyContainer;
|
||||
|
||||
/**
|
||||
* Tiles that use NetworkSharedPower class should implements this. All methods in IElectricalStorage
|
||||
* should point to the network instead of the tile. This is why more energy methods are added to
|
||||
* this interface
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public interface INetworkEnergyPart extends INetworkPart, IEnergyContainer
|
||||
{
|
||||
/** Gets the energy stored in the part */
|
||||
public long getPartEnergy();
|
||||
|
||||
/** Gets the max energy storage limit of the part */
|
||||
public long getPartMaxEnergy();
|
||||
|
||||
/** Sets the energy stored in the part */
|
||||
public void setPartEnergy(long energy);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface INetworkPart extends ITileConnector
|
||||
{
|
||||
/** Array of connections this tile has to other tiles */
|
||||
public List<TileEntity> getNetworkConnections();
|
||||
|
||||
/** Update the connection this tile has to other tiles */
|
||||
public void refresh();
|
||||
|
||||
/** Gets the networkPart's primary network */
|
||||
public ITileNetwork getTileNetwork();
|
||||
|
||||
/** Sets the networkPart's primary network */
|
||||
public void setTileNetwork(ITileNetwork network);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Used on tiles that want control over what can connect to there device. It is suggest that other
|
||||
* interfaces for connection be routed threw this to reduce the need to change things
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public interface ITileConnector
|
||||
{
|
||||
/** Can this tile connect on the given side */
|
||||
public boolean canTileConnect(Connection type, ForgeDirection dir);
|
||||
|
||||
/** Types of connections */
|
||||
public static enum Connection
|
||||
{
|
||||
/** Energy from BC, UE, IC2 */
|
||||
Eletricity(),
|
||||
/** Fluids from anything including BC pipes, DM pipes, Mek pipes */
|
||||
FLUIDS(),
|
||||
/** Force mainly from rotating rods */
|
||||
FORCE(),
|
||||
/** Hydraulic pressure from DM pipe */
|
||||
FLUID_PRESSURE(), AIR_PRESSURE(),
|
||||
/** Item pipe */
|
||||
ITEMS(),
|
||||
/** Data line input */
|
||||
DATA(),
|
||||
/** Another tile entity */
|
||||
TILE(),
|
||||
/** Network of tile entities */
|
||||
NETWORK(),
|
||||
/** Thermal connection */
|
||||
HEAT(),
|
||||
/** Wire containing several wires of unknown color */
|
||||
MULTI_WIRE(),
|
||||
/** Bundle of pipes containing several colored pipes */
|
||||
MULTI_PIPE(),
|
||||
/** Device that contains several networks that can be of any type */
|
||||
MULTI_NETWORK();
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Applies to objects that act as a collection of tile entities.
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public interface ITileNetwork
|
||||
{
|
||||
/** Gets the name of the network */
|
||||
public String getName();
|
||||
|
||||
/** Gets a list of all tiles that are part of this network */
|
||||
public Set<INetworkPart> getMembers();
|
||||
|
||||
/**
|
||||
* Called when something want the network to add the tile
|
||||
*
|
||||
* @param entity - tile in question
|
||||
* @param member - add it as a member if true
|
||||
* @return true if added without issue
|
||||
*/
|
||||
public boolean addTile(TileEntity ent, boolean member);
|
||||
|
||||
/** Removes a tile from all parts of the network */
|
||||
public boolean removeTile(TileEntity ent);
|
||||
|
||||
/** Called when this network is just created */
|
||||
public void onCreated();
|
||||
|
||||
/** How many ticks should base between updates, return 0 or bellow for no ticks */
|
||||
public int getUpdateRate();
|
||||
|
||||
/** Called every so many ticks so the network has a chance to update */
|
||||
public void updateTick();
|
||||
|
||||
/**
|
||||
* Called every so many mins when the networks needs to refresh and repair. Each part should
|
||||
* still handle there own refresh when edited, or updated. This is more for the network to do
|
||||
* house cleaning
|
||||
*/
|
||||
public void refreshTick();
|
||||
|
||||
/** Called when two networks try to merge together */
|
||||
public void mergeNetwork(ITileNetwork network, INetworkPart mergePoint);
|
||||
|
||||
/** Called when a peace of the network is removed and might need to split in two */
|
||||
public void splitNetwork(INetworkPart splitPoint);
|
||||
|
||||
/** Check by the network handle if this network is invalid or no longer functional */
|
||||
public boolean isInvalid();
|
||||
|
||||
/**
|
||||
* This is called when your network is considered invalid. You should cut all ties in the
|
||||
* network to its object so GC will delete it
|
||||
*/
|
||||
public void invalidate();
|
||||
|
||||
/** Called when the network needs to save */
|
||||
public void save();
|
||||
|
||||
/** Called when the network needs to load */
|
||||
public void load();
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork.prefab;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.tilenetwork.INetworkPart;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.path.IPathCallBack;
|
||||
import calclavia.lib.path.Pathfinder;
|
||||
|
||||
/** Check if a conductor connects with another. */
|
||||
public class NetworkPathFinder extends Pathfinder
|
||||
{
|
||||
public NetworkPathFinder(final World world, final INetworkPart targetPoint, final INetworkPart... ignoredTiles)
|
||||
{
|
||||
super(new IPathCallBack()
|
||||
{
|
||||
@Override
|
||||
public Set<Vector3> getConnectedNodes(Pathfinder finder, Vector3 currentNode)
|
||||
{
|
||||
Set<Vector3> neighbors = new HashSet<Vector3>();
|
||||
TileEntity tile = currentNode.getTileEntity(world);
|
||||
if (tile instanceof INetworkPart)
|
||||
{
|
||||
for (TileEntity ent : ((INetworkPart) tile).getNetworkConnections())
|
||||
{
|
||||
if (ent instanceof INetworkPart)
|
||||
{
|
||||
neighbors.add(new Vector3(ent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return neighbors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSearch(Pathfinder finder, Vector3 start, Vector3 node)
|
||||
{
|
||||
if (node.getTileEntity(world) == targetPoint)
|
||||
{
|
||||
finder.results.add(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork.prefab;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import resonantinduction.core.tilenetwork.INetworkEnergyPart;
|
||||
import resonantinduction.core.tilenetwork.INetworkPart;
|
||||
|
||||
/**
|
||||
* Used for tile networks that only need to share power or act like a group battery that doesn't
|
||||
* store power on world save
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class NetworkSharedPower extends NetworkTileEntities
|
||||
{
|
||||
private long energy, energyMax;
|
||||
private boolean runPowerLess;
|
||||
|
||||
public NetworkSharedPower(INetworkPart... parts)
|
||||
{
|
||||
super(parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidMember(INetworkPart part)
|
||||
{
|
||||
return super.isValidMember(part) && part instanceof INetworkEnergyPart;
|
||||
}
|
||||
|
||||
public long addPower(TileEntity entity, long receive, boolean doReceive)
|
||||
{
|
||||
if (receive > 0)
|
||||
{
|
||||
long prevEnergyStored = this.getEnergy();
|
||||
long newStoredEnergy = Math.min(this.getEnergy() + receive, this.getEnergyCapacity());
|
||||
|
||||
if (doReceive)
|
||||
{
|
||||
this.setEnergy(newStoredEnergy);
|
||||
}
|
||||
|
||||
return Math.max(newStoredEnergy - prevEnergyStored, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long removePower(TileEntity entity, long request, boolean doExtract)
|
||||
{
|
||||
if (request > 0)
|
||||
{
|
||||
long requestedEnergy = Math.min(request, this.getEnergy());
|
||||
if (doExtract)
|
||||
{
|
||||
this.setEnergy(this.getEnergy() - requestedEnergy);
|
||||
}
|
||||
return requestedEnergy;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanUpMembers()
|
||||
{
|
||||
super.cleanUpMembers();
|
||||
boolean set = false;
|
||||
this.energyMax = 0;
|
||||
for (INetworkPart part : this.networkMembers)
|
||||
{
|
||||
|
||||
if (part instanceof INetworkEnergyPart)
|
||||
{
|
||||
this.energyMax += ((INetworkEnergyPart) part).getPartMaxEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setEnergy(long energy)
|
||||
{
|
||||
this.energy = energy;
|
||||
}
|
||||
|
||||
public long getEnergy()
|
||||
{
|
||||
return this.energy;
|
||||
}
|
||||
|
||||
public long getEnergyCapacity()
|
||||
{
|
||||
return this.energyMax;
|
||||
}
|
||||
|
||||
/** Space left to store more energy */
|
||||
public float getEnergySpace()
|
||||
{
|
||||
return Math.max(this.getEnergyCapacity() - this.getEnergy(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
this.cleanUpMembers();
|
||||
long energyRemaining = this.getEnergy();
|
||||
for (INetworkPart part : this.getMembers())
|
||||
{
|
||||
long watts = energyRemaining / this.getMembers().size();
|
||||
if (part instanceof INetworkEnergyPart)
|
||||
{
|
||||
((INetworkEnergyPart) part).setPartEnergy(Math.min(watts, ((INetworkEnergyPart) part).getPartMaxEnergy()));
|
||||
energyRemaining -= Math.min(((INetworkEnergyPart) part).getPartEnergy(), ((INetworkEnergyPart) part).getPartMaxEnergy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
this.setEnergy(0);
|
||||
this.cleanUpMembers();
|
||||
this.energyMax = 0;
|
||||
for (INetworkPart part : this.getMembers())
|
||||
{
|
||||
if (part instanceof INetworkEnergyPart)
|
||||
{
|
||||
this.energyMax += ((INetworkEnergyPart) part).getPartMaxEnergy();
|
||||
this.setEnergy(this.getEnergy() + ((INetworkEnergyPart) part).getPartEnergy());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,280 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork.prefab;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.tilenetwork.INetworkPart;
|
||||
import resonantinduction.core.tilenetwork.ITileNetwork;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.api.vector.VectorHelper;
|
||||
import calclavia.lib.path.Pathfinder;
|
||||
|
||||
public class NetworkTileEntities implements ITileNetwork
|
||||
{
|
||||
protected Set<INetworkPart> networkMembers = new HashSet<INetworkPart>();
|
||||
|
||||
public NetworkTileEntities()
|
||||
{
|
||||
NetworkUpdateHandler.instance().registerNetwork(this);
|
||||
}
|
||||
|
||||
public NetworkTileEntities(INetworkPart... parts)
|
||||
{
|
||||
this();
|
||||
if (parts != null)
|
||||
{
|
||||
for (INetworkPart part : parts)
|
||||
{
|
||||
if (this.isValidMember(part))
|
||||
{
|
||||
part.setTileNetwork(this);
|
||||
networkMembers.add(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "TileNetwork";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<INetworkPart> getMembers()
|
||||
{
|
||||
if (this.networkMembers == null)
|
||||
{
|
||||
this.networkMembers = new HashSet<INetworkPart>();
|
||||
}
|
||||
return networkMembers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated()
|
||||
{
|
||||
this.load();
|
||||
this.cleanUpMembers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpdateRate()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshTick()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addTile(TileEntity ent, boolean member)
|
||||
{
|
||||
if (ent == null || ent.isInvalid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (ent instanceof INetworkPart && this.isValidMember((INetworkPart) ent) && member)
|
||||
{
|
||||
((INetworkPart) ent).setTileNetwork(this);
|
||||
if (this.networkMembers.contains(ent))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return this.networkMembers.add((INetworkPart) ent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeTile(TileEntity ent)
|
||||
{
|
||||
return this.networkMembers.remove(ent);
|
||||
}
|
||||
|
||||
/** Cleans the list of networkMembers and remove those that no longer belong */
|
||||
public void cleanUpMembers()
|
||||
{
|
||||
Iterator<INetworkPart> it = this.networkMembers.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
INetworkPart part = it.next();
|
||||
if (!this.isValidMember(part))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
part.setTileNetwork(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Is this part a valid member of the network */
|
||||
public boolean isValidMember(INetworkPart part)
|
||||
{
|
||||
return part != null && part instanceof TileEntity && !((TileEntity) part).isInvalid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mergeNetwork(ITileNetwork network, INetworkPart mergePoint)
|
||||
{
|
||||
if (network != null && network != this && network.getClass().equals(this.getClass()))
|
||||
{
|
||||
if (this.preMergeProcessing(network, mergePoint))
|
||||
{
|
||||
this.mergeDo(network);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processing that needs too be done before the network merges. Use this to do final network
|
||||
* merge calculations and to cause network merge failure
|
||||
*
|
||||
* @param network the network that is to merge with this one
|
||||
* @param part the part at which started the network merge. Use this to cause damage if two
|
||||
* networks merge with real world style failures
|
||||
*
|
||||
* @return false if the merge needs to be canceled.
|
||||
*
|
||||
* Cases in which the network should fail to merge are were the two networks merge with error.
|
||||
* Or, in the case of pipes the two networks merge and the merge point was destroyed by
|
||||
* combination of liquids.
|
||||
*
|
||||
* Ex Lava and water
|
||||
*/
|
||||
public boolean preMergeProcessing(ITileNetwork network, INetworkPart part)
|
||||
{
|
||||
this.save();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Merges the two networks together */
|
||||
protected void mergeDo(ITileNetwork network)
|
||||
{
|
||||
ITileNetwork newNetwork = NetworkUpdateHandler.createNewNetwork(NetworkUpdateHandler.getID(this.getClass()));
|
||||
if (newNetwork != null)
|
||||
{
|
||||
newNetwork.getMembers().addAll(this.getMembers());
|
||||
newNetwork.getMembers().addAll(network.getMembers());
|
||||
newNetwork.onCreated();
|
||||
this.invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("[CoreMachine]NetworkTileEntities: Failed to merge network due to network creation failure");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void splitNetwork(INetworkPart splitPoint)
|
||||
{
|
||||
this.getMembers().remove(splitPoint);
|
||||
if (splitPoint instanceof TileEntity)
|
||||
{
|
||||
List<TileEntity> connections = splitPoint.getNetworkConnections();
|
||||
|
||||
for (final TileEntity connectionStart : connections)
|
||||
{
|
||||
if (connectionStart instanceof INetworkPart)
|
||||
{
|
||||
for (final TileEntity connectionEnd : connections)
|
||||
{
|
||||
if (connectionStart != connectionEnd && connectionEnd instanceof INetworkPart)
|
||||
{
|
||||
Pathfinder finder = new NetworkPathFinder(connectionEnd.worldObj, (INetworkPart) connectionEnd, splitPoint);
|
||||
finder.init(new Vector3(connectionStart));
|
||||
|
||||
if (finder.results.size() <= 0)
|
||||
{
|
||||
this.save();
|
||||
/* NO LONGER CONNECTED ELSE WHERE SO SPLIT AND REFRESH */
|
||||
ITileNetwork newNetwork = NetworkUpdateHandler.createNewNetwork(NetworkUpdateHandler.getID(this.getClass()));
|
||||
if (newNetwork != null)
|
||||
{
|
||||
for (Vector3 node : finder.closedSet)
|
||||
{
|
||||
TileEntity entity = node.getTileEntity(connectionEnd.worldObj);
|
||||
if (entity instanceof INetworkPart)
|
||||
{
|
||||
if (node != splitPoint)
|
||||
{
|
||||
newNetwork.getMembers().add((INetworkPart) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
newNetwork.onCreated();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.getName() + "[" + this.hashCode() + "| Parts:" + this.networkMembers.size() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalid()
|
||||
{
|
||||
return this.networkMembers.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
this.networkMembers.clear();
|
||||
}
|
||||
|
||||
public static void invalidate(TileEntity tileEntity)
|
||||
{
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity checkTile = VectorHelper.getConnectorFromSide(tileEntity.worldObj, new Vector3(tileEntity), direction);
|
||||
|
||||
if (checkTile instanceof INetworkPart && ((INetworkPart) checkTile).getTileNetwork() != null)
|
||||
{
|
||||
((INetworkPart) checkTile).getTileNetwork().removeTile(tileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
package resonantinduction.core.tilenetwork.prefab;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import resonantinduction.core.tilenetwork.ITileNetwork;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
/**
|
||||
* Manages all the tile networks making sure they get world save events, and updates every so often
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class NetworkUpdateHandler implements ITickHandler
|
||||
{
|
||||
private static HashMap<String, Class<?>> nameToClassMap = new HashMap<String, Class<?>>();
|
||||
private static HashMap<Class<?>, String> classToNameMap = new HashMap<Class<?>, String>();
|
||||
|
||||
private int count = 0;
|
||||
private static int refreshTicks = 6000;
|
||||
|
||||
private Set<ITileNetwork> activeNetworks = new HashSet();
|
||||
private Set<ITileNetwork> allNetworks = new HashSet();
|
||||
|
||||
private static NetworkUpdateHandler instance;
|
||||
|
||||
static
|
||||
{
|
||||
registerNetworkClass("base", NetworkTileEntities.class);
|
||||
}
|
||||
|
||||
public static NetworkUpdateHandler instance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new NetworkUpdateHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void registerNetwork(ITileNetwork network)
|
||||
{
|
||||
if (network != null && !activeNetworks.contains(network))
|
||||
{
|
||||
this.allNetworks.add(network);
|
||||
if (network.getUpdateRate() > 0)
|
||||
{
|
||||
this.activeNetworks.add(network);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerNetworkClass(String id, Class<?> clazz)
|
||||
{
|
||||
if (!nameToClassMap.containsKey(id) && !classToNameMap.containsKey(clazz))
|
||||
{
|
||||
nameToClassMap.put(id, clazz);
|
||||
classToNameMap.put(clazz, id);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getID(Class<?> clazz)
|
||||
{
|
||||
return classToNameMap.get(clazz);
|
||||
}
|
||||
|
||||
public static Class<?> getClazz(String id)
|
||||
{
|
||||
return nameToClassMap.get(id);
|
||||
}
|
||||
|
||||
public static ITileNetwork createNewNetwork(String id)
|
||||
{
|
||||
Class<?> clazz = getClazz(id);
|
||||
if (clazz != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object object = clazz.newInstance();
|
||||
if (object instanceof ITileNetwork)
|
||||
{
|
||||
return (ITileNetwork) object;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("[CoreMachine]TileNetworkHandler: Failed to create a new network object");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("[CoreMachine]TileNetworkHandler: Unkown id: " + id);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
if (count + 1 >= NetworkUpdateHandler.refreshTicks)
|
||||
{
|
||||
count = 0;
|
||||
for (ITileNetwork network : allNetworks)
|
||||
{
|
||||
if (!network.isInvalid())
|
||||
{
|
||||
network.refreshTick();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
for (ITileNetwork network : activeNetworks)
|
||||
{
|
||||
if (!network.isInvalid())
|
||||
{
|
||||
network.updateTick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
Iterator<ITileNetwork> it = activeNetworks.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
ITileNetwork network = it.next();
|
||||
if (network.isInvalid())
|
||||
{
|
||||
network.invalidate();
|
||||
it.remove();
|
||||
allNetworks.remove(network);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks()
|
||||
{
|
||||
return EnumSet.of(TickType.SERVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel()
|
||||
{
|
||||
return "[CoreMachine]TileNetworkHandler";
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import resonantinduction.core.render.RenderRIItem;
|
||||
import resonantinduction.core.render.RIRenderItem;
|
||||
import resonantinduction.electrical.battery.RenderBattery;
|
||||
import resonantinduction.electrical.battery.TileBattery;
|
||||
import resonantinduction.electrical.charger.TileCharger;
|
||||
|
@ -35,9 +35,9 @@ public class ClientProxy extends CommonProxy
|
|||
@Override
|
||||
public void preInit()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(Electrical.blockBattery.blockID, RenderRIItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Electrical.itemMultimeter.itemID, RenderRIItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Electrical.itemTransformer.itemID, RenderRIItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Electrical.blockBattery.blockID, RIRenderItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Electrical.itemMultimeter.itemID, RIRenderItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Electrical.itemTransformer.itemID, RIRenderItem.INSTANCE);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTesla.class, new RenderTesla());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileLevitator.class, new RenderLevitator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBattery.class, new RenderBattery());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package resonantinduction.mechanical;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import resonantinduction.core.render.RenderRIItem;
|
||||
import resonantinduction.core.render.RIRenderItem;
|
||||
import resonantinduction.mechanical.fluid.pipe.ItemPipeRenderer;
|
||||
import resonantinduction.mechanical.fluid.tank.ItemTankRenderer;
|
||||
import resonantinduction.mechanical.fluid.tank.RenderTank;
|
||||
|
@ -13,8 +13,8 @@ public class ClientProxy extends CommonProxy
|
|||
@Override
|
||||
public void preInit()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(Mechanical.itemGear.itemID, RenderRIItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Mechanical.itemGearShaft.itemID, RenderRIItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Mechanical.itemGear.itemID, RIRenderItem.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(Mechanical.itemGearShaft.itemID, RIRenderItem.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
/**
|
||||
* Some common Fluid that other mods use
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public enum EnumFluid
|
||||
{
|
||||
FUEL(new Fluid("fuel").setUnlocalizedName("fluid.fuel.name")),
|
||||
OIL(new Fluid("oil").setUnlocalizedName("fluid.oil.name").setDensity(1500).setViscosity(4700)),
|
||||
BIOFUEL(new Fluid("biofuel").setUnlocalizedName("fluid.biofuel.name")),
|
||||
WASTE(new Fluid("waste").setUnlocalizedName("fluid.waste.name").setDensity(1300).setViscosity(1800));
|
||||
|
||||
public final Fluid fluid;
|
||||
|
||||
private EnumFluid(Fluid fluid)
|
||||
{
|
||||
this.fluid = fluid;
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid;
|
||||
|
||||
import com.builtbroken.common.science.ChemElement;
|
||||
import com.builtbroken.common.science.ChemicalCompound;
|
||||
|
||||
/**
|
||||
* Enum of gases used to create all the gas fluids
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public enum EnumGas
|
||||
{
|
||||
CARBONDIOXIDE("Carbon DiOxide", false), OXYGEN(ChemElement.Oxygen, 2f, true),
|
||||
BUTANE(ChemicalCompound.BUTANE, true), METHANE(ChemicalCompound.METHANE, true),
|
||||
NATURAL_GAS("Natural Gas", false), PROPANE("Propane", false);
|
||||
|
||||
/** Name used when creating this as a fluid */
|
||||
public final String fluidName;
|
||||
/** Name used to display to the players */
|
||||
public final String name;
|
||||
/**
|
||||
* Object data reference that was used to create this gas, can be a ChemicalCompound, Element,
|
||||
* or Fluid
|
||||
*/
|
||||
public final Object data;
|
||||
public boolean enabled = false;
|
||||
/** Only used for elements since when used as a gas they sometimes bind together */
|
||||
private float molePerGasMolecule = 1.0f;
|
||||
/** Local instance of the gas used when the getGas method is called */
|
||||
private Gas gas;
|
||||
|
||||
private EnumGas(String name, boolean enabled)
|
||||
{
|
||||
this.fluidName = name.replace(" ", "").toLowerCase();
|
||||
this.name = name;
|
||||
data = null;
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
private EnumGas(ChemicalCompound compound, boolean enabled)
|
||||
{
|
||||
this.fluidName = "gas:" + compound.compoundName.replace(" ", "").toLowerCase();
|
||||
this.name = compound.compoundName;
|
||||
data = compound;
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
private EnumGas(ChemElement element, float molesPerGasMolecule, boolean enabled)
|
||||
{
|
||||
this.fluidName = "gas:" + element.elementName.replace(" ", "").toLowerCase();
|
||||
this.name = element.elementName;
|
||||
data = element;
|
||||
this.enabled = enabled;
|
||||
this.molePerGasMolecule = molesPerGasMolecule;
|
||||
}
|
||||
|
||||
public Gas getGas()
|
||||
{
|
||||
if (gas == null)
|
||||
{
|
||||
gas = new Gas(fluidName);
|
||||
if (data instanceof ChemElement)
|
||||
{
|
||||
gas.setDensity((int) ((ChemElement) data).density * 1000);
|
||||
}
|
||||
else if (data instanceof ChemicalCompound)
|
||||
{
|
||||
gas.setDensity((int) ((ChemicalCompound) data).density * 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
gas.setDensity(-1000);
|
||||
}
|
||||
}
|
||||
return gas;
|
||||
}
|
||||
}
|
|
@ -1,298 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import resonantinduction.mechanical.fluid.network.FluidRecipeInfo.SimpleFluidRecipe;
|
||||
import resonantinduction.mechanical.fluid.network.IFluidRecipeCrafter;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
|
||||
import com.builtbroken.common.Pair;
|
||||
import com.builtbroken.common.Triple;
|
||||
|
||||
/**
|
||||
* Handles all kinds of process involving mixing Fluids with other fluids and/or Items, Blocks,
|
||||
* ItemStack, or Liquids
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class FluidCraftingHandler
|
||||
{
|
||||
/** Map of results of two different liquids merging */
|
||||
public static HashMap<Pair<Object, Object>, Object> fluidMergeResults = new HashMap<Pair<Object, Object>, Object>();
|
||||
|
||||
static
|
||||
{
|
||||
registerRecipe(FluidRegistry.LAVA, FluidRegistry.WATER, Block.obsidian);
|
||||
registerRecipe(FluidRegistry.WATER, FluidRegistry.LAVA, Block.cobblestone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a very basic A + B = C result for mixing two objects together. Suggest that the use
|
||||
* of a SimpleFluidRecipe i used instead to create a more refined fluid mixing that takes into
|
||||
* account ratios, and fluid volumes
|
||||
*/
|
||||
public static void registerRecipe(Object a, Object b, Object c)
|
||||
{
|
||||
if (a != null && b != null && c != null)
|
||||
{
|
||||
registerFluidRecipe(new SimpleFluidRecipe(a, b, c));
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerFluidRecipe(SimpleFluidRecipe recipe)
|
||||
{
|
||||
if (recipe != null && recipe.recipeObjectA != null && recipe.recipeObjectB != null && recipe.recipeObjectC != null)
|
||||
{
|
||||
if (!fluidMergeResults.containsKey(new Pair<Object, Object>(recipe.recipeObjectA, recipe.recipeObjectB)))
|
||||
{
|
||||
fluidMergeResults.put(new Pair<Object, Object>(recipe.recipeObjectA, recipe.recipeObjectB), recipe);
|
||||
}
|
||||
if (recipe.canBeReversed)
|
||||
{
|
||||
if (!fluidMergeResults.containsKey(new Pair<Object, Object>(recipe.recipeObjectB, recipe.recipeObjectA)))
|
||||
{
|
||||
fluidMergeResults.put(new Pair<Object, Object>(recipe.recipeObjectB, recipe.recipeObjectA), recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadPotionRecipes()
|
||||
{
|
||||
// TODO load the process by which a potion would be created threw fliud crafting
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the fluid recipe crafting for the crafter object. Requires that the object fully use all
|
||||
* methods from the #IFluidRecipeCrafter
|
||||
*
|
||||
* @param crafter - crafting object, recommend it be a tile but can be anything as long as the
|
||||
* method are used correctly. In some recipe cases when the setRecipeObjectContent nothing will
|
||||
* be used. If result is null assume not crafting was performed. If there is a result the
|
||||
* crafter couldn't use the output to reduce the input values. From here the IFluidRecipeCrafter
|
||||
* will need to process the output and decress the input values correctly
|
||||
*/
|
||||
public static void craft(IFluidRecipeCrafter crafter)
|
||||
{
|
||||
Object received = crafter.getReceivingObjectStack();
|
||||
int receivedVolume = 0;
|
||||
Object input = crafter.getInputObjectStack();
|
||||
int inputVolume = 0;
|
||||
if (crafter != null && received != null && input != null)
|
||||
{
|
||||
// Trip input values so they will match the correct mapped values
|
||||
if (received instanceof FluidStack)
|
||||
{
|
||||
receivedVolume = ((FluidStack) received).amount;
|
||||
received = FluidUtility.getStack((FluidStack) received, 1);
|
||||
}
|
||||
if (received instanceof ItemStack)
|
||||
{
|
||||
receivedVolume = ((ItemStack) received).stackSize;
|
||||
((ItemStack) received).stackSize = 1;
|
||||
}
|
||||
if (input instanceof FluidStack)
|
||||
{
|
||||
inputVolume = ((FluidStack) input).amount;
|
||||
input = FluidUtility.getStack((FluidStack) input, 1);
|
||||
}
|
||||
if (input instanceof ItemStack)
|
||||
{
|
||||
receivedVolume = ((ItemStack) input).stackSize;
|
||||
((ItemStack) input).stackSize = 1;
|
||||
}
|
||||
|
||||
// Get result
|
||||
Object result = fluidMergeResults.containsKey(new Pair<Object, Object>(crafter.getReceivingObjectStack(), crafter.getInputObjectStack()));
|
||||
|
||||
// reset stack sized
|
||||
if (received instanceof FluidStack)
|
||||
{
|
||||
((FluidStack) received).amount = receivedVolume;
|
||||
}
|
||||
if (received instanceof ItemStack)
|
||||
{
|
||||
((ItemStack) received).stackSize = receivedVolume;
|
||||
}
|
||||
if (input instanceof FluidStack)
|
||||
{
|
||||
((FluidStack) input).amount = inputVolume;
|
||||
}
|
||||
if (input instanceof ItemStack)
|
||||
{
|
||||
((ItemStack) input).stackSize = inputVolume;
|
||||
}
|
||||
if (result != null)
|
||||
{
|
||||
if (result instanceof SimpleFluidRecipe)
|
||||
{
|
||||
Triple<Integer, Integer, Pair<Object, Integer>> re = ((SimpleFluidRecipe) result).mix(crafter.getInputObjectStack(), crafter.getInputObjectStack());
|
||||
crafter.setRecipeObjectContent(received, re.getA(), input, re.getB(), re.getC().left(), re.getC().right());
|
||||
}
|
||||
}
|
||||
crafter.setRecipeObjectContent(received, 0, input, 0, result, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/** Merges two fluids together that don't result in damage to the network */
|
||||
public static FluidStack mergeFluidStacks(FluidStack stackOne, FluidStack stackTwo)
|
||||
{
|
||||
FluidStack resultStack = null;
|
||||
|
||||
if (stackTwo != null && stackOne != null && stackOne.isFluidEqual(stackTwo))
|
||||
{
|
||||
resultStack = stackOne.copy();
|
||||
resultStack.amount += stackTwo.amount;
|
||||
}
|
||||
else if (stackOne == null && stackTwo != null)
|
||||
{
|
||||
resultStack = stackTwo.copy();
|
||||
}
|
||||
else if (stackOne != null && stackTwo == null)
|
||||
{
|
||||
resultStack = stackOne.copy();
|
||||
}
|
||||
else if (stackTwo != null && stackOne != null && !stackOne.isFluidEqual(stackTwo))
|
||||
{
|
||||
System.out.println("preforming fluid merge event");
|
||||
Object result = fluidMergeResults.get(new Pair<Fluid, Fluid>(stackOne.getFluid(), stackTwo.getFluid()));
|
||||
/* Try to merge fluids by mod defined rules first */
|
||||
if (result != null)
|
||||
{
|
||||
System.out.println("result = " + result.toString());
|
||||
if (result instanceof Fluid)
|
||||
{
|
||||
resultStack = new FluidStack(((Fluid) result).getID(), stackOne.amount + stackTwo.amount);
|
||||
}
|
||||
else if (result instanceof FluidStack)
|
||||
{
|
||||
resultStack = ((FluidStack) result).copy();
|
||||
resultStack.amount = stackOne.amount + stackTwo.amount;
|
||||
}
|
||||
else if (result instanceof String && ((String) result).startsWith("Liquid:"))
|
||||
{
|
||||
resultStack = new FluidStack(FluidRegistry.getFluid(((String) result).replace("Liquid:", "")), stackOne.amount + stackTwo.amount);
|
||||
}
|
||||
else if (result instanceof SimpleFluidRecipe)
|
||||
{
|
||||
Triple<Integer, Integer, Pair<Object, Integer>> re = ((SimpleFluidRecipe) result).mix(stackOne, stackTwo);
|
||||
if (re.getC().left() instanceof FluidStack)
|
||||
{
|
||||
resultStack = FluidUtility.getStack((FluidStack) re.getC().left(), re.getC().right());
|
||||
}
|
||||
else if (re.getC().left() instanceof FluidStack)
|
||||
{
|
||||
resultStack = new FluidStack((Fluid) re.getC().left(), re.getC().right());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resultStack == null)
|
||||
{
|
||||
System.out.println("Merging fluids into a waste fluid stack");
|
||||
Fluid waste = FluidRegistry.getFluid("waste");
|
||||
if (waste == null)
|
||||
{
|
||||
System.out.println("[FluidNetworkHelper] Attempted to merge two fluids into a waste fluid stack but Forge fluid registry return null for waste. Possible that waste fluid was disabled or not registered correctly.");
|
||||
return null;
|
||||
}
|
||||
/* If both liquids are waste then copy fluidStack lists then merge */
|
||||
if (stackTwo.fluidID == waste.getID() && stackOne.fluidID == waste.getID())
|
||||
{
|
||||
List<FluidStack> stacks = new ArrayList<FluidStack>();
|
||||
stacks.addAll(getStacksFromWaste(stackOne.copy()));
|
||||
stacks.addAll(getStacksFromWaste(stackTwo.copy()));
|
||||
resultStack = createNewWasteStack(stacks.toArray(new FluidStack[stacks.size()]));
|
||||
}
|
||||
else
|
||||
{
|
||||
resultStack = createNewWasteStack(stackOne.copy(), stackTwo.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultStack;
|
||||
}
|
||||
|
||||
/** Gets the fluidStacks that make up a waste FluidStack */
|
||||
public static List<FluidStack> getStacksFromWaste(FluidStack wasteStack)
|
||||
{
|
||||
List<FluidStack> stacks = new ArrayList<FluidStack>();
|
||||
if (wasteStack.fluidID == FluidRegistry.getFluidID("waste"))
|
||||
{
|
||||
for (int i = 1; i <= wasteStack.tag.getInteger("liquids"); i++)
|
||||
{
|
||||
FluidStack readStack = FluidStack.loadFluidStackFromNBT(wasteStack.tag.getCompoundTag("Liquid" + i));
|
||||
if (readStack != null)
|
||||
{
|
||||
stacks.add(readStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
/** Creates a new waste stack from the listed fluidStacks */
|
||||
public static FluidStack createNewWasteStack(FluidStack... liquids)
|
||||
{
|
||||
FluidStack stack = new FluidStack(FluidRegistry.getFluid("waste"), 0);
|
||||
stack.tag = new NBTTagCompound();
|
||||
if (liquids != null)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < liquids.length; i++)
|
||||
{
|
||||
if (liquids[i] != null)
|
||||
{
|
||||
if (!liquids[i].getFluid().equals(stack.getFluid()))
|
||||
{
|
||||
count++;
|
||||
stack.tag.setCompoundTag("Liquids" + count, liquids[i].writeToNBT(new NBTTagCompound()));
|
||||
stack.amount += liquids[i].amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (FluidStack loadStack : getStacksFromWaste(liquids[i]))
|
||||
{
|
||||
count++;
|
||||
stack.tag.setCompoundTag("Liquids" + count, loadStack.writeToNBT(new NBTTagCompound()));
|
||||
stack.amount += loadStack.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stack.tag.setInteger("liquids", count);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the result of the merge of the two fluids, order of merge does matter and will produce
|
||||
* different results.
|
||||
*
|
||||
* @param stackOne - Receiving fluid, eg the one that is not moving
|
||||
* @param stackTwo - Flowing fluid, eg the one moving into the first fluid
|
||||
* @return Object result of the merge, can be anything from string, ItemStack, Item, Block, or
|
||||
* enum action
|
||||
*/
|
||||
public static Object getMergeResult(FluidStack stackOne, FluidStack stackTwo)
|
||||
{
|
||||
FluidStack sampleStackOne, sampleStackTwo;
|
||||
if (stackOne != null && stackTwo != null && !stackOne.equals(stackTwo))
|
||||
{
|
||||
sampleStackOne = FluidUtility.getStack(stackOne, 1);
|
||||
sampleStackTwo = FluidUtility.getStack(stackTwo, 1);
|
||||
if (fluidMergeResults.containsKey(new Pair<Object, Object>(sampleStackOne, sampleStackTwo)))
|
||||
{
|
||||
return fluidMergeResults.get(new Pair<Object, Object>(sampleStackOne, sampleStackTwo));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
/**
|
||||
* These is an extension of the Fluid system forcing it to be a gas on creation
|
||||
*
|
||||
* @author Archadia, DarkGuardsman
|
||||
*/
|
||||
public class Gas extends Fluid
|
||||
{
|
||||
|
||||
public Gas(String name)
|
||||
{
|
||||
super(name);
|
||||
this.isGaseous = true;
|
||||
this.density = -1000;
|
||||
}
|
||||
}
|
|
@ -1,233 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid.network;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.builtbroken.common.Pair;
|
||||
import com.builtbroken.common.Triple;
|
||||
|
||||
/**
|
||||
* Used to store more complex info, than A + B = C, on two FluidStack mixing behavior
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class FluidRecipeInfo
|
||||
{
|
||||
/**
|
||||
* A + Energy = C, simple recipe designed to tell a boiler like machine how to handle input to
|
||||
* output process
|
||||
*/
|
||||
public static class BoilingFluidRecipe
|
||||
{
|
||||
/** Unboiled object */
|
||||
public Object boiledObject;
|
||||
/** Boiled object */
|
||||
public Object boiledResult;
|
||||
/** In kelvin tempature units only */
|
||||
public float heatLevel = 0;
|
||||
/** Energy in jouls need to turn convert A to B */
|
||||
public float energyPerMb = 1;
|
||||
|
||||
public BoilingFluidRecipe(Object unboiled, Object boiled, float boilingTempature, float energyPerUnitBoiled)
|
||||
{
|
||||
this.boiledObject = unboiled;
|
||||
this.boiledResult = boiled;
|
||||
this.heatLevel = boilingTempature;
|
||||
this.energyPerMb = energyPerUnitBoiled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[BoilingFluidRecipe] UnboiledObject: " + (this.boiledObject != null ? this.boiledObject.toString() : "null") + " | BoiledObject: " + (this.boiledResult != null ? this.boiledResult.toString() : "null") + " | BoilingTemp: " + this.heatLevel + "k | EnergyPerUnit: " + this.energyPerMb + "j";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic A + B = C recipe result that should involve fluids but can be used as a 2 item crafting
|
||||
* system if needed
|
||||
*/
|
||||
public static class SimpleFluidRecipe
|
||||
{
|
||||
public Object recipeObjectA, recipeObjectB, recipeObjectC;
|
||||
public int ratioOfA = 1, ratioOfB = 1, ratioOfC = 1;
|
||||
/** Size compared to the largest volume that the smallest volume can be */
|
||||
public float mixingPercentMin = .1f;
|
||||
public boolean canBeReversed = false;
|
||||
|
||||
/**
|
||||
* receiving & input object must be either be an instance of a class extending Item,
|
||||
* ItemStack, Block, Fluid, FluidStack, or OreNames. Anything else and the mixing will never
|
||||
* work
|
||||
*
|
||||
* @param receiving - receiving object that is waiting to be mixed
|
||||
* @param input - object being added to the receiving object
|
||||
* @param output - result of mixing the object together. Can be anything but not all
|
||||
* machines using this will respect all output types
|
||||
*/
|
||||
public SimpleFluidRecipe(Object receiving, Object input, Object output)
|
||||
{
|
||||
this.recipeObjectA = receiving;
|
||||
this.recipeObjectB = input;
|
||||
this.recipeObjectC = output;
|
||||
}
|
||||
|
||||
public SimpleFluidRecipe setRatio(int receivingVolume, int inputVolume, int result)
|
||||
{
|
||||
this.ratioOfA = receivingVolume;
|
||||
this.ratioOfB = inputVolume;
|
||||
this.ratioOfC = result;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SimpleFluidRecipe setIsReversable(boolean canBeReversed)
|
||||
{
|
||||
this.canBeReversed = canBeReversed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object getResult()
|
||||
{
|
||||
return this.recipeObjectC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the mixing be complete in anyway. Does a basic volume check but does not check for
|
||||
* volume wasted in mixing
|
||||
*
|
||||
* @param receiving - Object stored and waiting for mixing
|
||||
* @param input - Object being added to the receiving object
|
||||
* @return true if the process can be completed
|
||||
*/
|
||||
public boolean canComplete(Object receiving, Object input)
|
||||
{
|
||||
int countReceiving = 0;
|
||||
int countInput = 0;
|
||||
float percent = 0;
|
||||
if (receiving != null && input != null && recipeObjectA.equals(receiving) && recipeObjectB.equals(input))
|
||||
{
|
||||
countReceiving = this.getObjectVolume(receiving);
|
||||
countInput = this.getObjectVolume(input);
|
||||
if (countReceiving > 0 && countInput > 0)
|
||||
{
|
||||
float per = countInput / countReceiving;
|
||||
float per2 = countReceiving / countInput;
|
||||
percent = per > per2 ? per2 : per;
|
||||
if (percent >= this.mixingPercentMin)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getObjectVolume(Object object)
|
||||
{
|
||||
int volume = 0;
|
||||
if (object instanceof Item)
|
||||
{
|
||||
volume = 1;
|
||||
}
|
||||
else if (object instanceof ItemStack)
|
||||
{
|
||||
volume = ((ItemStack) object).stackSize;
|
||||
}
|
||||
else if (object instanceof FluidStack)
|
||||
{
|
||||
volume = ((FluidStack) object).amount;
|
||||
}
|
||||
else if (object instanceof Fluid)
|
||||
{
|
||||
volume = 1;
|
||||
}
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param receiving - Object receiving an input object for mixing
|
||||
* @param input - Object being added to the receiving object
|
||||
* @return Triple containing values of mixing. Complex way to handle it, and may be replaced
|
||||
* later, However to prevent 4 different methods be created for mixing this is the best
|
||||
* output design. As well this doesn't consume the object but does the calculations of the
|
||||
* recipe out at the given object volumes
|
||||
*
|
||||
* First value is amount of the first object used. Second value is the amount of the second
|
||||
* object used. Third value Pair containing object output then amount of output
|
||||
*/
|
||||
public Triple<Integer, Integer, Pair<Object, Integer>> mix(Object receiving, Object input)
|
||||
{
|
||||
if (this.canComplete(receiving, input))
|
||||
{
|
||||
// Collect volume of each input object
|
||||
int volumeReceiving = this.getObjectVolume(receiving);
|
||||
int volumeInput = this.getObjectVolume(input);
|
||||
int volAUsed, volBUsed;
|
||||
|
||||
// check if there is enough to mix even once
|
||||
if (volumeReceiving > this.ratioOfA && volumeInput > this.ratioOfB)
|
||||
{
|
||||
// Collect ratio of each
|
||||
int ratioA = (volumeReceiving / this.ratioOfA);
|
||||
int ratioB = (volumeInput / this.ratioOfB);
|
||||
|
||||
// Take the least ratio value and multiply it by the ratio of the output
|
||||
int outputVolume = ratioA > ratioB ? ratioB * this.ratioOfC : ratioA * this.ratioOfC;
|
||||
|
||||
volAUsed = (outputVolume / this.ratioOfC) * this.ratioOfA;
|
||||
volBUsed = (outputVolume / this.ratioOfC) * this.ratioOfB;
|
||||
return new Triple<Integer, Integer, Pair<Object, Integer>>(volAUsed, volBUsed, new Pair<Object, Integer>(this.recipeObjectC, outputVolume));
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the list of processes needed to complete a fluid recipe that require more than one
|
||||
* step to complete. Only used by brewing factories, and is suggest too still register result as
|
||||
* a SimpleFluidRecipe unless the result can't be stored or moved easily.
|
||||
*/
|
||||
public static class ComplexFluidRecipe
|
||||
{
|
||||
public int numberOfSteps;
|
||||
public SimpleFluidRecipe[] stepArray;
|
||||
|
||||
public ComplexFluidRecipe(int numberOfSteps)
|
||||
{
|
||||
this.numberOfSteps = numberOfSteps;
|
||||
this.stepArray = new SimpleFluidRecipe[this.numberOfSteps];
|
||||
}
|
||||
|
||||
public ComplexFluidRecipe createStep(int step, SimpleFluidRecipe stepRecipe)
|
||||
{
|
||||
if (step < numberOfSteps)
|
||||
{
|
||||
stepArray[step] = stepRecipe;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean canCompleteStep(int step, Object receiving, Object input)
|
||||
{
|
||||
if (this.getStep(step) != null)
|
||||
{
|
||||
return this.getStep(step).canComplete(receiving, input);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public SimpleFluidRecipe getStep(int step)
|
||||
{
|
||||
if (step < numberOfSteps)
|
||||
{
|
||||
return stepArray[step];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid.network;
|
||||
|
||||
/**
|
||||
* Use this if you want to take advantage of the {@link #FluidCraftingHandler} 's auto crafting
|
||||
* methods to do as little as work as possible to create recipe results
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public interface IFluidRecipeCrafter
|
||||
{
|
||||
/**
|
||||
* After calling {@link #FluidCraftingHandler} 's crafting method this will be called to setup
|
||||
* the end result of all 3 objects. That is if crafting was not called for calculations only
|
||||
*/
|
||||
public void setRecipeObjectContent(Object receivingObject, int usedReceivingVolume, Object inputObject, int usedInputVolume, Object resultObject, int resultCreatedVolume);
|
||||
|
||||
/** Stack that is receiving the input object (ItemStack & FluidStack are best) */
|
||||
public Object getReceivingObjectStack();
|
||||
|
||||
/** Stack that will be received by the receiving object (ItemStack & FluidStack are best) */
|
||||
public Object getInputObjectStack();
|
||||
}
|
|
@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockImprintable;
|
||||
import resonantinduction.core.prefab.BlockImprintable;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.prefab.block.BlockImprintable;
|
||||
import resonantinduction.core.prefab.BlockImprintable;
|
||||
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockImprintable;
|
||||
import resonantinduction.core.prefab.BlockImprintable;
|
||||
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
|
|
@ -11,14 +11,14 @@ import net.minecraft.network.packet.Packet;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import resonantinduction.core.prefab.TileFilterable;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileDetector extends TileEntityFilterable implements IPacketReceiver
|
||||
public class TileDetector extends TileFilterable implements IPacketReceiver
|
||||
{
|
||||
private boolean powering = false;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.api.IManipulator;
|
||||
import resonantinduction.archaic.imprint.ItemImprint;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import resonantinduction.core.prefab.TileFilterable;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
|
@ -20,7 +20,7 @@ import calclavia.lib.utility.inventory.InternalInventoryHandler;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileManipulator extends TileEntityFilterable implements IRotatable, IManipulator, IPacketReceiver
|
||||
public class TileManipulator extends TileFilterable implements IRotatable, IManipulator, IPacketReceiver
|
||||
{
|
||||
/** True to auto output items with a redstone pulse */
|
||||
private boolean selfPulse = false;
|
||||
|
|
|
@ -12,14 +12,14 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.api.IBelt;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import resonantinduction.core.prefab.TileFilterable;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiverWithID;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/** @author Darkguardsman */
|
||||
public class TileRejector extends TileEntityFilterable implements IPacketReceiverWithID
|
||||
public class TileRejector extends TileFilterable implements IPacketReceiverWithID
|
||||
{
|
||||
/** should the piston fire, or be extended */
|
||||
public boolean firePiston = false;
|
||||
|
|
Loading…
Reference in a new issue