parent
428b187722
commit
39d73b5634
67 changed files with 1089 additions and 1051 deletions
|
@ -7,56 +7,48 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import universalelectricity.api.net.INodeNetwork;
|
||||
|
||||
/**
|
||||
* Interface version of the fluid network.
|
||||
/** Interface version of the fluid network.
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
* @author DarkGuardsman */
|
||||
public interface IFluidNetwork extends INodeNetwork<IFluidNetwork, IFluidConnector, IFluidHandler>
|
||||
{
|
||||
/** Called to build the network when something changes such as addition of a pipe */
|
||||
@Override
|
||||
void reconstruct();
|
||||
/** Called to build the network when something changes such as addition of a pipe */
|
||||
@Override
|
||||
void reconstruct();
|
||||
|
||||
/**
|
||||
* Called to add fluid into the network
|
||||
*
|
||||
* @param source - part that is receiving the fluid for the network
|
||||
* @param from - direction of this connection
|
||||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doFill - true causes the action to be taken, false simulates the action
|
||||
* @return amount of fluid filled into the network
|
||||
*/
|
||||
int fill(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doFill);
|
||||
/** Called to add fluid into the network
|
||||
*
|
||||
* @param source - part that is receiving the fluid for the network
|
||||
* @param from - direction of this connection
|
||||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doFill - true causes the action to be taken, false simulates the action
|
||||
* @return amount of fluid filled into the network */
|
||||
int fill(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doFill);
|
||||
|
||||
/**
|
||||
* Called to remove fluid from a network, not supported by all networks
|
||||
*
|
||||
* @param source - part that is receiving the fluid for the network
|
||||
* @param from - direction of this connection
|
||||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doDrain - true causes the action to be taken, false simulates the action
|
||||
* @return FluidStack that contains the fluid drained from the network
|
||||
*/
|
||||
FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain);
|
||||
/** Called to remove fluid from a network, not supported by all networks
|
||||
*
|
||||
* @param source - part that is receiving the fluid for the network
|
||||
* @param from - direction of this connection
|
||||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doDrain - true causes the action to be taken, false simulates the action
|
||||
* @return FluidStack that contains the fluid drained from the network */
|
||||
FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain);
|
||||
|
||||
/**
|
||||
* Called to remove fluid from a network, not supported by all networks
|
||||
*
|
||||
* @param source - part that is receiving the fluid for the network
|
||||
* @param from - direction of this connection
|
||||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doDrain - true causes the action to be taken, false simulates the action
|
||||
* @return FluidStack that contains the fluid drained from the network
|
||||
*/
|
||||
FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain);
|
||||
/** Called to remove fluid from a network, not supported by all networks
|
||||
*
|
||||
* @param source - part that is receiving the fluid for the network
|
||||
* @param from - direction of this connection
|
||||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doDrain - true causes the action to be taken, false simulates the action
|
||||
* @return FluidStack that contains the fluid drained from the network */
|
||||
FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain);
|
||||
|
||||
/** Fluid tank that represents the entire network */
|
||||
FluidTank getTank();
|
||||
/** Fluid tank that represents the entire network */
|
||||
FluidTank getTank();
|
||||
|
||||
/** Information about the network's tank */
|
||||
FluidTankInfo[] getTankInfo();
|
||||
/** Information about the network's tank */
|
||||
FluidTankInfo[] getTankInfo();
|
||||
|
||||
int getPressure();
|
||||
int getPressure();
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public interface IFluidPipe extends IFluidConnector, IPressureInput
|
|||
* @return amount in pascals.
|
||||
*/
|
||||
int getMaxPressure();
|
||||
|
||||
|
||||
int getPressure();
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package resonantinduction.archaic.firebox;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Icon;
|
||||
|
|
|
@ -9,7 +9,9 @@ import net.minecraft.item.crafting.FurnaceRecipes;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
|
||||
public class ItemImprint extends Item
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package resonantinduction.archaic.process;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -8,10 +9,17 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.api.recipe.MachineRecipes;
|
||||
import resonantinduction.api.recipe.MachineRecipes.RecipeType;
|
||||
import resonantinduction.archaic.crate.TileCrate;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockRI;
|
||||
import universalelectricity.api.vector.Vector2;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.api.vector.VectorWorld;
|
||||
import calclavia.lib.utility.inventory.InventoryUtility;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package resonantinduction.archaic.process;
|
|||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.render.RenderItemOverlayTile;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
|
|
@ -20,7 +20,6 @@ public class TileMillstone extends TileExternalInventory implements IPacketRecei
|
|||
{
|
||||
private int grindCount = 0;
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
grindCount = 0;
|
||||
|
|
|
@ -17,7 +17,7 @@ public class SoundHandler
|
|||
{
|
||||
public static final SoundHandler INSTANCE = new SoundHandler();
|
||||
|
||||
public static final String[] SOUND_FILES = { "hammer.ogg", "grinder1.ogg", "grinder2.ogg", "grinder3.ogg", "grinder4.ogg", "electricshock1.ogg", "electricshock2.ogg", "electricshock3.ogg", "electricshock4.ogg", "electricshock5.ogg", "electricshock6.ogg", "electricshock7.ogg", "conveyor.ogg" };
|
||||
public static final String[] SOUND_FILES = { "hammer.ogg", "grinder1.ogg", "grinder2.ogg", "grinder3.ogg", "grinder4.ogg", "electricshock1.ogg", "electricshock2.ogg", "electricshock3.ogg", "electricshock4.ogg", "electricshock5.ogg", "electricshock6.ogg", "electricshock7.ogg" , "conveyor.ogg" };
|
||||
|
||||
@ForgeSubscribe
|
||||
public void loadSoundEvents(SoundLoadEvent event)
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.util.Icon;
|
|||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -36,6 +37,6 @@ public class FluidEventHandler
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void textureHook(TextureStitchEvent.Post event)
|
||||
{
|
||||
// ResonantInduction.fluidMixture.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture"));
|
||||
//ResonantInduction.fluidMixture.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,15 @@
|
|||
*/
|
||||
package resonantinduction.core.handler;
|
||||
|
||||
import calclavia.components.tool.ToolMode;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import universalelectricity.api.vector.VectorWorld;
|
||||
import calclavia.components.tool.ToolMode;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +52,7 @@ public class ToolModeLink extends ToolMode
|
|||
((ILinkable) tile).onLink(player, this.getLink(stack));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,34 +6,32 @@ package resonantinduction.core.prefab.block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import calclavia.lib.prefab.block.BlockSidedIO;
|
||||
|
||||
/**
|
||||
* Blocks that have specific sided input and output should extend this.
|
||||
/** Blocks that have specific sided input and output should extend this.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
* @author Calclavia */
|
||||
public class BlockIOBase extends BlockSidedIO
|
||||
{
|
||||
public BlockIOBase(String name)
|
||||
{
|
||||
this(name, Settings.getNextBlockID());
|
||||
}
|
||||
public BlockIOBase(String name)
|
||||
{
|
||||
this(name, Settings.getNextBlockID());
|
||||
}
|
||||
|
||||
public BlockIOBase(String name, int id)
|
||||
{
|
||||
this(name, id, UniversalElectricity.machine);
|
||||
}
|
||||
public BlockIOBase(String name, int id)
|
||||
{
|
||||
this(name, id, UniversalElectricity.machine);
|
||||
}
|
||||
|
||||
public BlockIOBase(String name, int id, Material material)
|
||||
{
|
||||
super(Settings.CONFIGURATION.get(Configuration.CATEGORY_BLOCK, name, id).getInt(id), material);
|
||||
this.setCreativeTab(TabRI.CORE);
|
||||
this.setUnlocalizedName(Reference.PREFIX + name);
|
||||
this.setTextureName(Reference.PREFIX + name);
|
||||
this.setHardness(1f);
|
||||
}
|
||||
public BlockIOBase(String name, int id, Material material)
|
||||
{
|
||||
super(Settings.CONFIGURATION.get(Configuration.CATEGORY_BLOCK, name, id).getInt(id), material);
|
||||
this.setCreativeTab(TabRI.CORE);
|
||||
this.setUnlocalizedName(Reference.PREFIX + name);
|
||||
this.setTextureName(Reference.PREFIX + name);
|
||||
this.setHardness(1f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import calclavia.lib.prefab.block.BlockTile;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
|
|
|
@ -3,8 +3,8 @@ package resonantinduction.core.prefab.block;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import calclavia.lib.prefab.block.BlockRotatable;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
|
|
|
@ -3,8 +3,8 @@ package resonantinduction.core.prefab.item;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
|
||||
/** @author Calclavia */
|
||||
public class ItemRI extends Item
|
||||
|
|
|
@ -2,8 +2,8 @@ package resonantinduction.core.prefab.part;
|
|||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
import codechicken.multipart.JItemMultiPart;
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,7 +50,7 @@ public class PacketMultiPart extends PacketType
|
|||
int y = data.readInt();
|
||||
int z = data.readInt();
|
||||
TileEntity tileEntity = player.worldObj.getBlockTileEntity(x, y, z);
|
||||
|
||||
|
||||
if (tileEntity instanceof TileMultipart)
|
||||
{
|
||||
TMultiPart part = ((TileMultipart) tileEntity).partMap(data.readInt());
|
||||
|
|
|
@ -13,135 +13,133 @@ import calclavia.lib.prefab.tile.TileElectrical;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/**
|
||||
* Prefab for general machines
|
||||
/** Prefab for general machines
|
||||
*
|
||||
* @author Darkguardsman
|
||||
*/
|
||||
* @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;
|
||||
/** Is the machine functioning normally */
|
||||
protected boolean functioning = false;
|
||||
/** Prev state of function of last update */
|
||||
protected boolean prevFunctioning = false;
|
||||
|
||||
protected long joulesPerTick = 0;
|
||||
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;
|
||||
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();
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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(boolean doConsume)
|
||||
{
|
||||
return this.consumePower(this.joulesPerTick, doConsume);
|
||||
}
|
||||
|
||||
public boolean consumePower(long joules, boolean doConsume)
|
||||
{
|
||||
return this.energy.extractEnergy(joules, doConsume) >= joules;
|
||||
}
|
||||
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);
|
||||
}
|
||||
/** 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();
|
||||
}
|
||||
}
|
||||
/** 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;
|
||||
}
|
||||
@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 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);
|
||||
}
|
||||
}
|
||||
/** 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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import calclavia.lib.utility.WorldUtility;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import resonantinduction.mechanical.gear.ItemGear;
|
|||
import resonantinduction.mechanical.gear.ItemGearShaft;
|
||||
import resonantinduction.mechanical.gear.RenderGear;
|
||||
import resonantinduction.mechanical.gear.RenderGearShaft;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class RenderRIItem implements IItemRenderer
|
|||
}
|
||||
else if (item.getItem() instanceof ItemMultimeter)
|
||||
{
|
||||
RenderMultimeter.render();
|
||||
RenderMultimeter.INSTANCE.render();
|
||||
}
|
||||
else if (item.getItem() instanceof ItemTransformer)
|
||||
{
|
||||
|
|
|
@ -5,9 +5,13 @@ import java.util.Random;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityFallingSand;
|
||||
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.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
|
@ -42,7 +46,7 @@ public class BlockDust extends BlockRI
|
|||
|
||||
if (tileEntity instanceof TileMaterial)
|
||||
{
|
||||
((TileMaterial) tileEntity).name = ItemOreResource.getMaterialFromStack(itemStack);
|
||||
((TileMaterial) tileEntity).name = ((ItemOreResource) itemStack.getItem()).getMaterialFromStack(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +147,7 @@ public class BlockDust extends BlockRI
|
|||
{
|
||||
int l = par1World.getBlockMetadata(par2, par3, par4) & 7;
|
||||
float f = 0.125F;
|
||||
return AxisAlignedBB.getAABBPool().getAABB(par2 + this.minX, par3 + this.minY, par4 + this.minZ, par2 + this.maxX, par3 + l * f, par4 + this.maxZ);
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) par2 + this.minX, (double) par3 + this.minY, (double) par4 + this.minZ, (double) par2 + this.maxX, (double) ((float) par3 + (float) l * f), (double) par4 + this.maxZ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,7 +197,7 @@ public class BlockDust extends BlockRI
|
|||
protected void setBlockBoundsForDepth(int par1)
|
||||
{
|
||||
int j = par1 & 7;
|
||||
float f = 2 * (1 + j) / 16.0F;
|
||||
float f = (float) (2 * (1 + j)) / 16.0F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package resonantinduction.core.resource;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
|
||||
/**
|
||||
* A tile that stores the material name.
|
||||
*
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package resonantinduction.core.resource.fluid;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
@ -9,8 +12,10 @@ import net.minecraftforge.fluids.Fluid;
|
|||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import resonantinduction.core.resource.TileMaterial;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package resonantinduction.core.resource.fluid;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -15,9 +17,6 @@ import resonantinduction.core.ResonantInduction;
|
|||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
@ -19,6 +20,7 @@ import resonantinduction.core.resource.TileMaterial;
|
|||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.LanguageUtility;
|
||||
import calclavia.lib.utility.inventory.InventoryUtility;
|
||||
import calclavia.lib.utility.nbt.NBTUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -90,7 +92,7 @@ public class ItemOreResource extends ItemRI
|
|||
|
||||
if (k1 <= 6 && world.checkNoEntityCollision(block.getCollisionBoundingBoxFromPool(world, x, y, z)) && world.setBlockMetadataWithNotify(x, y, z, k1 + 1 | j1 & -8, 2))
|
||||
{
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
--stack.stackSize;
|
||||
return true;
|
||||
}
|
||||
|
@ -135,7 +137,7 @@ public class ItemOreResource extends ItemRI
|
|||
|
||||
if (placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, k1))
|
||||
{
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
--stack.stackSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,102 +13,108 @@ import resonantinduction.core.prefab.item.ItemRI;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A meta data item containing parts of various crafting recipes. These parts do not do anything but
|
||||
/** A meta data item containing parts of various crafting recipes. These parts do not do anything but
|
||||
* allow new crafting recipes to be created.
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
* @author DarkGuardsman */
|
||||
public class ItemParts extends ItemRI
|
||||
{
|
||||
public ItemParts()
|
||||
{
|
||||
super("DMParts", Settings.getNextItemID());
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setMaxStackSize(64);
|
||||
this.setCreativeTab(CreativeTabs.tabMaterials);
|
||||
}
|
||||
public ItemParts()
|
||||
{
|
||||
super("DMParts", Settings.getNextItemID());
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setMaxStackSize(64);
|
||||
this.setCreativeTab(CreativeTabs.tabMaterials);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack != null && itemStack.getItemDamage() < Parts.values().length)
|
||||
{
|
||||
return "item." + Parts.values()[itemStack.getItemDamage()].name;
|
||||
}
|
||||
return super.getUnlocalizedName();
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack != null && itemStack.getItemDamage() < Parts.values().length)
|
||||
{
|
||||
return "item." + Parts.values()[itemStack.getItemDamage()].name;
|
||||
}
|
||||
return super.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < Parts.values().length)
|
||||
{
|
||||
return Parts.values()[meta].icon;
|
||||
}
|
||||
return this.itemIcon;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < Parts.values().length)
|
||||
{
|
||||
return Parts.values()[meta].icon;
|
||||
}
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
super.registerIcons(iconRegister);
|
||||
for (Parts part : Parts.values())
|
||||
{
|
||||
part.icon = iconRegister.registerIcon(Reference.PREFIX + "part." + part.name);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
super.registerIcons(iconRegister);
|
||||
for (Parts part : Parts.values())
|
||||
{
|
||||
part.icon = iconRegister.registerIcon(Reference.PREFIX + "part." + part.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int blockID, CreativeTabs tab, List itemStackList)
|
||||
{
|
||||
for (Parts part : Parts.values())
|
||||
{
|
||||
if (part.show)
|
||||
{
|
||||
itemStackList.add(new ItemStack(this, 1, part.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(int blockID, CreativeTabs tab, List itemStackList)
|
||||
{
|
||||
for (Parts part : Parts.values())
|
||||
{
|
||||
if (part.show)
|
||||
{
|
||||
itemStackList.add(new ItemStack(this, 1, part.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Parts
|
||||
{
|
||||
Seal("leatherSeal"), GasSeal("gasSeal"), Tank("unfinishedTank"), Valve("valvePart"),
|
||||
MiningIcon("miningIcon", false), CircuitBasic("circuitBasic"),
|
||||
CircuitAdvanced("circuitAdvanced"), CircuitElite("circuitElite"), Motor("motor"),
|
||||
IC("ic_chip"), COIL("coilCopper"), LASER("diodeLaser");
|
||||
public static enum Parts
|
||||
{
|
||||
Seal("leatherSeal"),
|
||||
GasSeal("gasSeal"),
|
||||
Tank("unfinishedTank"),
|
||||
Valve("valvePart"),
|
||||
MiningIcon("miningIcon", false),
|
||||
CircuitBasic("circuitBasic"),
|
||||
CircuitAdvanced("circuitAdvanced"),
|
||||
CircuitElite("circuitElite"),
|
||||
Motor("motor"),
|
||||
IC("ic_chip"),
|
||||
COIL("coilCopper"),
|
||||
LASER("diodeLaser");
|
||||
|
||||
public String name;
|
||||
public Icon icon;
|
||||
boolean show = true;
|
||||
public String name;
|
||||
public Icon icon;
|
||||
boolean show = true;
|
||||
|
||||
private Parts(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
private Parts(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private Parts(String name, boolean show)
|
||||
{
|
||||
this(name);
|
||||
this.show = show;
|
||||
}
|
||||
}
|
||||
private Parts(String name, boolean show)
|
||||
{
|
||||
this(name);
|
||||
this.show = show;
|
||||
}
|
||||
}
|
||||
|
||||
public void loadOreNames()
|
||||
{
|
||||
for (Parts part : Parts.values())
|
||||
{
|
||||
OreDictionary.registerOre(part.name, new ItemStack(this, 1, part.ordinal()));
|
||||
}
|
||||
public void loadOreNames()
|
||||
{
|
||||
for (Parts part : Parts.values())
|
||||
{
|
||||
OreDictionary.registerOre(part.name, new ItemStack(this, 1, part.ordinal()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,17 +8,22 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.electrical.battery.BlockBattery;
|
||||
import resonantinduction.electrical.battery.ItemBlockBattery;
|
||||
import resonantinduction.electrical.battery.TileBattery;
|
||||
import resonantinduction.electrical.encoder.BlockEncoder;
|
||||
import resonantinduction.electrical.encoder.ItemDisk;
|
||||
import resonantinduction.electrical.encoder.TileEncoder;
|
||||
import resonantinduction.electrical.furnace.BlockAdvancedFurnace;
|
||||
import resonantinduction.electrical.furnace.TileAdvancedFurnace;
|
||||
import resonantinduction.electrical.generator.BlockGenerator;
|
||||
import resonantinduction.electrical.generator.TileGenerator;
|
||||
import resonantinduction.electrical.generator.solar.BlockSolarPanel;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class BlockArmbot extends BlockRI implements IBlockInfo
|
|||
((TileArmbot) tileEntity).dropHeldObject();
|
||||
CalclaviaLoader.blockMulti.destroyMultiBlockStructure((TileArmbot) tileEntity);
|
||||
}
|
||||
|
||||
|
||||
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(this));
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class BatteryNetwork extends Network<BatteryNetwork, TileBattery>
|
|||
/**
|
||||
* Apply energy loss.
|
||||
*/
|
||||
double percentageLoss = Math.max(0, (1 - (getConnectors().size() * 6 / 100d)));
|
||||
double percentageLoss = Math.max(0, (1 - ((double) (getConnectors().size() * 6) / 100d)));
|
||||
long energyLoss = (long) (percentageLoss * 100);
|
||||
totalEnergy -= energyLoss;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class BatteryNetwork extends Network<BatteryNetwork, TileBattery>
|
|||
if (battery != firstNode && !Arrays.asList(exclusion).contains(battery))
|
||||
{
|
||||
double percentage = ((double) battery.energy.getEnergyCapacity() / (double) totalCapacity);
|
||||
long energyForBattery = Math.round(totalEnergy * percentage);
|
||||
long energyForBattery = (long) Math.round(totalEnergy * percentage);
|
||||
battery.energy.setEnergy(energyForBattery);
|
||||
remainingEnergy -= energyForBattery;
|
||||
}
|
||||
|
|
|
@ -52,10 +52,10 @@ public class BlockBattery extends BlockIOBase implements ITileEntityProvider
|
|||
{
|
||||
ItemBlockBattery itemBlock = (ItemBlockBattery) itemStack.getItem();
|
||||
TileBattery battery = (TileBattery) world.getBlockTileEntity(x, y, z);
|
||||
battery.energy.setCapacity(TileBattery.getEnergyForTier(ItemBlockBattery.getTier(itemStack)));
|
||||
battery.energy.setCapacity(TileBattery.getEnergyForTier(itemBlock.getTier(itemStack)));
|
||||
battery.energy.setEnergy(itemBlock.getEnergy(itemStack));
|
||||
battery.updateStructure();
|
||||
world.setBlockMetadataWithNotify(x, y, z, ItemBlockBattery.getTier(itemStack), 3);
|
||||
world.setBlockMetadataWithNotify(x, y, z, itemBlock.getTier(itemStack), 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class BlockBattery extends BlockIOBase implements ITileEntityProvider
|
|||
{
|
||||
TileBattery battery = (TileBattery) world.getBlockTileEntity(x, y, z);
|
||||
ItemBlockBattery itemBlock = (ItemBlockBattery) itemStack.getItem();
|
||||
ItemBlockBattery.setTier(itemStack, (byte) metadata);
|
||||
itemBlock.setTier(itemStack, (byte) metadata);
|
||||
itemBlock.setEnergy(itemStack, battery.energy.getEnergy());
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public class TileBattery extends TileElectrical implements IConnector<BatteryNet
|
|||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(energy.getEnergy());
|
||||
data.add(ioMap);
|
||||
data.add((short) ioMap);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,210 +24,210 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
|||
|
||||
public class TileEncoder extends TileExternalInventory implements ISidedInventory, IPacketReceiver
|
||||
{
|
||||
private ItemStack disk;
|
||||
private IInventoryWatcher watcher;
|
||||
public static final int PROGRAM_PACKET_ID = 0;
|
||||
public static final int PROGRAM_CHANGE_PACKET_ID = 1;
|
||||
public static final int REMOVE_TASK_PACKET_ID = 2;
|
||||
public static final int NEW_TASK_PACKET_ID = 3;
|
||||
private ItemStack disk;
|
||||
private IInventoryWatcher watcher;
|
||||
public static final int PROGRAM_PACKET_ID = 0;
|
||||
public static final int PROGRAM_CHANGE_PACKET_ID = 1;
|
||||
public static final int REMOVE_TASK_PACKET_ID = 2;
|
||||
public static final int NEW_TASK_PACKET_ID = 3;
|
||||
|
||||
protected IProgram program;
|
||||
protected IProgram program;
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
super.initiate();
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
program = new Program();
|
||||
program.setTaskAt(0, 0, new TaskRotateTo());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
super.initiate();
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
program = new Program();
|
||||
program.setTaskAt(0, 0, new TaskRotateTo());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
super.onInventoryChanged();
|
||||
if (watcher != null)
|
||||
{
|
||||
watcher.inventoryChanged();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
super.onInventoryChanged();
|
||||
if (watcher != null)
|
||||
{
|
||||
watcher.inventoryChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return "Encoder";
|
||||
}
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return "Encoder";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void setWatcher(IInventoryWatcher watcher)
|
||||
{
|
||||
this.watcher = watcher;
|
||||
}
|
||||
public void setWatcher(IInventoryWatcher watcher)
|
||||
{
|
||||
this.watcher = watcher;
|
||||
}
|
||||
|
||||
public IInventoryWatcher getWatcher()
|
||||
{
|
||||
return this.watcher;
|
||||
}
|
||||
public IInventoryWatcher getWatcher()
|
||||
{
|
||||
return this.watcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
if (this.disk != null)
|
||||
{
|
||||
NBTTagCompound diskNBT = new NBTTagCompound();
|
||||
this.disk.writeToNBT(diskNBT);
|
||||
nbt.setCompoundTag("disk", diskNBT);
|
||||
}
|
||||
}
|
||||
if (this.disk != null)
|
||||
{
|
||||
NBTTagCompound diskNBT = new NBTTagCompound();
|
||||
this.disk.writeToNBT(diskNBT);
|
||||
nbt.setCompoundTag("disk", diskNBT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
NBTTagCompound diskNBT = nbt.getCompoundTag("disk");
|
||||
NBTTagCompound diskNBT = nbt.getCompoundTag("disk");
|
||||
|
||||
if (diskNBT != null)
|
||||
{
|
||||
this.disk = ItemStack.loadItemStackFromNBT(diskNBT);
|
||||
}
|
||||
if (diskNBT != null)
|
||||
{
|
||||
this.disk = ItemStack.loadItemStackFromNBT(diskNBT);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
try
|
||||
{
|
||||
int readInt = data.readInt();
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
try
|
||||
{
|
||||
int readInt = data.readInt();
|
||||
|
||||
if (readInt == PROGRAM_PACKET_ID)
|
||||
{
|
||||
if (data.readBoolean())
|
||||
{
|
||||
Program program = new Program();
|
||||
program.load(PacketHandler.readNBTTagCompound(data));
|
||||
this.program = program;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program = null;
|
||||
}
|
||||
}
|
||||
else if (readInt == PROGRAM_CHANGE_PACKET_ID)
|
||||
{
|
||||
ITask task = TaskRegistry.getCommand(data.readUTF());
|
||||
task.setPosition(data.readInt(), data.readInt());
|
||||
task.load(PacketHandler.readNBTTagCompound(data));
|
||||
this.getProgram().setTaskAt(task.getCol(), task.getRow(), task);
|
||||
this.sendGUIPacket();
|
||||
}
|
||||
else if (readInt == NEW_TASK_PACKET_ID)
|
||||
{
|
||||
ITask task = TaskRegistry.getCommand(data.readUTF());
|
||||
task.setPosition(data.readInt(), data.readInt());
|
||||
task.load(PacketHandler.readNBTTagCompound(data));
|
||||
this.getProgram().insertTask(task.getCol(), task.getRow(), task);
|
||||
this.sendGUIPacket();
|
||||
}
|
||||
else if (readInt == REMOVE_TASK_PACKET_ID)
|
||||
{
|
||||
this.getProgram().setTaskAt(data.readInt(), data.readInt(), null);
|
||||
this.sendGUIPacket();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (readInt == PROGRAM_PACKET_ID)
|
||||
{
|
||||
if (data.readBoolean())
|
||||
{
|
||||
Program program = new Program();
|
||||
program.load(PacketHandler.readNBTTagCompound(data));
|
||||
this.program = program;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program = null;
|
||||
}
|
||||
}
|
||||
else if (readInt == PROGRAM_CHANGE_PACKET_ID)
|
||||
{
|
||||
ITask task = TaskRegistry.getCommand(data.readUTF());
|
||||
task.setPosition(data.readInt(), data.readInt());
|
||||
task.load(PacketHandler.readNBTTagCompound(data));
|
||||
this.getProgram().setTaskAt(task.getCol(), task.getRow(), task);
|
||||
this.sendGUIPacket();
|
||||
}
|
||||
else if (readInt == NEW_TASK_PACKET_ID)
|
||||
{
|
||||
ITask task = TaskRegistry.getCommand(data.readUTF());
|
||||
task.setPosition(data.readInt(), data.readInt());
|
||||
task.load(PacketHandler.readNBTTagCompound(data));
|
||||
this.getProgram().insertTask(task.getCol(), task.getRow(), task);
|
||||
this.sendGUIPacket();
|
||||
}
|
||||
else if (readInt == REMOVE_TASK_PACKET_ID)
|
||||
{
|
||||
this.getProgram().setTaskAt(data.readInt(), data.readInt(), null);
|
||||
this.sendGUIPacket();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendGUIPacket()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
private void sendGUIPacket()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
boolean exists = this.program != null;
|
||||
if (exists)
|
||||
{
|
||||
this.program.save(tag);
|
||||
}
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, TileEncoder.PROGRAM_PACKET_ID, this, exists, tag);
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
boolean exists = this.program != null;
|
||||
if (exists)
|
||||
{
|
||||
this.program.save(tag);
|
||||
}
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, TileEncoder.PROGRAM_PACKET_ID, this, exists, tag);
|
||||
}
|
||||
|
||||
}
|
||||
public void removeTask(Vector2 vec)
|
||||
{
|
||||
if (vec != null)
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer(ResonantInduction.PACKET_TILE.getPacket(this, TileEncoder.REMOVE_TASK_PACKET_ID, this, vec.intX(), vec.intY()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program.setTaskAt(vec.intX(), vec.intY(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeTask(Vector2 vec)
|
||||
{
|
||||
if (vec != null)
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer(ResonantInduction.PACKET_TILE.getPacket(this, TileEncoder.REMOVE_TASK_PACKET_ID, this, vec.intX(), vec.intY()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program.setTaskAt(vec.intX(), vec.intY(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updateTask(ITask editTask)
|
||||
{
|
||||
|
||||
public void updateTask(ITask editTask)
|
||||
{
|
||||
if (editTask != null)
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
editTask.save(nbt);
|
||||
PacketDispatcher.sendPacketToServer(ResonantInduction.PACKET_TILE.getPacket(this, PROGRAM_CHANGE_PACKET_ID, this, editTask.getMethodName(), editTask.getCol(), editTask.getRow(), nbt));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program.setTaskAt(editTask.getCol(), editTask.getRow(), editTask);
|
||||
}
|
||||
}
|
||||
|
||||
if (editTask != null)
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
editTask.save(nbt);
|
||||
PacketDispatcher.sendPacketToServer(ResonantInduction.PACKET_TILE.getPacket(this, PROGRAM_CHANGE_PACKET_ID, this, editTask.getMethodName(), editTask.getCol(), editTask.getRow(), nbt));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program.setTaskAt(editTask.getCol(), editTask.getRow(), editTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void insertTask(ITask editTask)
|
||||
{
|
||||
if (editTask != null)
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
editTask.save(nbt);
|
||||
PacketDispatcher.sendPacketToServer(ResonantInduction.PACKET_TILE.getPacket(this, NEW_TASK_PACKET_ID, this, editTask.getMethodName(), editTask.getCol(), editTask.getRow(), nbt));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program.insertTask(editTask.getCol(), editTask.getRow(), editTask);
|
||||
}
|
||||
}
|
||||
|
||||
public void insertTask(ITask editTask)
|
||||
{
|
||||
if (editTask != null)
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
editTask.save(nbt);
|
||||
PacketDispatcher.sendPacketToServer(ResonantInduction.PACKET_TILE.getPacket(this, NEW_TASK_PACKET_ID, this, editTask.getMethodName(), editTask.getCol(), editTask.getRow(), nbt));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.program.insertTask(editTask.getCol(), editTask.getRow(), editTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public IProgram getProgram()
|
||||
{
|
||||
if (this.program == null)
|
||||
{
|
||||
this.program = new Program();
|
||||
}
|
||||
return this.program;
|
||||
}
|
||||
public IProgram getProgram()
|
||||
{
|
||||
if (this.program == null)
|
||||
{
|
||||
this.program = new Program();
|
||||
}
|
||||
return this.program;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockRI;
|
||||
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockThermopile extends BlockRI
|
||||
{
|
||||
|
|
|
@ -3,7 +3,9 @@ package resonantinduction.electrical.multimeter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
/**
|
||||
* Graph for the multimeter
|
||||
|
|
|
@ -16,7 +16,6 @@ public class GraphF extends Graph<Float>
|
|||
queue += value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneQueue()
|
||||
{
|
||||
super.doneQueue();
|
||||
|
@ -29,7 +28,6 @@ public class GraphF extends Graph<Float>
|
|||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
|
@ -43,7 +41,6 @@ public class GraphF extends Graph<Float>
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
|
|
@ -16,7 +16,6 @@ public class GraphL extends Graph<Long>
|
|||
queue += value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneQueue()
|
||||
{
|
||||
super.doneQueue();
|
||||
|
@ -29,7 +28,6 @@ public class GraphL extends Graph<Long>
|
|||
return 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
|
@ -42,7 +40,6 @@ public class GraphL extends Graph<Long>
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
|
|
@ -14,8 +14,10 @@ import resonantinduction.electrical.wire.EnumWireMaterial;
|
|||
import calclavia.lib.utility.LanguageUtility;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
public class ItemMultimeter extends ItemMultipartBase
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ItemTransformer extends ItemMultipartBase
|
|||
|
||||
if (part != null)
|
||||
{
|
||||
int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int facing = l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
|
||||
part.preparePlacement(side, facing);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.Utility;
|
||||
import resonantinduction.electrical.wire.flat.PartFlatWire;
|
||||
import resonantinduction.electrical.wire.flat.RenderFlatWire;
|
||||
|
|
|
@ -382,8 +382,8 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
{
|
||||
// We found a wire! Merge networks!
|
||||
this.connections[absDir] = tp;
|
||||
|
||||
if (tp instanceof PartFlatWire)
|
||||
|
||||
if(tp instanceof PartFlatWire)
|
||||
{
|
||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JN
|
|||
{
|
||||
getNetwork().getConnectors().remove(this);
|
||||
super.bind(t);
|
||||
getNetwork().getConnectors().add(this);
|
||||
getNetwork().getConnectors().add((IConductor) this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -372,7 +372,7 @@ public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JN
|
|||
try
|
||||
{
|
||||
this.getNetwork().removeConnector(this);
|
||||
this.getNetwork().split(this);
|
||||
this.getNetwork().split((IConductor) this);
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ public class TraitConductor extends TileMultipart implements IConductor
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (partMap(PartMap.CENTER.ordinal()) instanceof IConductor)
|
||||
{
|
||||
return ((IConductor) partMap(PartMap.CENTER.ordinal())).onReceiveEnergy(from, receive, doReceive);
|
||||
|
|
|
@ -112,7 +112,7 @@ public class TraitEnergyHandler extends TileMultipart implements IEnergyHandler
|
|||
@Override
|
||||
public boolean canInterface(ForgeDirection from)
|
||||
{
|
||||
if (partMap(from.ordinal()) == null)
|
||||
if (this.partMap(from.ordinal()) == null)
|
||||
{
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
|
|
|
@ -223,7 +223,6 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
|
|||
return from != getDirection() || from != getDirection().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh()
|
||||
{
|
||||
boolean didRefresh = false;
|
||||
|
@ -270,7 +269,7 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
|
|||
}
|
||||
else if (tile instanceof IMechanical)
|
||||
{
|
||||
IMechanical mechanical = ((IMechanical) tile).getInstance(dir.getOpposite());
|
||||
IMechanical mechanical = (IMechanical) ((IMechanical) tile).getInstance(dir.getOpposite());
|
||||
|
||||
if (mechanical != null)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,6 @@ public abstract class FluidNetwork extends NodeNetwork<IFluidNetwork, IFluidConn
|
|||
this.distributeConnectors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconstructConnector(IFluidConnector connector)
|
||||
{
|
||||
FluidTank tank = connector.getInternalTank();
|
||||
|
|
|
@ -13,151 +13,149 @@ import resonantinduction.api.fluid.IFluidNetwork;
|
|||
import resonantinduction.api.fluid.IFluidPipe;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
|
||||
/**
|
||||
* The network for pipe fluid transfer. getNodes() is NOT used.
|
||||
/** The network for pipe fluid transfer. getNodes() is NOT used.
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
* @author DarkGuardsman */
|
||||
public class PipeNetwork extends FluidNetwork
|
||||
{
|
||||
public HashMap<IFluidHandler, EnumSet<ForgeDirection>> sideMap = new HashMap<IFluidHandler, EnumSet<ForgeDirection>>();
|
||||
public HashMap<IFluidHandler, IFluidConnector> connectionMap = new HashMap<IFluidHandler, IFluidConnector>();
|
||||
public int maxFlowRate = 0;
|
||||
public int maxPressure = 0;
|
||||
public int currentPressure = 0;
|
||||
public int currentFlowRate = 0;
|
||||
public HashMap<IFluidHandler, EnumSet<ForgeDirection>> sideMap = new HashMap<IFluidHandler, EnumSet<ForgeDirection>>();
|
||||
public HashMap<IFluidHandler, IFluidConnector> connectionMap = new HashMap<IFluidHandler, IFluidConnector>();
|
||||
public int maxFlowRate = 0;
|
||||
public int maxPressure = 0;
|
||||
public int currentPressure = 0;
|
||||
public int currentFlowRate = 0;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
/*
|
||||
* Slight delay to allow visual effect to take place before draining the pipe's internal
|
||||
* tank
|
||||
*/
|
||||
FluidStack stack = this.getTank().getFluid().copy();
|
||||
int count = this.sideMap.size();
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
/*
|
||||
* Slight delay to allow visual effect to take place before draining the pipe's internal
|
||||
* tank
|
||||
*/
|
||||
FluidStack stack = this.getTank().getFluid().copy();
|
||||
int count = this.sideMap.size();
|
||||
|
||||
Iterator<Entry<IFluidHandler, EnumSet<ForgeDirection>>> it = new HashMap<IFluidHandler, EnumSet<ForgeDirection>>(sideMap).entrySet().iterator();
|
||||
Iterator<Entry<IFluidHandler, EnumSet<ForgeDirection>>> it = new HashMap<IFluidHandler, EnumSet<ForgeDirection>>(sideMap).entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
Entry<IFluidHandler, EnumSet<ForgeDirection>> entry = it.next();
|
||||
int sideCount = entry.getValue().size();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Entry<IFluidHandler, EnumSet<ForgeDirection>> entry = it.next();
|
||||
int sideCount = entry.getValue().size();
|
||||
|
||||
for (ForgeDirection dir : entry.getValue())
|
||||
{
|
||||
int volPer = (stack.amount / count);
|
||||
int volPerSide = (volPer / sideCount);
|
||||
IFluidHandler handler = entry.getKey();
|
||||
for (ForgeDirection dir : entry.getValue())
|
||||
{
|
||||
int volPer = (stack.amount / count);
|
||||
int volPerSide = (volPer / sideCount);
|
||||
IFluidHandler handler = entry.getKey();
|
||||
|
||||
/*
|
||||
* Don't input to tanks from the sides where the pipe is extraction mode. This
|
||||
* prevents feed-back loops.
|
||||
*/
|
||||
if (connectionMap.get(handler).canFlow())
|
||||
{
|
||||
stack.amount -= handler.fill(dir, FluidUtility.getStack(stack, Math.min(volPerSide, this.maxFlowRate)), true);
|
||||
}
|
||||
/*
|
||||
* Don't input to tanks from the sides where the pipe is extraction mode. This
|
||||
* prevents feed-back loops.
|
||||
*/
|
||||
if (connectionMap.get(handler).canFlow())
|
||||
{
|
||||
stack.amount -= handler.fill(dir, FluidUtility.getStack(stack, Math.min(volPerSide, this.maxFlowRate)), true);
|
||||
}
|
||||
|
||||
if (sideCount > 1)
|
||||
--sideCount;
|
||||
if (volPer <= 0)
|
||||
break;
|
||||
}
|
||||
if (sideCount > 1)
|
||||
--sideCount;
|
||||
if (volPer <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (count > 1)
|
||||
count--;
|
||||
if (count > 1)
|
||||
count--;
|
||||
|
||||
if (stack == null || stack.amount <= 0)
|
||||
{
|
||||
stack = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (stack == null || stack.amount <= 0)
|
||||
{
|
||||
stack = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.getTank().setFluid(stack);
|
||||
// TODO check for change before rebuilding
|
||||
this.reconstructTankInfo();
|
||||
}
|
||||
this.getTank().setFluid(stack);
|
||||
// TODO check for change before rebuilding
|
||||
this.reconstructTankInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate()
|
||||
{
|
||||
return getTank().getFluidAmount() > 0 && sideMap.size() > 0 && getConnectors().size() > 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canUpdate()
|
||||
{
|
||||
return getTank().getFluidAmount() > 0 && sideMap.size() > 0 && getConnectors().size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueUpdate()
|
||||
{
|
||||
return canUpdate();
|
||||
}
|
||||
@Override
|
||||
public boolean continueUpdate()
|
||||
{
|
||||
return canUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconstruct()
|
||||
{
|
||||
this.sideMap.clear();
|
||||
this.maxFlowRate = Integer.MAX_VALUE;
|
||||
this.maxPressure = Integer.MAX_VALUE;
|
||||
super.reconstruct();
|
||||
}
|
||||
@Override
|
||||
public void reconstruct()
|
||||
{
|
||||
this.sideMap.clear();
|
||||
this.maxFlowRate = Integer.MAX_VALUE;
|
||||
this.maxPressure = Integer.MAX_VALUE;
|
||||
super.reconstruct();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconstructConnector(IFluidConnector connector)
|
||||
{
|
||||
super.reconstructConnector(connector);
|
||||
@Override
|
||||
public void reconstructConnector(IFluidConnector connector)
|
||||
{
|
||||
super.reconstructConnector(connector);
|
||||
|
||||
if (connector instanceof IFluidPipe)
|
||||
{
|
||||
if (((IFluidPipe) connector).getMaxFlowRate() < this.maxFlowRate)
|
||||
this.maxFlowRate = ((IFluidPipe) connector).getMaxFlowRate();
|
||||
if (connector instanceof IFluidPipe)
|
||||
{
|
||||
if (((IFluidPipe) connector).getMaxFlowRate() < this.maxFlowRate)
|
||||
this.maxFlowRate = ((IFluidPipe) connector).getMaxFlowRate();
|
||||
|
||||
if (((IFluidPipe) connector).getMaxPressure() < this.maxPressure)
|
||||
this.maxPressure = ((IFluidPipe) connector).getMaxPressure();
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (connector.getConnections()[i] instanceof IFluidHandler && !(connector.getConnections()[i] instanceof IFluidPipe))
|
||||
{
|
||||
EnumSet<ForgeDirection> set = this.sideMap.get(connector.getConnections()[i]);
|
||||
if (set == null)
|
||||
{
|
||||
set = EnumSet.noneOf(ForgeDirection.class);
|
||||
}
|
||||
if (((IFluidPipe) connector).getMaxPressure() < this.maxPressure)
|
||||
this.maxPressure = ((IFluidPipe) connector).getMaxPressure();
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (connector.getConnections()[i] instanceof IFluidHandler && !(connector.getConnections()[i] instanceof IFluidPipe))
|
||||
{
|
||||
EnumSet<ForgeDirection> set = this.sideMap.get(connector.getConnections()[i]);
|
||||
if (set == null)
|
||||
{
|
||||
set = EnumSet.noneOf(ForgeDirection.class);
|
||||
}
|
||||
|
||||
set.add(ForgeDirection.getOrientation(i).getOpposite());
|
||||
sideMap.put((IFluidHandler) connector.getConnections()[i], set);
|
||||
connectionMap.put((IFluidHandler) connector.getConnections()[i], connector);
|
||||
}
|
||||
}
|
||||
}
|
||||
set.add(ForgeDirection.getOrientation(i).getOpposite());
|
||||
sideMap.put((IFluidHandler) connector.getConnections()[i], set);
|
||||
connectionMap.put((IFluidHandler) connector.getConnections()[i], connector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getConnectorClass()
|
||||
{
|
||||
return IFluidPipe.class;
|
||||
}
|
||||
@Override
|
||||
public Class getConnectorClass()
|
||||
{
|
||||
return IFluidPipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidNetwork newInstance()
|
||||
{
|
||||
return new PipeNetwork();
|
||||
}
|
||||
@Override
|
||||
public IFluidNetwork newInstance()
|
||||
{
|
||||
return new PipeNetwork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPressure()
|
||||
{
|
||||
return this.currentPressure;
|
||||
}
|
||||
@Override
|
||||
public int getPressure()
|
||||
{
|
||||
return this.currentPressure;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,210 +27,210 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class PartPipe extends PartFramedConnection<EnumPipeMaterial, IFluidPipe, IFluidNetwork> implements IFluidPipe, TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects
|
||||
{
|
||||
protected FluidTank tank = new FluidTank(1 * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
private boolean isExtracting = false;
|
||||
protected FluidTank tank = new FluidTank(1 * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
private boolean isExtracting = false;
|
||||
|
||||
public PartPipe()
|
||||
{
|
||||
super();
|
||||
material = EnumPipeMaterial.COPPER;
|
||||
}
|
||||
public PartPipe()
|
||||
{
|
||||
super();
|
||||
material = EnumPipeMaterial.COPPER;
|
||||
}
|
||||
|
||||
public PartPipe(int typeID)
|
||||
{
|
||||
material = EnumPipeMaterial.values()[typeID];
|
||||
}
|
||||
public PartPipe(int typeID)
|
||||
{
|
||||
material = EnumPipeMaterial.values()[typeID];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "resonant_induction_pipe";
|
||||
}
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "resonant_induction_pipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
if (isExtracting && getNetwork().getTank().getFluidAmount() < getNetwork().getTank().getCapacity())
|
||||
{
|
||||
for (int i = 0; i < this.getConnections().length; i++)
|
||||
{
|
||||
Object obj = this.getConnections()[i];
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
if (isExtracting && getNetwork().getTank().getFluidAmount() < getNetwork().getTank().getCapacity())
|
||||
{
|
||||
for (int i = 0; i < this.getConnections().length; i++)
|
||||
{
|
||||
Object obj = this.getConnections()[i];
|
||||
|
||||
if (obj instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack drain = ((IFluidHandler) obj).drain(ForgeDirection.getOrientation(i).getOpposite(), getMaxFlowRate(), true);
|
||||
fill(null, drain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack drain = ((IFluidHandler) obj).drain(ForgeDirection.getOrientation(i).getOpposite(), getMaxFlowRate(), true);
|
||||
fill(null, drain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||
{
|
||||
if (BlockAdvanced.isUsableWrench(player, player.getCurrentEquippedItem(), x(), y(), z()))
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
isExtracting = !isExtracting;
|
||||
player.addChatMessage("Pipe extraction mode: " + isExtracting);
|
||||
BlockAdvanced.damageWrench(player, player.getCurrentEquippedItem(), x(), y(), z());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||
{
|
||||
if (BlockAdvanced.isUsableWrench(player, player.getCurrentEquippedItem(), x(), y(), z()))
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
isExtracting = !isExtracting;
|
||||
player.addChatMessage("Pipe extraction mode: " + isExtracting);
|
||||
BlockAdvanced.damageWrench(player, player.getCurrentEquippedItem(), x(), y(), z());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.activate(player, part, item);
|
||||
}
|
||||
return super.activate(player, part, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass)
|
||||
{
|
||||
RenderPipe.INSTANCE.render(this, pos.x, pos.y, pos.z, frame);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass)
|
||||
{
|
||||
RenderPipe.INSTANCE.render(this, pos.x, pos.y, pos.z, frame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaterial(int i)
|
||||
{
|
||||
setMaterial(EnumPipeMaterial.values()[i]);
|
||||
}
|
||||
@Override
|
||||
public void setMaterial(int i)
|
||||
{
|
||||
setMaterial(EnumPipeMaterial.values()[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(Mechanical.itemPipe);
|
||||
}
|
||||
@Override
|
||||
protected ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(Mechanical.itemPipe);
|
||||
}
|
||||
|
||||
/** Fluid network methods. */
|
||||
@Override
|
||||
public IFluidNetwork getNetwork()
|
||||
{
|
||||
if (this.network == null)
|
||||
{
|
||||
this.network = new PipeNetwork();
|
||||
this.network.addConnector(this);
|
||||
}
|
||||
return this.network;
|
||||
}
|
||||
/** Fluid network methods. */
|
||||
@Override
|
||||
public IFluidNetwork getNetwork()
|
||||
{
|
||||
if (this.network == null)
|
||||
{
|
||||
this.network = new PipeNetwork();
|
||||
this.network.addConnector(this);
|
||||
}
|
||||
return this.network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
return getNetwork().fill(this, from, resource, doFill);
|
||||
}
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
return getNetwork().fill(this, from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
return this.getNetwork().getTankInfo();
|
||||
}
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
return this.getNetwork().getTankInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFluidChanged()
|
||||
{
|
||||
}
|
||||
@Override
|
||||
public void onFluidChanged()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getInternalTank()
|
||||
{
|
||||
if (this.tank == null)
|
||||
{
|
||||
this.tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
return this.tank;
|
||||
}
|
||||
@Override
|
||||
public FluidTank getInternalTank()
|
||||
{
|
||||
if (this.tank == null)
|
||||
{
|
||||
this.tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
return this.tank;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canConnectTo(TileEntity tile)
|
||||
{
|
||||
return tile instanceof IFluidHandler;
|
||||
}
|
||||
@Override
|
||||
protected boolean canConnectTo(TileEntity tile)
|
||||
{
|
||||
return tile instanceof IFluidHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IFluidPipe getConnector(TileEntity tile)
|
||||
{
|
||||
return tile instanceof IFluidPipe ? (IFluidPipe) tile : null;
|
||||
}
|
||||
@Override
|
||||
protected IFluidPipe getConnector(TileEntity tile)
|
||||
{
|
||||
return tile instanceof IFluidPipe ? (IFluidPipe) tile : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPressureIn(ForgeDirection side)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getPressureIn(ForgeDirection side)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPressure()
|
||||
{
|
||||
if (this.getNetwork() != null)
|
||||
{
|
||||
return this.getNetwork().getPressure();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getPressure()
|
||||
{
|
||||
if(this.getNetwork() != null)
|
||||
{
|
||||
return this.getNetwork().getPressure();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWrongPressure(ForgeDirection side, int pressure)
|
||||
{
|
||||
@Override
|
||||
public void onWrongPressure(ForgeDirection side, int pressure)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPressure()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
@Override
|
||||
public int getMaxPressure()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFlowRate()
|
||||
{
|
||||
return FluidContainerRegistry.BUCKET_VOLUME;
|
||||
}
|
||||
@Override
|
||||
public int getMaxFlowRate()
|
||||
{
|
||||
return FluidContainerRegistry.BUCKET_VOLUME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
super.save(nbt);
|
||||
nbt.setBoolean("isExtracting", isExtracting);
|
||||
}
|
||||
@Override
|
||||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
super.save(nbt);
|
||||
nbt.setBoolean("isExtracting", isExtracting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
isExtracting = nbt.getBoolean("isExtracting");
|
||||
}
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
isExtracting = nbt.getBoolean("isExtracting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFlow()
|
||||
{
|
||||
return !isExtracting;
|
||||
}
|
||||
@Override
|
||||
public boolean canFlow()
|
||||
{
|
||||
return !isExtracting;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,79 +9,76 @@ import resonantinduction.api.fluid.IFluidConnector;
|
|||
import resonantinduction.api.fluid.IFluidNetwork;
|
||||
import resonantinduction.mechanical.fluid.network.FluidNetwork;
|
||||
|
||||
/**
|
||||
* Network that handles connected tanks
|
||||
/** Network that handles connected tanks
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
* @author DarkGuardsman */
|
||||
public class TankNetwork extends FluidNetwork
|
||||
{
|
||||
@Override
|
||||
public void distributeConnectors()
|
||||
{
|
||||
FluidStack fillStack = this.getTank().getFluid();
|
||||
int lowestY = 255, highestY = 0;
|
||||
@Override
|
||||
public void distributeConnectors()
|
||||
{
|
||||
FluidStack fillStack = this.getTank().getFluid();
|
||||
int lowestY = 255, highestY = 0;
|
||||
|
||||
if (fillStack == null || fillStack.getFluid().isGaseous())
|
||||
{
|
||||
super.distributeConnectors();
|
||||
}
|
||||
else if (this.getConnectors().size() > 0)
|
||||
{
|
||||
fillStack = fillStack.copy();
|
||||
if (fillStack == null || fillStack.getFluid().isGaseous())
|
||||
{
|
||||
super.distributeConnectors();
|
||||
}
|
||||
else if (this.getConnectors().size() > 0)
|
||||
{
|
||||
fillStack = fillStack.copy();
|
||||
|
||||
for (IFluidConnector connector : this.getConnectors())
|
||||
{
|
||||
connector.getInternalTank().setFluid(null);
|
||||
connector.onFluidChanged();
|
||||
for (IFluidConnector connector : this.getConnectors())
|
||||
{
|
||||
connector.getInternalTank().setFluid(null);
|
||||
connector.onFluidChanged();
|
||||
|
||||
if (connector instanceof TileEntity && ((TileEntity) connector).yCoord < lowestY)
|
||||
{
|
||||
lowestY = ((TileEntity) connector).yCoord;
|
||||
}
|
||||
if (connector instanceof TileEntity && ((TileEntity) connector).yCoord > highestY)
|
||||
{
|
||||
highestY = ((TileEntity) connector).yCoord;
|
||||
}
|
||||
}
|
||||
if (connector instanceof TileEntity && ((TileEntity) connector).yCoord < lowestY)
|
||||
{
|
||||
lowestY = ((TileEntity) connector).yCoord;
|
||||
}
|
||||
if (connector instanceof TileEntity && ((TileEntity) connector).yCoord > highestY)
|
||||
{
|
||||
highestY = ((TileEntity) connector).yCoord;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Add path finder to prevent filling when tanks are only connected at the top
|
||||
for (int y = lowestY; y <= highestY; y++)
|
||||
{
|
||||
Set<IFluidConnector> parts = new LinkedHashSet<IFluidConnector>();
|
||||
// TODO Add path finder to prevent filling when tanks are only connected at the top
|
||||
for (int y = lowestY; y <= highestY; y++)
|
||||
{
|
||||
Set<IFluidConnector> parts = new LinkedHashSet<IFluidConnector>();
|
||||
|
||||
for (IFluidConnector part : this.getConnectors())
|
||||
{
|
||||
if (part instanceof IFluidConnector && ((TileEntity) part).yCoord == y)
|
||||
{
|
||||
parts.add(part);
|
||||
}
|
||||
}
|
||||
if (!parts.isEmpty())
|
||||
{
|
||||
this.fillTankSet(fillStack, parts);
|
||||
}
|
||||
for (IFluidConnector part : this.getConnectors())
|
||||
{
|
||||
if (part instanceof IFluidConnector && ((TileEntity) part).yCoord == y)
|
||||
{
|
||||
parts.add(part);
|
||||
}
|
||||
}
|
||||
if (!parts.isEmpty())
|
||||
{
|
||||
this.fillTankSet(fillStack, parts);
|
||||
}
|
||||
|
||||
if (fillStack == null || fillStack.amount <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fillStack == null || fillStack.amount <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidNetwork newInstance()
|
||||
{
|
||||
return new TankNetwork();
|
||||
}
|
||||
@Override
|
||||
public IFluidNetwork newInstance()
|
||||
{
|
||||
return new TankNetwork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPressure()
|
||||
{
|
||||
// TODO implement a compression system that would cause a tank to build up pressure greater
|
||||
// than normal ATM
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getPressure()
|
||||
{
|
||||
//TODO implement a compression system that would cause a tank to build up pressure greater than normal ATM
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ public class GearMultiBlockHandler extends MultiBlockHandler<PartGear>
|
|||
super(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartGear getWrapperAt(Vector3 position)
|
||||
{
|
||||
TileEntity tile = position.getTileEntity(self.getWorld());
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.prefab.part.ItemMultipartBase;
|
||||
import resonantinduction.electrical.wire.EnumWireMaterial;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
|
|
|
@ -104,7 +104,6 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
|||
getMultiBlock().update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientUpdate()
|
||||
{
|
||||
if (getMultiBlock().isPrimary())
|
||||
|
@ -150,7 +149,6 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
|||
/**
|
||||
* Refresh should be called sparingly.
|
||||
*/
|
||||
@Override
|
||||
public void refresh()
|
||||
{
|
||||
connections = new Object[6];
|
||||
|
@ -217,7 +215,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
|||
|
||||
if (connections[checkDir.ordinal()] == null && checkTile instanceof IMechanical)
|
||||
{
|
||||
IMechanical instance = ((IMechanical) checkTile).getInstance(placementSide);
|
||||
IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(placementSide);
|
||||
|
||||
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this) && !(instance instanceof PartGearShaft))
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package resonantinduction.mechanical.gear;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -12,6 +13,7 @@ import resonantinduction.mechanical.network.IMechanical;
|
|||
import resonantinduction.mechanical.network.PartMechanical;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Rotation;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.PartMap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -38,7 +40,6 @@ public class PartGearShaft extends PartMechanical
|
|||
sides[6] = new IndexedCuboid6(6, new Cuboid6(0.36, 0.36, 0.36, 0.64, 0.64, 0.64));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preparePlacement(int side, int itemDamage)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation((byte) (side ^ 1));
|
||||
|
@ -62,7 +63,6 @@ public class PartGearShaft extends PartMechanical
|
|||
/**
|
||||
* Refresh should be called sparingly.
|
||||
*/
|
||||
@Override
|
||||
public void refresh()
|
||||
{
|
||||
connections = new Object[6];
|
||||
|
@ -95,7 +95,7 @@ public class PartGearShaft extends PartMechanical
|
|||
|
||||
if (checkTile instanceof IMechanical)
|
||||
{
|
||||
IMechanical instance = ((IMechanical) checkTile).getInstance(checkDir.getOpposite());
|
||||
IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(checkDir.getOpposite());
|
||||
|
||||
// Only connect to shafts outside of this block space.
|
||||
if (instance != null && instance != this && instance instanceof PartGearShaft && instance.canConnect(checkDir.getOpposite(), this))
|
||||
|
|
|
@ -2,6 +2,7 @@ package resonantinduction.mechanical.gear;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
|
@ -9,6 +10,7 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import resonantinduction.core.Reference;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import resonantinduction.core.Reference;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import calclavia.lib.utility.WorldUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -3,81 +3,81 @@ package resonantinduction.mechanical.motor;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockRIRotatable;
|
||||
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||
import resonantinduction.electrical.generator.TileGenerator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFluidMotor extends BlockRIRotatable
|
||||
{
|
||||
public BlockFluidMotor()
|
||||
{
|
||||
super("FluidMotor");
|
||||
setTextureName(Reference.PREFIX + "material_steel");
|
||||
rotationMask = Byte.parseByte("111111", 2);
|
||||
}
|
||||
public BlockFluidMotor()
|
||||
{
|
||||
super("FluidMotor");
|
||||
setTextureName(Reference.PREFIX + "material_steel");
|
||||
rotationMask = Byte.parseByte("111111", 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
@Override
|
||||
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileGenerator)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
((TileGenerator) tileEntity).isInversed = !((TileGenerator) tileEntity).isInversed;
|
||||
entityPlayer.addChatMessage("Generator now producing " + (((TileGenerator) tileEntity).isInversed ? "mechanical" : "electrical") + " energy.");
|
||||
}
|
||||
if (tileEntity instanceof TileGenerator)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
((TileGenerator) tileEntity).isInversed = !((TileGenerator) tileEntity).isInversed;
|
||||
entityPlayer.addChatMessage("Generator now producing " + (((TileGenerator) tileEntity).isInversed ? "mechanical" : "electrical") + " energy.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileGenerator)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entityPlayer.addChatMessage("Generator torque ratio: " + ((TileGenerator) tileEntity).toggleRatio());
|
||||
}
|
||||
if (tileEntity instanceof TileGenerator)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entityPlayer.addChatMessage("Generator torque ratio: " + ((TileGenerator) tileEntity).toggleRatio());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileGenerator();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return RIBlockRenderingHandler.ID;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return RIBlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,91 +13,91 @@ import calclavia.lib.prefab.tile.TileAdvanced;
|
|||
|
||||
public class TileFluidMotor extends TileAdvanced implements IFluidHandler, IRotatable
|
||||
{
|
||||
ForgeDirection facing = ForgeDirection.UNKNOWN;
|
||||
boolean input = true;
|
||||
final int maxFlow = 1000;
|
||||
int volFilled = 0;
|
||||
int averageVol = 0;
|
||||
ForgeDirection facing = ForgeDirection.UNKNOWN;
|
||||
boolean input = true;
|
||||
final int maxFlow = 1000;
|
||||
int volFilled = 0;
|
||||
int averageVol = 0;
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
}
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (from == getDirection().getOpposite())
|
||||
{
|
||||
TileEntity tileOut = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj);
|
||||
TileEntity tileIn = new Vector3(this).translate(from).getTileEntity(this.worldObj);
|
||||
if (tileIn instanceof IFluidPipe && tileOut instanceof IFluidPipe)
|
||||
{
|
||||
if (((IFluidPipe) tileIn).getPressure() <= ((IFluidPipe) tileOut).getPressure())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (tileOut instanceof IFluidHandler && !(tileOut instanceof TileFluidMotor))
|
||||
{
|
||||
// TODO pass fluid on to the other side of the motor and get average flow rate
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (from == getDirection().getOpposite())
|
||||
{
|
||||
TileEntity tileOut = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj);
|
||||
TileEntity tileIn = new Vector3(this).translate(from).getTileEntity(this.worldObj);
|
||||
if (tileIn instanceof IFluidPipe && tileOut instanceof IFluidPipe)
|
||||
{
|
||||
if (((IFluidPipe) tileIn).getPressure() <= ((IFluidPipe) tileOut).getPressure())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (tileOut instanceof IFluidHandler && !(tileOut instanceof TileFluidMotor))
|
||||
{
|
||||
//TODO pass fluid on to the other side of the motor and get average flow rate
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return !input && from == this.getDirection().getOpposite();
|
||||
}
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return !input && from == this.getDirection().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
if (from == getDirection().getOpposite())
|
||||
{
|
||||
TileEntity tile = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj);
|
||||
if (tile instanceof IFluidHandler && !(tile instanceof TileFluidMotor))
|
||||
{
|
||||
return ((IFluidHandler) tile).getTankInfo(from);
|
||||
}
|
||||
}
|
||||
return new FluidTankInfo[1];
|
||||
}
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
if (from == getDirection().getOpposite())
|
||||
{
|
||||
TileEntity tile = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj);
|
||||
if (tile instanceof IFluidHandler && !(tile instanceof TileFluidMotor))
|
||||
{
|
||||
return ((IFluidHandler) tile).getTankInfo(from);
|
||||
}
|
||||
}
|
||||
return new FluidTankInfo[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
}
|
||||
@Override
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(ForgeDirection direction)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), 3);
|
||||
}
|
||||
@Override
|
||||
public void setDirection(ForgeDirection direction)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ public interface IMechanical extends IConnector<IMechanicalNetwork>
|
|||
|
||||
public boolean inverseRotation(ForgeDirection dir, IMechanical with);
|
||||
|
||||
@Override
|
||||
public IMechanical getInstance(ForgeDirection dir);
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.LinkedHashSet;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.gear.PartGearShaft;
|
||||
import universalelectricity.api.net.IUpdate;
|
||||
import universalelectricity.core.net.Network;
|
||||
import universalelectricity.core.net.NetworkTickHandler;
|
||||
|
@ -135,7 +136,7 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical>
|
|||
|
||||
if (deltaTime > 1)
|
||||
{
|
||||
rotation = (float) (((velocity) * (deltaTime / 1000d) + rotation) % (2 * Math.PI));
|
||||
rotation = (float) (((velocity) * ((double) deltaTime / 1000d) + rotation) % (2 * Math.PI));
|
||||
lastRotateTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,13 +53,13 @@ public class PacketNetwork<C extends IConnector> extends PacketType
|
|||
int y = data.readInt();
|
||||
int z = data.readInt();
|
||||
TileEntity tileEntity = player.worldObj.getBlockTileEntity(x, y, z);
|
||||
System.out.println(tileEntity + " rec: " + new Vector3(x, y, z));
|
||||
// TODO: Somehow this would receive the wrong coordinate once in a while...
|
||||
System.out.println(tileEntity+" rec: "+new Vector3(x,y,z));
|
||||
//TODO: Somehow this would receive the wrong coordinate once in a while...
|
||||
if (tileEntity != null && connectorClass.isAssignableFrom(tileEntity.getClass()))
|
||||
{
|
||||
C instance = (C) ((C) tileEntity).getInstance(ForgeDirection.getOrientation(data.readInt()));
|
||||
Object network = instance.getNetwork();
|
||||
|
||||
|
||||
if (network instanceof IPacketReceiver)
|
||||
{
|
||||
((IPacketReceiver) network).onReceivePacket(data, player, instance);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package resonantinduction.mechanical.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -10,6 +11,11 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Rotation;
|
||||
import codechicken.lib.vec.Transformation;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.microblock.FaceMicroClass;
|
||||
import codechicken.multipart.JCuboidPart;
|
||||
import codechicken.multipart.JNormalOcclusion;
|
||||
import codechicken.multipart.TFacePart;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package resonantinduction.mechanical.network;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -11,8 +13,6 @@ import calclavia.lib.network.IPacketReceiver;
|
|||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public abstract class TileMechanical extends TileAdvanced implements IMechanical, IPacketReceiver
|
||||
{
|
||||
/** The mechanical connections this connector has made */
|
||||
|
|
|
@ -55,50 +55,50 @@ public class BlockFilter extends BlockRI implements ITileEntityProvider
|
|||
* Leak the fluid down.
|
||||
*/
|
||||
/*
|
||||
* BlockFluidMixture fluidBlock = (BlockFluidMixture)
|
||||
* ResonantInduction.blockFluidMixture;
|
||||
* int amount = fluidBlock.getQuantaValue(world, x, y, z);
|
||||
* /**
|
||||
BlockFluidMixture fluidBlock = (BlockFluidMixture) ResonantInduction.blockFluidMixture;
|
||||
int amount = fluidBlock.getQuantaValue(world, x, y, z);
|
||||
|
||||
/**
|
||||
* All fluid is filtered out, spawn all the items.
|
||||
* if (amount <= 1)
|
||||
* {
|
||||
* System.out.println("filter dropped");
|
||||
* for (ItemStack itemStack : ((TileFluidMixture) tileAbove).items)
|
||||
* {
|
||||
* for (Resource resoure : MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER,
|
||||
* itemStack))
|
||||
* {
|
||||
* InventoryUtility.dropItemStack(world, checkAbove.clone().add(0.5),
|
||||
* resoure.getItemStack().copy());
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* int remaining = amount - 1;
|
||||
* /**
|
||||
*
|
||||
if (amount <= 1)
|
||||
{
|
||||
System.out.println("filter dropped");
|
||||
for (ItemStack itemStack : ((TileFluidMixture) tileAbove).items)
|
||||
{
|
||||
for (Resource resoure : MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER, itemStack))
|
||||
{
|
||||
InventoryUtility.dropItemStack(world, checkAbove.clone().add(0.5), resoure.getItemStack().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int remaining = amount - 1;
|
||||
|
||||
/**
|
||||
* Remove liquid from top.
|
||||
* if (remaining > 0)
|
||||
* {
|
||||
* fluidBlock.setQuanta(world, checkAbove.intX(), checkAbove.intY(),
|
||||
* checkAbove.intZ(), remaining);
|
||||
* world.scheduleBlockUpdate(x, y, z, blockID, 20);
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* checkAbove.setBlock(world, 0);
|
||||
* }
|
||||
* /**
|
||||
*
|
||||
if (remaining > 0)
|
||||
{
|
||||
fluidBlock.setQuanta(world, checkAbove.intX(), checkAbove.intY(), checkAbove.intZ(), remaining);
|
||||
world.scheduleBlockUpdate(x, y, z, blockID, 20);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkAbove.setBlock(world, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add liquid to bottom.
|
||||
* if (checkBelow.getBlockID(world) == ResonantInduction.blockFluidMixture.blockID)
|
||||
* {
|
||||
* fluidBlock.setQuanta(world, checkBelow.intX(), checkBelow.intY(),
|
||||
* checkBelow.intZ(), fluidBlock.getQuantaValue(world, checkBelow.intX(),
|
||||
* checkBelow.intY(), checkBelow.intZ()) + 1);
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* checkBelow.setBlock(world, Block.waterStill.blockID, 3);
|
||||
* }
|
||||
*/
|
||||
*
|
||||
if (checkBelow.getBlockID(world) == ResonantInduction.blockFluidMixture.blockID)
|
||||
{
|
||||
fluidBlock.setQuanta(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ(), fluidBlock.getQuantaValue(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ()) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBelow.setBlock(world, Block.waterStill.blockID, 3);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package resonantinduction.mechanical.process;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.api.recipe.MachineRecipes;
|
||||
import resonantinduction.api.recipe.MachineRecipes.RecipeType;
|
||||
import resonantinduction.api.recipe.RecipeUtils.Resource;
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.api.recipe.MachineRecipes;
|
||||
import resonantinduction.api.recipe.MachineRecipes.RecipeType;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.resource.fluid.TileFluidMixture;
|
||||
import resonantinduction.mechanical.fluid.tank.TileTank;
|
||||
import resonantinduction.mechanical.network.TileMechanical;
|
||||
|
|
|
@ -7,7 +7,9 @@ import resonantinduction.core.Reference;
|
|||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||
import resonantinduction.mechanical.network.IMechanical;
|
||||
import calclavia.lib.prefab.turbine.BlockTurbine;
|
||||
import calclavia.lib.prefab.turbine.TileTurbine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package resonantinduction.mechanical.turbine;
|
|||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
|
@ -34,7 +35,7 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer
|
|||
{
|
||||
RenderUtility.rotateBlockBasedOnDirectionUp(tile.getDirection());
|
||||
}
|
||||
|
||||
|
||||
GL11.glRotatef((float) Math.toDegrees(tile.rotation), 0, 1, 0);
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TileWindTurbine extends TileTurbine implements IMechanical
|
|||
{
|
||||
BiomeGenBase biome = worldObj.getBiomeGenForCoords(xCoord, zCoord);
|
||||
boolean hasBonus = biome instanceof BiomeGenOcean || biome instanceof BiomeGenPlains || biome == BiomeGenBase.river;
|
||||
return (long) (worldObj.canBlockSeeTheSky(xCoord, yCoord + 4, zCoord) ? (((float) yCoord + 4) / 256) * 5 : 0) + (hasBonus ? 10 : 0);
|
||||
return (long) (worldObj.canBlockSeeTheSky(xCoord, yCoord + 4, zCoord) ? (((float) yCoord + 4) / (float) 256) * 5 : 0) + (hasBonus ? 10 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue