working on update to 1.5

Not done yet not sure if i will be any time soon.
This commit is contained in:
RSeifert 2013-03-14 01:38:07 -04:00
parent 01e0d80b85
commit feceea5b7b
71 changed files with 845 additions and 1445 deletions

View file

@ -6,10 +6,10 @@
package fluidmech.client.model;
import fluidmech.common.machines.mech.TileEntityGenerator;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.tileentity.TileEntity;
import fluidmech.common.machines.mech.TileEntityGenerator;
public class ModelGenerator extends ModelBase
{

View file

@ -6,11 +6,11 @@
package fluidmech.client.model;
import fluidmech.common.machines.TileEntityTank;
import fluidmech.common.machines.pipes.TileEntityPipe;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.tileentity.TileEntity;
import fluidmech.common.machines.TileEntityTank;
import fluidmech.common.machines.pipes.TileEntityPipe;
public class ModelLiquidTank extends ModelBase
{

View file

@ -1,5 +1,27 @@
package fluidmech.common;
import fluidmech.common.block.BlockPumpMachine;
import fluidmech.common.block.BlockReleaseValve;
import fluidmech.common.block.BlockSink;
import fluidmech.common.block.BlockTank;
import fluidmech.common.block.liquids.BlockWasteLiquid;
import fluidmech.common.item.ItemGuage;
import fluidmech.common.item.ItemLiquidMachine;
import fluidmech.common.item.ItemParts;
import fluidmech.common.item.ItemParts.Parts;
import fluidmech.common.item.ItemPipe;
import fluidmech.common.item.ItemReleaseValve;
import fluidmech.common.item.ItemTank;
import fluidmech.common.machines.TileEntityMinorPump;
import fluidmech.common.machines.TileEntityReleaseValve;
import fluidmech.common.machines.TileEntitySink;
import fluidmech.common.machines.TileEntityTank;
import fluidmech.common.machines.mech.BlockGenerator;
import fluidmech.common.machines.mech.BlockRod;
import fluidmech.common.machines.mech.TileEntityGenerator;
import fluidmech.common.machines.mech.TileEntityRod;
import fluidmech.common.machines.pipes.BlockPipe;
import fluidmech.common.machines.pipes.TileEntityPipe;
import hydraulic.core.implement.ColorCode;
import hydraulic.core.liquids.LiquidHandler;
@ -32,28 +54,6 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import fluidmech.common.block.BlockPumpMachine;
import fluidmech.common.block.BlockReleaseValve;
import fluidmech.common.block.BlockSink;
import fluidmech.common.block.BlockTank;
import fluidmech.common.block.liquids.BlockWasteLiquid;
import fluidmech.common.item.ItemGuage;
import fluidmech.common.item.ItemLiquidMachine;
import fluidmech.common.item.ItemParts;
import fluidmech.common.item.ItemPipe;
import fluidmech.common.item.ItemReleaseValve;
import fluidmech.common.item.ItemTank;
import fluidmech.common.item.ItemParts.Parts;
import fluidmech.common.machines.TileEntityMinorPump;
import fluidmech.common.machines.TileEntityReleaseValve;
import fluidmech.common.machines.TileEntitySink;
import fluidmech.common.machines.TileEntityTank;
import fluidmech.common.machines.mech.BlockGenerator;
import fluidmech.common.machines.mech.BlockRod;
import fluidmech.common.machines.mech.TileEntityGenerator;
import fluidmech.common.machines.mech.TileEntityRod;
import fluidmech.common.machines.pipes.BlockPipe;
import fluidmech.common.machines.pipes.TileEntityPipe;
/**
* Used in the creation of a new mod class

View file

@ -3,7 +3,6 @@ package fluidmech.common;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class TabFluidMech extends CreativeTabs
{

View file

@ -4,11 +4,6 @@ import hydraulic.core.helpers.MetaGroup;
import java.util.List;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntityMinorPump;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
@ -18,123 +13,134 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.components.common.BasicComponents;
import universalelectricity.components.common.block.BlockBasicMachine;
import universalelectricity.prefab.block.BlockAdvanced;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntityMinorPump;
public class BlockPumpMachine extends BlockMachine
public class BlockPumpMachine extends BlockAdvanced
{
public BlockPumpMachine(int id)
{
super("lmMachines", id, Material.iron, TabFluidMech.INSTANCE);
this.setHardness(1f);
this.setResistance(5f);
}
public BlockPumpMachine(int id)
{
super(id, Material.iron);
this.setUnlocalizedName("lmMachines");
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setHardness(1f);
this.setResistance(5f);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
@Override
public int damageDropped(int meta)
{
if (meta < 4) { return 0; }
return meta;
}
@Override
public int damageDropped(int meta)
{
if (meta < 4)
{
return 0;
}
return meta;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
TileEntity ent = world.getBlockTileEntity(x, y, z);
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
TileEntity ent = world.getBlockTileEntity(x, y, z);
if (meta < 4)
{
new ItemStack(FluidMech.blockMachine, 1, 0);
}
if (meta < 4)
{
new ItemStack(FluidMech.blockMachine, 1, 0);
}
return null;
}
return null;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving p)
{
int meta = world.getBlockMetadata(x, y, z);
int angle = MathHelper.floor_double((p.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
TileEntity ent = world.getBlockTileEntity(x, y, z);
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving p, ItemStack itemStack)
{
int meta = world.getBlockMetadata(x, y, z);
int angle = MathHelper.floor_double((p.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
TileEntity ent = world.getBlockTileEntity(x, y, z);
world.setBlockMetadata(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)));
if (ent instanceof TileEntityAdvanced)
{
((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate();
}
world.setBlockMetadataWithNotify(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)), 3);
if (ent instanceof TileEntityAdvanced)
{
((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate();
}
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
if (p instanceof EntityPlayer)
{
// ((EntityPlayer) p).sendChatToPlayer("meta:" +
// world.getBlockMetadata(x, y, z));
}
}
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
if (p instanceof EntityPlayer)
{
// ((EntityPlayer) p).sendChatToPlayer("meta:" +
// world.getBlockMetadata(x, y, z));
}
}
@Override
public TileEntity createNewTileEntity(World var1, int meta)
{
if (meta >= 12)
{
}
else if (meta >= 8)
{
@Override
public TileEntity createTileEntity(World var1, int meta)
{
if (meta >= 12)
{
}
else if (meta >= 8)
{
}
else if (meta >= 4)
{
}
else if (meta >= 4)
{
}
else
{
return new TileEntityMinorPump();
}
return null;
}
}
else
{
return new TileEntityMinorPump();
}
return null;
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 0));
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 0));
}
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int meta = par1World.getBlockMetadata(x, y, z);
int g = MetaGroup.getGrouping(meta);
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int meta = par1World.getBlockMetadata(x, y, z);
int g = MetaGroup.getGrouping(meta);
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (meta == (g * 4) + 3)
{
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4));
return true;
}
else
{
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1);
return true;
}
//return false;
}
if (meta == (g * 4) + 3)
{
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4), 3);
return true;
}
else
{
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
return true;
}
// return false;
}
}

View file

@ -2,27 +2,26 @@ package fluidmech.common.block;
import java.util.Random;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntityReleaseValve;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.implement.IRedstoneReceptor;
import universalelectricity.prefab.block.BlockAdvanced;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntityReleaseValve;
public class BlockReleaseValve extends BlockMachine
public class BlockReleaseValve extends BlockAdvanced
{
public BlockReleaseValve(int par1)
{
super("eValve",par1, Material.iron,TabFluidMech.INSTANCE);
super(par1, Material.iron);
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setUnlocalizedName("eValve");
this.setHardness(1f);
this.setResistance(5f);
this.setTextureFile(FluidMech.BLOCK_TEXTURE_FILE);
}
@Override
@ -43,12 +42,6 @@ public class BlockReleaseValve extends BlockMachine
return false;
}
@Override
public int getBlockTextureFromSideAndMetadata(int side, int meta)
{
return 0;
}
@Override
public boolean renderAsNormalBlock()
{

View file

@ -2,9 +2,6 @@ package fluidmech.common.block;
import hydraulic.core.helpers.MetaGroup;
import hydraulic.core.liquids.LiquidHandler;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntitySink;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
@ -19,170 +16,179 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.block.BlockAdvanced;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntitySink;
public class BlockSink extends BlockMachine
public class BlockSink extends BlockAdvanced
{
public BlockSink(int par1)
{
super("lmSink", par1, Material.iron, TabFluidMech.INSTANCE);
this.setResistance(4f);
this.setHardness(4f);
}
public BlockSink(int par1)
{
super(par1, Material.iron);
this.setUnlocalizedName("lmSink");
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setResistance(4f);
this.setHardness(4f);
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntitySink();
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntitySink();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
if (entityplayer.isSneaking()) { return false; }
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null)
{
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
if (entityplayer.isSneaking())
{
return false;
}
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null)
{
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEntitySink)
{
TileEntitySink tank = (TileEntitySink) tileEntity;
if (tileEntity instanceof TileEntitySink)
{
TileEntitySink tank = (TileEntitySink) tileEntity;
// Handle filled containers
if (liquid != null)
{
if (current.isItemEqual(new ItemStack(Item.potion)))
{
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
}
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
// Handle filled containers
if (liquid != null)
{
if (current.isItemEqual(new ItemStack(Item.potion)))
{
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
}
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
return true;
return true;
// Handle empty containers
}
else
{
// Handle empty containers
}
else
{
if (current.getItem() instanceof ItemArmor && ((ItemArmor) current.getItem()).getArmorMaterial() == EnumArmorMaterial.CLOTH)
{
ItemArmor var13 = (ItemArmor) current.getItem();
var13.removeColor(current);
return true;
}
LiquidStack stack = tank.getStack();
if (stack != null)
{
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
if (current.getItem() instanceof ItemArmor && ((ItemArmor) current.getItem()).getArmorMaterial() == EnumArmorMaterial.CLOTH)
{
ItemArmor var13 = (ItemArmor) current.getItem();
var13.removeColor(current);
return true;
}
LiquidStack stack = tank.getStack();
if (stack != null)
{
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
if (liquid != null)
{
if (!entityplayer.capabilities.isCreativeMode)
{
if (current.stackSize > 1)
{
if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) return false;
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
}
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
}
}
int ammount = liquid.amount;
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
{
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
}
tank.drain(null, ammount, true);
return true;
}
}
}
}
}
if (liquid != null)
{
if (!entityplayer.capabilities.isCreativeMode)
{
if (current.stackSize > 1)
{
if (!entityplayer.inventory.addItemStackToInventory(liquidItem))
return false;
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
}
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
}
}
int ammount = liquid.amount;
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
{
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
}
tank.drain(null, ammount, true);
return true;
}
}
}
}
}
return false;
return false;
}
}
@Override
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int meta = par1World.getBlockMetadata(x, y, z);
int g = MetaGroup.getGrouping(meta);
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@Override
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int meta = par1World.getBlockMetadata(x, y, z);
int g = MetaGroup.getGrouping(meta);
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (meta == (g * 4) + 3)
{
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4));
return true;
}
else
{
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1);
return true;
}
// return false;
}
if (meta == (g * 4) + 3)
{
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4), 3);
return true;
}
else
{
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
return true;
}
// return false;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving)
{
int meta = world.getBlockMetadata(x, y, z);
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
TileEntity ent = world.getBlockTileEntity(x, y, z);
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving, ItemStack itemStack)
{
int meta = world.getBlockMetadata(x, y, z);
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
TileEntity ent = world.getBlockTileEntity(x, y, z);
world.setBlockMetadata(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)));
if (ent instanceof TileEntityAdvanced)
{
((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate();
}
world.setBlockMetadataWithNotify(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)), 3);
if (ent instanceof TileEntityAdvanced)
{
((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate();
}
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
}
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(this, 1, 0);
return new ItemStack(this, 1, 0);
}
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
}

View file

@ -4,9 +4,7 @@ import hydraulic.core.liquids.LiquidHandler;
import java.util.List;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntityTank;
import universalelectricity.prefab.block.BlockAdvanced;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@ -19,142 +17,150 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.BlockMachine;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.TabFluidMech;
import fluidmech.common.machines.TileEntityTank;
public class BlockTank extends BlockMachine
public class BlockTank extends BlockAdvanced
{
public BlockTank(int id)
{
super("lmTank", id, Material.rock, TabFluidMech.INSTANCE);
this.setHardness(1f);
this.setResistance(5f);
}
public BlockTank(int id)
{
super(id, Material.rock);
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setUnlocalizedName("lmTank");
this.setHardness(1f);
this.setResistance(5f);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
@Override
public int damageDropped(int meta)
{
return meta;
}
@Override
public int damageDropped(int meta)
{
return meta;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
if (entityplayer.isSneaking()) { return false; }
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null)
{
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
if (entityplayer.isSneaking())
{
return false;
}
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null)
{
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEntityTank)
{
TileEntityTank tank = (TileEntityTank) tileEntity;
if (tileEntity instanceof TileEntityTank)
{
TileEntityTank tank = (TileEntityTank) tileEntity;
// Handle filled containers
if (liquid != null)
{
if (current.isItemEqual(new ItemStack(Item.potion)))
{
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
}
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
// Handle filled containers
if (liquid != null)
{
if (current.isItemEqual(new ItemStack(Item.potion)))
{
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
}
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
return true;
return true;
// Handle empty containers
}
else
{
// Handle empty containers
}
else
{
LiquidStack stack = tank.getStack();
if (stack != null)
{
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
LiquidStack stack = tank.getStack();
if (stack != null)
{
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
if (liquid != null)
{
if (!entityplayer.capabilities.isCreativeMode)
{
if (current.stackSize > 1)
{
if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) return false;
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
}
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
}
}
int ammount = liquid.amount;
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
{
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
}
tank.drain(null, ammount, true);
return true;
}
}
}
}
}
if (liquid != null)
{
if (!entityplayer.capabilities.isCreativeMode)
{
if (current.stackSize > 1)
{
if (!entityplayer.inventory.addItemStackToInventory(liquidItem))
return false;
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
}
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
}
}
int ammount = liquid.amount;
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
{
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
}
tank.drain(null, ammount, true);
return true;
}
}
}
}
}
return false;
return false;
}
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityTank();
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityTank();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(this, 1, meta);
return new ItemStack(this, 1, meta);
}
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 1));
par3List.add(new ItemStack(par1, 1, 4));
par3List.add(new ItemStack(par1, 1, 13));
par3List.add(new ItemStack(par1, 1, 15));
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 1));
par3List.add(new ItemStack(par1, 1, 4));
par3List.add(new ItemStack(par1, 1, 13));
par3List.add(new ItemStack(par1, 1, 15));
}
}

View file

@ -4,31 +4,34 @@ import hydraulic.core.implement.IReadOut;
import java.util.List;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import universalelectricity.components.common.BasicComponents;
import universalelectricity.components.common.item.ItemBasic;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
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.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
public class ItemGuage extends Item
public class ItemGuage extends ItemBasic
{
private int spawnID;
public ItemGuage(int id)
{
super(id);
super("lmTool", id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("lmTool");
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setMaxStackSize(1);
this.setTextureFile(FluidMech.ITEM_TEXTURE_FILE);
}
@Override
@ -37,18 +40,6 @@ public class ItemGuage extends Item
par3List.add(new ItemStack(this, 1, 0));
}
@Override
public int getIconFromDamage(int par1)
{
switch (par1)
{
case 0:
return 24;
case 1:
}
return this.iconIndex;
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int x, int y, int z, int side, float par8, float par9, float par10)
{
@ -80,10 +71,4 @@ public class ItemGuage extends Item
return false;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return this.getItemName() + "." + itemstack.getItemDamage();
}
}

View file

@ -2,12 +2,11 @@ package fluidmech.common.item;
import java.util.List;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
/** A metadata item containing parts of various machines in Liquid Mechanics Mod.
*

View file

@ -1,134 +0,0 @@
package fluidmech.common.item;
import java.util.List;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ItemValve extends ItemBlock
{
int index = 26;
private int spawnID;
public ItemValve(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("Machine");
this.setCreativeTab(TabFluidMech.INSTANCE);
}
@Override
public int getIconFromDamage(int par1)
{
return par1 + index;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return itemstack.getItemDamage() == 0 ? "Pump" : "Conderser";// itemstack.getItemDamage() ==
// 4 ?
// "Condenser":"Unknown";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(this, 1, 0));
par3List.add(new ItemStack(this, 1, 4));
}
public String getTextureFile()
{
return FluidMech.ITEM_TEXTURE_FILE;
}
@Override
public String getItemName()
{
return "Machines";
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
int blockID = par3World.getBlockId(par4, par5, par6);
spawnID = FluidMech.blockReleaseValve.blockID;
if (blockID == Block.snow.blockID)
{
par7 = 1;
}
else if (blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID && blockID != Block.deadBush.blockID)
{
if (par7 == 0)
{
--par5;
}
if (par7 == 1)
{
++par5;
}
if (par7 == 2)
{
--par6;
}
if (par7 == 3)
{
++par6;
}
if (par7 == 4)
{
--par4;
}
if (par7 == 5)
{
++par4;
}
}
if (FluidMech.blockPipe.canPlaceBlockAt(par3World, par4, par5, par6))
{
Block var9 = Block.blocksList[this.spawnID];
par3World.editingBlocks = true;
int angle = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, var9.blockID, angle + itemStack.getItemDamage()))
{
if (par3World.getBlockId(par4, par5, par6) == var9.blockID)
{
Block.blocksList[this.spawnID].onBlockAdded(par3World, par4, par5, par6);
Block.blocksList[this.spawnID].onBlockPlacedBy(par3World, par4, par5, par6, player);
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
}
--itemStack.stackSize;
par3World.editingBlocks = false;
return true;
}
}
par3World.editingBlocks = false;
return false;
}
}

View file

@ -1,5 +1,6 @@
package fluidmech.common.machines;
import fluidmech.common.FluidMech;
import hydraulic.core.helpers.MetaGroup;
import hydraulic.core.implement.ColorCode;
import hydraulic.core.implement.IPsiCreator;
@ -19,19 +20,15 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.electricity.ElectricityNetwork;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import universalelectricity.prefab.tile.TileEntityElectricityReceiver;
import universalelectricity.prefab.tile.TileEntityElectricityRunnable;
import com.google.common.io.ByteArrayDataInput;
import fluidmech.common.FluidMech;
public class TileEntityMinorPump extends TileEntityElectricityRunnable implements IPacketReceiver, IReadOut, IPsiCreator
{
public final double WATTS_PER_TICK = (400 / 20);
@ -50,7 +47,6 @@ public class TileEntityMinorPump extends TileEntityElectricityRunnable implement
public void initiate()
{
this.getConnections();
ElectricityConnections.registerConnector(this, EnumSet.of(back, side));
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, FluidMech.blockMachine.blockID);
}
@ -62,7 +58,7 @@ public class TileEntityMinorPump extends TileEntityElectricityRunnable implement
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
back = ForgeDirection.getOrientation(notchMeta);
side = Vector3.getOrientationFromSide(back, ForgeDirection.WEST);
side = VectorHelper.getOrientationFromSide(back, ForgeDirection.WEST);
if (notchMeta == 2 || notchMeta == 3)
{
@ -231,4 +227,10 @@ public class TileEntityMinorPump extends TileEntityElectricityRunnable implement
return dir == this.side.getOpposite() && this.color.isValidLiquid(type.getStack());
}
@Override
public boolean canConnect(ForgeDirection direction)
{
return direction == back;
}
}

View file

@ -1,5 +1,6 @@
package fluidmech.common.machines;
import fluidmech.common.machines.pipes.TileEntityPipe;
import hydraulic.core.helpers.connectionHelper;
import hydraulic.core.implement.ColorCode;
import hydraulic.core.implement.IColorCoded;
@ -11,11 +12,7 @@ import hydraulic.core.liquids.LiquidHandler;
import java.util.ArrayList;
import java.util.List;
import fluidmech.common.block.BlockReleaseValve;
import fluidmech.common.machines.pipes.TileEntityPipe;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -23,7 +20,6 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.implement.IRedstoneReceptor;
import universalelectricity.prefab.tile.TileEntityAdvanced;
public class TileEntityReleaseValve extends TileEntityAdvanced implements IPsiCreator, IReadOut
@ -43,7 +39,7 @@ public class TileEntityReleaseValve extends TileEntityAdvanced implements IPsiCr
{
super.updateEntity();
this.isPowered = worldObj.isBlockGettingPowered(xCoord, yCoord, zCoord) || worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
this.isPowered = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
connected = connectionHelper.getSurroundingTileEntities(this);

View file

@ -1,5 +1,6 @@
package fluidmech.common.machines;
import fluidmech.common.FluidMech;
import hydraulic.core.implement.ColorCode;
import hydraulic.core.implement.IColorCoded;
import hydraulic.core.liquids.LiquidHandler;
@ -21,8 +22,6 @@ import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
import fluidmech.common.FluidMech;
public class TileEntitySink extends TileEntity implements IPacketReceiver, ITankContainer, IColorCoded
{
public TileEntity[] cc = { null, null, null, null, null, null };

View file

@ -2,10 +2,6 @@ package fluidmech.common.machines.mech;
import java.util.ArrayList;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
@ -14,14 +10,19 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import universalelectricity.prefab.block.BlockAdvanced;
import universalelectricity.prefab.implement.IRedstoneReceptor;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
public class BlockGenerator extends universalelectricity.prefab.BlockMachine
public class BlockGenerator extends BlockAdvanced
{
public BlockGenerator(int id)
{
super("lmGen", id, Material.iron);
super(id, Material.iron);
this.setUnlocalizedName("lmGen");
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setHardness(1f);
this.setResistance(5f);
@ -41,10 +42,10 @@ public class BlockGenerator extends universalelectricity.prefab.BlockMachine
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving)
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving, ItemStack stack)
{
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
world.setBlockAndMetadataWithUpdate(x, y, z, blockID, angle, true);
world.setBlockAndMetadataWithNotify(x, y, z, blockID, angle, 3);
}
@Override
@ -54,11 +55,11 @@ public class BlockGenerator extends universalelectricity.prefab.BlockMachine
int metadata = par1World.getBlockMetadata(x, y, z);
if (metadata < 3)
{
par1World.setBlockAndMetadata(x, y, z, blockID, metadata + angle);
par1World.setBlockAndMetadataWithNotify(x, y, z, blockID, metadata + angle, 3);
}
else
{
par1World.setBlockAndMetadata(x, y, z, blockID, 0);
par1World.setBlockAndMetadataWithNotify(x, y, z, blockID, 0, 3);
}
return true;
}
@ -91,26 +92,6 @@ public class BlockGenerator extends universalelectricity.prefab.BlockMachine
public void onNeighborBlockChange(World par1World, int x, int y, int z, int side)
{
super.onNeighborBlockChange(par1World, x, y, z, side);
this.checkForPower(par1World, x, y, z);
}
public static void checkForPower(World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEntityGenerator)
{
boolean powered = ((TileEntityGenerator) tileEntity).isPowered;
boolean beingPowered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockGettingPowered(x, y, z);
if (powered && !beingPowered)
{
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOff();
}
else if (!powered && beingPowered)
{
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOn();
}
}
}
}

View file

@ -1,8 +1,6 @@
package fluidmech.common.machines.mech;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import universalelectricity.prefab.block.BlockAdvanced;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
@ -12,99 +10,101 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import fluidmech.client.render.BlockRenderHelper;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
public class BlockRod extends universalelectricity.prefab.BlockMachine
public class BlockRod extends BlockAdvanced
{
public BlockRod(int par1)
{
super("MechanicRod", par1, Material.iron);
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setHardness(1f);
this.setResistance(5f);
}
public BlockRod(int par1)
{
super(par1, Material.iron);
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setUnlocalizedName("MechanicRod");
this.setHardness(1f);
this.setResistance(5f);
}
@Override
public int damageDropped(int metadata)
{
return 0;
}
@Override
public int damageDropped(int metadata)
{
return 0;
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k,
EntityLiving player)
{
int angle = MathHelper
.floor_double((player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int meta = 0;
ForgeDirection idr;
int dZ = 0;
int dX = 0;
switch (angle)
{
case 0:
meta = 2;
dZ--;
break;
case 1:
meta = 5;
dX--;
break;
case 2:
meta = 3;
dZ++;
break;
case 3:
meta = 4;
dX++;
break;
}
world.setBlockAndMetadataWithUpdate(i, j, k, blockID, meta, true);
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving player, ItemStack stack)
{
int angle = MathHelper.floor_double((player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int meta = 0;
ForgeDirection idr;
int dZ = 0;
int dX = 0;
switch (angle)
{
case 0:
meta = 2;
dZ--;
break;
case 1:
meta = 5;
dX--;
break;
case 2:
meta = 3;
dZ++;
break;
case 3:
meta = 4;
dX++;
break;
}
world.setBlockAndMetadataWithNotify(i, j, k, blockID, meta, 3);
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta >= 5)
{
world.setBlockMetadataWithNotify(x, y, z, 0);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, meta + 1);
}
return true;
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta >= 5)
{
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
}
return true;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityRod();
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityRod();
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
return new ItemStack(FluidMech.blockRod, 1, 0);
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
return new ItemStack(FluidMech.blockRod, 1, 0);
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
}

View file

@ -11,21 +11,22 @@ import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.block.IConductor;
import universalelectricity.core.electricity.ElectricityNetwork;
import universalelectricity.core.implement.IConductor;
import universalelectricity.core.electricity.ElectricityNetworkHelper;
import universalelectricity.core.electricity.IElectricityNetwork;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import universalelectricity.prefab.implement.IRedstoneReceptor;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.tile.TileEntityElectricityProducer;
import universalelectricity.prefab.tile.TileEntityElectrical;
import com.google.common.io.ByteArrayDataInput;
import fluidmech.api.mech.IForce;
import fluidmech.common.FluidMech;
public class TileEntityGenerator extends TileEntityElectricityProducer implements IPacketReceiver, IForce, IReadOut, IRedstoneReceptor
public class TileEntityGenerator extends TileEntityElectrical implements IPacketReceiver, IForce, IReadOut, IRedstoneReceptor
{
public boolean isPowered = false;
@ -42,34 +43,6 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
IConductor[] wires = { null, null, null, null, null, null };
public boolean needUpdate()
{
return false;
}
public void initiate()
{
this.registerConnections();
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, FluidMech.blockGenerator.blockID);
}
public void registerConnections()
{
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
ForgeDirection[] dirs = new ForgeDirection[] { ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN };
ElectricityConnections.registerConnector(this, EnumSet.of(facing.getOpposite()));
for (int i = 2; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (dir != facing && dir != facing.getOpposite())
{
dirs[i] = dir;
}
}
ElectricityConnections.registerConnector(this, EnumSet.of(dirs[0], dirs[1], dirs[2], dirs[3], dirs[4], dirs[5]));
}
@Override
public void updateEntity()
{
@ -88,7 +61,6 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
}// end wire count
if (tCount-- <= 0)
{
BlockGenerator.checkForPower(worldObj, xCoord, yCoord, zCoord);
tCount = 10;
if (this.force > 0 || this.isPowered)
{
@ -115,8 +87,8 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
if (dir != facing && dir != facing.getOpposite())
{
TileEntity outputTile = Vector3.getConnectorFromSide(this.worldObj, new Vector3(this), dir);
ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(outputTile, dir);
TileEntity outputTile = VectorHelper.getConnectorFromSide(this.worldObj, new Vector3(this), dir);
IElectricityNetwork network = ElectricityNetworkHelper.getNetworkFromTileEntity(outputTile, dir);
if (network != null)
{
if (network.getRequest().getWatts() > 0)
@ -138,8 +110,8 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (dir != facing && dir != facing.getOpposite())
{
TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), dir);
ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, dir);
TileEntity inputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), dir);
IElectricityNetwork network = ElectricityNetworkHelper.getNetworkFromTileEntity(inputTile, dir);
if (network != null)
{
@ -158,7 +130,7 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
if (this.joulesReceived >= this.WATTS_PER_TICK - 50)
{
joulesReceived -= this.WATTS_PER_TICK;
TileEntity rod = Vector3.getTileEntityFromSide(worldObj, new Vector3(this), facing);
TileEntity rod = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), facing);
if (rod instanceof IForce && ((IForce) rod).canInputSide(facing))
{
((IForce) rod).applyForce(10000);
@ -223,7 +195,10 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
@Override
public int getForceSide(ForgeDirection side)
{
if (side == facing.getOpposite()) { return aForce; }
if (side == facing.getOpposite())
{
return aForce;
}
return 0;
}
@ -236,14 +211,20 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
@Override
public boolean canOutputSide(ForgeDirection side)
{
if (side == facing) { return true; }
if (side == facing)
{
return true;
}
return false;
}
@Override
public boolean canInputSide(ForgeDirection side)
{
if (side == facing || side == facing.getOpposite()) { return true; }
if (side == facing || side == facing.getOpposite())
{
return true;
}
return false;
}
@ -272,15 +253,18 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
@Override
public boolean isDisabled()
{
if (disableTicks-- <= 0) { return false; }
if (disableTicks-- <= 0)
{
return false;
}
return true;
}
@Override
public double getVoltage(Object... data)
public double getVoltage()
{
return 120;
return 120;
}
@Override
@ -308,4 +292,13 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
}
@Override
public boolean canConnect(ForgeDirection dir)
{
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
return dir != facing && dir != facing.getOpposite();
}
}

View file

@ -16,7 +16,6 @@ import com.google.common.io.ByteArrayDataInput;
import fluidmech.api.mech.IForce;
import fluidmech.common.FluidMech;
public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce, IReadOut
{
@ -46,7 +45,7 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce
}
if (!worldObj.isRemote)
{
TileEntity ent = Vector3.getTileEntityFromSide(worldObj, new Vector3(this), facing);
TileEntity ent = worldObj.getBlockTileEntity(xCoord + facing.offsetX, yCoord + facing.offsetY, zCoord + facing.offsetZ);
appliedForce = Math.max(currentForce - 20, 0);
if (ent instanceof IForce && (((IForce) ent).canInputSide(facing)))
{
@ -72,14 +71,20 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce
@Override
public boolean canOutputSide(ForgeDirection side)
{
if (side == facing || side == facing.getOpposite()) { return true; }
if (side == facing || side == facing.getOpposite())
{
return true;
}
return false;
}
@Override
public boolean canInputSide(ForgeDirection side)
{
if (side == facing || side == facing.getOpposite()) { return true; }
if (side == facing || side == facing.getOpposite())
{
return true;
}
return false;
}

View file

@ -2,8 +2,7 @@ package fluidmech.common.machines.pipes;
import java.util.List;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
import universalelectricity.prefab.block.BlockAdvanced;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@ -11,16 +10,18 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
import fluidmech.common.FluidMech;
import fluidmech.common.TabFluidMech;
public class BlockPipe extends BlockMachine
public class BlockPipe extends BlockAdvanced
{
public BlockPipe(int id)
{
super("Pipe", id, Material.iron, TabFluidMech.INSTANCE);
super(id, Material.iron);
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
this.setHardness(1f);
this.setBlockName("lmPipe");
this.setCreativeTab(TabFluidMech.INSTANCE);
this.setUnlocalizedName("lmPipe");
this.setResistance(3f);
}

View file

@ -1,68 +0,0 @@
package fluidmech.common.machines.pipes;
import fluidmech.common.FluidMech;
import hydraulic.core.implement.ColorCode;
import hydraulic.prefab.TileEntityFluidConveyor;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityNewPipes extends TileEntityFluidConveyor
{
public static int MAX_FLOW = LiquidContainerRegistry.BUCKET_VOLUME;
public static double MAX_AMPS = 200;
public ColorCode color = ColorCode.NONE;
public TileEntityNewPipes()
{
this.channel = FluidMech.CHANNEL;
}
@Override
public int getMaxFlowRate(LiquidStack stack)
{
return this.MAX_FLOW;
}
@Override
public double getMaxPressure(ForgeDirection side)
{
return this.MAX_AMPS;
}
@Override
public void onOverPressure()
{
if (!this.worldObj.isRemote)
{
this.worldObj.setBlockWithNotify(this.xCoord, this.yCoord, this.zCoord, Block.fire.blockID);
// TODO make place a broken pipe, damage stuff, go boom, or something instead of just
// destroying it
}
}
@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
{
}
@Override
public ColorCode getColor()
{
return color;
}
@Override
public void setColor(Object obj)
{
this.color = ColorCode.get(obj);
}
}

View file

@ -210,7 +210,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
}
else
{
return this.causeMix(stack, resource);
//return this.causeMix(stack, resource);
}
}
@ -227,33 +227,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
return tank.fill(resource, doFill);
}
public int causeMix(LiquidStack stored, LiquidStack fill)
{
if (stored == null || fill == null)
{
return 0;
}
// water flowing into lava creates obby
if (fill.isLiquidEqual(LiquidHandler.lava.getStack()) && fill.isLiquidEqual(LiquidHandler.water.getStack()))
{
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Block.obsidian.blockID);
return fill.amount;
}// lava flowing into water creates cobble
else if (fill.isLiquidEqual(LiquidHandler.water.getStack()) && fill.isLiquidEqual(LiquidHandler.lava.getStack()))
{
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Block.cobblestone.blockID);
return fill.amount;
}
else
// anything else creates waste liquid
{
int f = this.tank.fill(new LiquidStack(stored.itemID, fill.amount, stored.itemMeta), true);
int s = this.tank.getLiquid().amount;
LiquidStack stack = LiquidHandler.getStack(LiquidHandler.waste, s);
this.tank.setLiquid(stack);
return f;
}
}
@Override
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)

View file

@ -4,10 +4,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeVersion;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;

View file

@ -1,9 +1,9 @@
package hydraulic.core.helpers;
import universalelectricity.core.vector.Vector3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
public class connectionHelper
{

View file

@ -1,11 +1,12 @@
package hydraulic.core.implement;
import hydraulic.core.liquids.LiquidData;
import hydraulic.core.liquids.LiquidHandler;
import java.util.ArrayList;
import java.util.List;
import net.minecraftforge.liquids.LiquidStack;
import hydraulic.core.liquids.LiquidData;
import hydraulic.core.liquids.LiquidHandler;
public enum ColorCode
{

View file

@ -4,7 +4,6 @@ import hydraulic.core.liquids.HydraulicNetwork;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.core.electricity.ElectricityNetwork;
/**
* Must be applied to all tile entities that are conductors.

View file

@ -5,10 +5,8 @@ import hydraulic.core.implement.ColorCode;
import hydraulic.core.implement.IFluidPipe;
import hydraulic.core.implement.IPsiCreator;
import hydraulic.core.implement.IPsiMachine;
import hydraulic.core.implement.IPsiReciever;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.minecraft.tileentity.TileEntity;

View file

@ -6,7 +6,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;

View file

@ -1,54 +0,0 @@
package hydraulic.prefab;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.core.implement.IConductor;
public abstract class BlockFluidPipe extends BlockContainer
{
public BlockFluidPipe(int id, Material material)
{
super(id, material);
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
if (tileEntity instanceof IConductor)
{
((IConductor) tileEntity).refreshConnectedBlocks();
world.markBlockForUpdate(x, y, z);
}
}
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed
* (coordinates passed are their own) Args: x, y, z, neighbor blockID
*/
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
if (tileEntity instanceof IConductor)
{
((IConductor) tileEntity).refreshConnectedBlocks();
world.markBlockForUpdate(x, y, z);
}
}
}
}

View file

@ -1,244 +0,0 @@
package hydraulic.prefab;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlowing;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import net.minecraftforge.liquids.ILiquid;
public class LiquidFiniteFlowing extends BlockFlowing implements ILiquid {
int numAdjacentSources = 0;
int[] flowCost = new int[4];
boolean[] isOptimalFlowDirection = new boolean[4];
public LiquidFiniteFlowing(int blockId)
{
super(blockId, Material.water);
this.disableStats();
this.setHardness(100);
this.setTextureFile("");
}
private void updateFlow(World world, int i, int j, int k) {
world.markBlockRangeForRenderUpdate(i, j, k, i, j, k);
world.markBlockForUpdate(i, j, k);
}
@Override
public void updateTick(World world, int i, int j, int k, Random random) {
int l = getFlowDecay(world, i, j, k);
byte byte0 = 1;
boolean flag = true;
if (l > 0) {
int i1 = -100;
numAdjacentSources = 0;
i1 = getSmallestFlowDecay(world, i - 1, j, k, i1);
i1 = getSmallestFlowDecay(world, i + 1, j, k, i1);
i1 = getSmallestFlowDecay(world, i, j, k - 1, i1);
i1 = getSmallestFlowDecay(world, i, j, k + 1, i1);
int j1 = i1 + byte0;
if (j1 >= 8 || i1 < 0) {
j1 = -1;
}
if (getFlowDecay(world, i, j + 1, k) >= 0) {
int l1 = getFlowDecay(world, i, j + 1, k);
if (l1 >= 8) {
j1 = l1;
} else {
j1 = l1 + 8;
}
}
if (j1 != l) {
l = j1;
if (l < 0) {
world.setBlockWithNotify(i, j, k, 0);
} else {
world.setBlockMetadataWithNotify(i, j, k, l);
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
world.notifyBlocksOfNeighborChange(i, j, k, blockID);
}
} else if (flag) {
updateFlow(world, i, j, k);
}
} else {
updateFlow(world, i, j, k);
}
if (liquidCanDisplaceBlock(world, i, j - 1, k)) {
if (l >= 8) {
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l);
} else {
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l + 8);
}
} else if (l >= 0 && (l == 0 || blockBlocksFlow(world, i, j - 1, k))) {
boolean aflag[] = getOptimalFlowDirections(world, i, j, k);
int k1 = l + byte0;
if (l >= 8) {
k1 = 1;
}
if (k1 >= 8)
return;
if (aflag[0]) {
flowIntoBlock(world, i - 1, j, k, k1);
}
if (aflag[1]) {
flowIntoBlock(world, i + 1, j, k, k1);
}
if (aflag[2]) {
flowIntoBlock(world, i, j, k - 1, k1);
}
if (aflag[3]) {
flowIntoBlock(world, i, j, k + 1, k1);
}
}
}
private void flowIntoBlock(World world, int i, int j, int k, int l) {
if (liquidCanDisplaceBlock(world, i, j, k)) {
int i1 = world.getBlockId(i, j, k);
if (i1 > 0) {
Block.blocksList[i1].dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
}
world.setBlockAndMetadataWithNotify(i, j, k, blockID, l);
}
}
private int calculateFlowCost(World world, int i, int j, int k, int l, int i1) {
int j1 = 1000;
for (int k1 = 0; k1 < 4; k1++) {
if (k1 == 0 && i1 == 1 || k1 == 1 && i1 == 0 || k1 == 2 && i1 == 3 || k1 == 3 && i1 == 2) {
continue;
}
int l1 = i;
int i2 = j;
int j2 = k;
if (k1 == 0) {
l1--;
}
if (k1 == 1) {
l1++;
}
if (k1 == 2) {
j2--;
}
if (k1 == 3) {
j2++;
}
if (blockBlocksFlow(world, l1, i2, j2) || world.getBlockMaterial(l1, i2, j2) == blockMaterial && world.getBlockMetadata(l1, i2, j2) == 0) {
continue;
}
if (!blockBlocksFlow(world, l1, i2 - 1, j2))
return l;
if (l >= 4) {
continue;
}
int k2 = calculateFlowCost(world, l1, i2, j2, l + 1, k1);
if (k2 < j1) {
j1 = k2;
}
}
return j1;
}
private boolean[] getOptimalFlowDirections(World world, int i, int j, int k) {
for (int l = 0; l < 4; l++) {
flowCost[l] = 1000;
int j1 = i;
int i2 = j;
int j2 = k;
if (l == 0) {
j1--;
}
if (l == 1) {
j1++;
}
if (l == 2) {
j2--;
}
if (l == 3) {
j2++;
}
if (blockBlocksFlow(world, j1, i2, j2) || world.getBlockMaterial(j1, i2, j2) == blockMaterial && world.getBlockMetadata(j1, i2, j2) == 0) {
continue;
}
if (!blockBlocksFlow(world, j1, i2 - 1, j2)) {
flowCost[l] = 0;
} else {
flowCost[l] = calculateFlowCost(world, j1, i2, j2, 1, l);
}
}
int i1 = flowCost[0];
for (int k1 = 1; k1 < 4; k1++) {
if (flowCost[k1] < i1) {
i1 = flowCost[k1];
}
}
for (int l1 = 0; l1 < 4; l1++) {
isOptimalFlowDirection[l1] = flowCost[l1] == i1;
}
return isOptimalFlowDirection;
}
private boolean blockBlocksFlow(World world, int i, int j, int k) {
int l = world.getBlockId(i, j, k);
if (l == Block.doorWood.blockID || l == Block.doorSteel.blockID || l == Block.signPost.blockID || l == Block.ladder.blockID || l == Block.reed.blockID)
return true;
if (l == 0)
return false;
Material material = Block.blocksList[l].blockMaterial;
return material.isSolid();
}
protected int getSmallestFlowDecay(World world, int i, int j, int k, int l) {
int i1 = getFlowDecay(world, i, j, k);
if (i1 < 0)
return l;
if (i1 >= 8) {
i1 = 0;
}
return l >= 0 && i1 >= l ? l : i1;
}
private boolean liquidCanDisplaceBlock(World world, int i, int j, int k) {
Material material = world.getBlockMaterial(i, j, k);
if (material == blockMaterial)
return false;
else
return !blockBlocksFlow(world, i, j, k);
}
@Override
public void onBlockAdded(World world, int i, int j, int k) {
super.onBlockAdded(world, i, j, k);
if (world.getBlockId(i, j, k) == blockID) {
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
}
}
@Override
public int stillLiquidId() {
return this.blockID;
}
@Override
public boolean isMetaSensitive() {
return false;
}
@Override
public int stillLiquidMeta() {
return 0;
}
@Override
public boolean isBlockReplaceable(World world, int i, int j, int k) {
return true;
}
}

View file

@ -1,56 +0,0 @@
package hydraulic.prefab;
import net.minecraft.block.BlockStationary;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import net.minecraftforge.liquids.ILiquid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LiquidFiniteStill extends BlockStationary implements ILiquid
{
public LiquidFiniteStill(int blockId)
{
super(blockId, Material.water);
this.setHardness(100);
this.disableStats();
this.setTextureFile("");
}
@SideOnly(Side.CLIENT)
public int getBlockColor()
{
return 0xFFFFFF;
}
@Override
public int tickRate()
{
return 20;
}
@Override
public int stillLiquidId()
{
return this.blockID;
}
@Override
public boolean isMetaSensitive()
{
return false;
}
@Override
public int stillLiquidMeta()
{
return 0;
}
@Override
public boolean isBlockReplaceable(World world, int x, int y, int z)
{
return true;
}
}

View file

@ -1,234 +0,0 @@
package hydraulic.prefab;
import hydraulic.core.implement.IColorCoded;
import hydraulic.core.implement.IFluidPipe;
import hydraulic.core.implement.IPsiCreator;
import hydraulic.core.implement.IPsiMachine;
import hydraulic.core.liquids.HydraulicNetworkManager;
import hydraulic.core.liquids.HydraulicNetwork;
import hydraulic.core.liquids.LiquidData;
import hydraulic.core.liquids.LiquidHandler;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import org.bouncycastle.util.Arrays;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* A Pre-made TileEntity for creating new pipe like TileEntities
*
* @author Calclavia,DarkGuardsman
*
*/
public abstract class TileEntityFluidConveyor extends TileEntityAdvanced implements IFluidPipe, IPacketReceiver
{
private HydraulicNetwork network;
/**
* Used client side to render.
*/
public boolean[] visuallyConnected = { false, false, false, false, false, false };
/**
* Stores information on the blocks that this conductor is connected to.
*/
public TileEntity[] connectedBlocks = { null, null, null, null, null, null };
protected String channel = "";
protected LiquidData liquidData = LiquidHandler.unkown;
public TileEntityFluidConveyor()
{
this.reset();
}
@Override
public HydraulicNetwork getNetwork()
{
return this.network;
}
@Override
public void setNetwork(HydraulicNetwork network)
{
this.network = network;
}
@Override
public TileEntity[] getConnectedBlocks()
{
return this.connectedBlocks;
}
@Override
public void updateConnection(TileEntity tileEntity, ForgeDirection side)
{
if (!this.worldObj.isRemote)
{
if (tileEntity != null)
{
if (this.canConnect(tileEntity, side.getOpposite()))
{
this.connectedBlocks[side.ordinal()] = tileEntity;
this.visuallyConnected[side.ordinal()] = true;
if (tileEntity.getClass() == this.getClass())
{
HydraulicNetworkManager.instance.mergeConnection(this.getNetwork(), ((IFluidPipe) tileEntity).getNetwork());
}
return;
}
}
if (this.connectedBlocks[side.ordinal()] != null)
{
if (this.connectedBlocks[side.ordinal()] instanceof IFluidPipe)
{
HydraulicNetworkManager.instance.splitConnection(this, (IFluidPipe) this.getConnectedBlocks()[side.ordinal()]);
}
}
this.connectedBlocks[side.ordinal()] = null;
this.visuallyConnected[side.ordinal()] = false;
}
}
/**
* checks to see if this pipe can connect to the tileEntity
*/
public boolean canConnect(TileEntity tileEntity, ForgeDirection opposite)
{
if (tileEntity instanceof IPsiMachine && ((IPsiMachine) tileEntity).getMaxPressure(opposite) <= this.getMaxPressure(opposite))
{
return true;
}
else if (tileEntity instanceof IPsiCreator && ((IPsiCreator) tileEntity).getCanPressureTo(getLiquidData(), opposite))
{
return true;
}
else if (tileEntity instanceof ITankContainer)
{
ITankContainer tank = (ITankContainer) tileEntity;
return tank.getTank(opposite, getLiquidData().getStack()) != null || getLiquidData() == LiquidHandler.unkown;
}
else if (tileEntity instanceof IFluidPipe)
{
return true;
}
return false;
}
/**
* gets the sample stack to use for pipe connection checks
*
* @return
*/
public LiquidData getLiquidData()
{
return LiquidHandler.unkown;
}
@Override
public void updateConnectionWithoutSplit(TileEntity tileEntity, ForgeDirection side)
{
if (!this.worldObj.isRemote)
{
if (tileEntity != null)
{
if (this.canConnect(tileEntity, side.getOpposite()))
{
this.connectedBlocks[side.ordinal()] = tileEntity;
this.visuallyConnected[side.ordinal()] = true;
if (tileEntity.getClass() == this.getClass())
{
HydraulicNetworkManager.instance.mergeConnection(this.getNetwork(), ((IFluidPipe) tileEntity).getNetwork());
}
return;
}
}
this.connectedBlocks[side.ordinal()] = null;
this.visuallyConnected[side.ordinal()] = false;
}
}
@Override
public void initiate()
{
this.refreshConnectedBlocks();
}
@Override
public void updateEntity()
{
super.updateEntity();
if (this.ticks % 300 == 0)
{
this.refreshConnectedBlocks();
}
}
@Override
public void reset()
{
this.network = null;
if (HydraulicNetworkManager.instance != null)
{
HydraulicNetworkManager.instance.registerConductor(this);
}
}
@Override
public void refreshConnectedBlocks()
{
if (this.worldObj != null)
{
if (!this.worldObj.isRemote)
{
boolean[] previousConnections = this.visuallyConnected.clone();
for (byte i = 0; i < 6; i++)
{
this.updateConnection(Vector3.getConnectorFromSide(this.worldObj, new Vector3(this), ForgeDirection.getOrientation(i)), ForgeDirection.getOrientation(i));
}
/**
* Only send packet updates if visuallyConnected changed.
*/
if (!Arrays.areEqual(previousConnections, this.visuallyConnected))
{
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
}
}
@Override
public Packet getDescriptionPacket()
{
return PacketManager.getPacket(this.channel, this, this.visuallyConnected[0], this.visuallyConnected[1], this.visuallyConnected[2], this.visuallyConnected[3], this.visuallyConnected[4], this.visuallyConnected[5]);
}
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
return INFINITE_EXTENT_AABB;
}
}

View file

@ -0,0 +1,36 @@
# Basic Components Language Properties
# @author Calclavia
# @translator TheVanoq
# Blocks
tile.bcOre.0.name=Kupfererz
tile.bcOre.1.name=Zinnerz
tile.oilMoving.name=Öl
tile.oilStill.name=Öl
tile.copperWire.name=Kupferkabel
tile.bcMachine.0.name=Kohle Generator
tile.bcMachine.1.name=Batteriekasten
tile.bcMachine.2.name=Elektro-Ofen
# Items
item.battery.name=Batterie
item.circuit.name=Schaltkreis
item.circuit.0.name=Einfacher Schaltkreis
item.circuit.1.name=Erweiterter Schaltkreis
item.circuit.2.name=Elite Schaltkreis
item.bucketOil.name=Eimer mit Öl
item.wrench.name=Schraubenschlüssel
item.motor.name=Motor
item.plateCopper.name=Kupferplatte
item.plateTin.name=Zinnplatte
item.plateBronze.name=Bronzeplatte
item.plateSteel.name=Stahlplatte
item.ingotCopper.name=Kupferbarren
item.ingotTin.name=Zinnbarren
item.ingotBronze.name=Bronzebarren
item.ingotSteel.name=Stahlbarren
item.dustBronze.name=Bronzestaub
item.dustSteel.name=Stahlstaub

View file

@ -0,0 +1,36 @@
# Basic Components Language Properties
# @author Calclavia
itemGroup.BasicComponents=Basic Components
# Blocks
tile.bcOre.0.name=Copper Ore
tile.bcOre.1.name=Tin Ore
tile.copperWire.name=Copper Wire
tile.bcMachine.0.name=Coal Generator
tile.bcMachine.1.name=Battery Box
tile.bcMachine.2.name=Electric Furnace
# Items
item.battery.name=Battery
item.infiniteBattery.name=Infinite Battery
item.circuitBasic.name=Basic Circuit
item.circuitAdvanced.name=Advanced Circuit
item.circuitElite.name=Elite Circuit
item.wrench.name=Wrench
item.motor.name=Motor
item.plateCopper.name=Copper Plate
item.plateTin.name=Tin Plate
item.plateBronze.name=Bronze Plate
item.plateSteel.name=Steel Plate
item.plateIron.name=Iron Plate
item.plateGold.name=Gold Plate
item.ingotCopper.name=Copper Ingot
item.ingotTin.name=Tin Ingot
item.ingotBronze.name=Bronze Ingot
item.ingotSteel.name=Steel Ingot
item.dustBronze.name=Bronze Dust
item.dustSteel.name=Steel Dust

View file

@ -0,0 +1,37 @@
# Basic Components Language Properties
# @author francogp
children=es_AR,es_MX,es_UY,es_VE
# Blocks
tile.bcOre.0.name=Mineral de Cobre
tile.bcOre.1.name=Mineral de Esta\u00F1o
tile.oilMoving.name=Petr\u00F3leo
tile.oilStill.name=Petr\u00F3leo
tile.copperWire.name=Cable de Cobre
tile.bcMachine.0.name=Generador a Carb\u00F3n
tile.bcMachine.1.name=Caja de Bater\u00EDa
tile.bcMachine.2.name=Horno El\u00E9ctrico
# Items
item.battery.name=Bater\u00EDa
item.circuit.name=Circuito
item.circuit.0.name=Circuito B\u00E1sico
item.circuit.1.name=Circuito Avanzado
item.circuit.2.name=Circuito \u00E9lite
item.bucketOil.name=Balde de Petr\u00F3leo
item.wrench.name=Llave Inglesa
item.motor.name=Motor
item.plateCopper.name=Placa de Cobre
item.plateTin.name=Placa de Esta\u00F1o
item.plateBronze.name=Placa de Bronce
item.plateSteel.name=Placa de Acero
item.ingotCopper.name=Lingote de Cobre
item.ingotTin.name=Lingote de Esta\u00F1o
item.ingotBronze.name=Lingote de Bronce
item.ingotSteel.name=Lingote de Acero
item.dustBronze.name=Polvo de Bronce
item.dustSteel.name=Polvo de Acero

View file

@ -0,0 +1,35 @@
# Basic Components Language Properties
# @author Calclavia
# Blocks
tile.bcOre.0.name=Minerale Di Rame
tile.bcOre.1.name=Minerale Di Stagno
tile.oilMoving.name=Petrolio
tile.oilStill.name=Petrolio
tile.copperWire.name=Cavo Di Rame
tile.bcMachine.0.name=Generatore A Carbone
tile.bcMachine.1.name=Scatola Batteria
tile.bcMachine.2.name=Fornace Elettrica
# Items
item.battery.name=Batteria
item.circuit.name=Circuito
item.circuit.0.name=Circuito Base
item.circuit.1.name=Circuito Avanzato
item.circuit.2.name=Circuito Elite
item.bucketOil.name=Secchio Di Petrolio
item.wrench.name=Chiave Inglese
item.motor.name=Motore
item.plateCopper.name=Piastra Di Rame
item.plateTin.name=Piastra Di Stagno
item.plateBronze.name=Piastra Di Bronzo
item.plateSteel.name=Piastra D'Acciaio
item.ingotCopper.name=Lingotto Di Rame
item.ingotTin.name=Lingotto Di Stagno
item.ingotBronze.name=Lingotto Di Bronzo
item.ingotSteel.name=Lingotto D'Acciaio
item.dustBronze.name=Polvere Di Bronzo
item.dustSteel.name=Polvere D'Acciaio

View file

@ -0,0 +1,35 @@
# Basic Components Language Properties
# @author Kees Nijenhuis
# Blocks
tile.bcOre.0.name=Koper Erts
tile.bcOre.1.name=Tin Erts
tile.oilMoving.name=Olie
tile.oilStill.name=Olie
tile.copperWire.name=Koper Draad
tile.bcMachine.0.name=Kool Generator
tile.bcMachine.1.name=Batterijen Doos
tile.bcMachine.2.name=Elektrische Oven
# Items
item.battery.name=Batterij
item.circuit.name=Stroomkring
item.circuit.0.name=Basis Stroomkring
item.circuit.1.name=Geavanceerde Stroomkring
item.circuit.2.name=Elite Stroomkring
item.bucketOil.name=Emmer Olie
item.wrench.name=Moersleutel
item.motor.name=Moter
item.plateCopper.name=Koperen Plaat
item.plateTin.name=Tinnen Plaat
item.plateBronze.name=Bronzen Plaat
item.plateSteel.name=Stalen Plaat
item.ingotCopper.name=Koper Staaf
item.ingotTin.name=Tin Staaf
item.ingotBronze.name=Brons Staaf
item.ingotSteel.name=Staal Staaf
item.dustBronze.name=Brons Poeder
item.dustSteel.name=Staal Poede

View file

@ -0,0 +1,35 @@
# Basic Components Language Properties
# @author unekpl
# Bloki
tile.bcOre.0.name=Ruda miedzi
tile.bcOre.1.name=Ruda cyny
tile.oilMoving.name=Ropa naftowa
tile.oilStill.name=Ropa naftowa
tile.copperWire.name=Miedziany kabel
tile.bcMachine.0.name=Generator cieplny
tile.bcMachine.1.name=Akumulator
tile.bcMachine.2.name=Piec elektryczny
# Przedmioty
item.battery.name=Ogniwo
item.circuit.name=Obw\u00F3d elektroniczny
item.circuit.0.name=Prosty obw\u00F3d elektroniczny
item.circuit.1.name=Zaawansowany obw\u00F3d elektroniczny
item.circuit.2.name=Skomplikowany obw\u00F3d elektroniczny
item.bucketOil.name=Wiadro ropy
item.wrench.name=Klucz
item.motor.name=Silnik
item.plateCopper.name=Miedziana p\u0142ytka
item.plateTin.name=Cynowa p\u0142ytka
item.plateBronze.name=Br\u0105zowa p\u0142ytka
item.plateSteel.name=Stalowa p\u0142ytka
item.ingotCopper.name=Sztabka miedzi
item.ingotTin.name=Sztabka cyny
item.ingotBronze.name=Sztabka br\u0105zu
item.ingotSteel.name=Sztabka stali
item.dustBronze.name=Py\u0142 br\u0105zu
item.dustSteel.name=Py\u0142 stali

View file

@ -0,0 +1,37 @@
#Basic Components Language Properties
#@author Calclavia
children=zh_TW
# Blocks
tile.bcOre.0.name=\u94dc\u77ff\u77f3
tile.bcOre.1.name=\u9521\u77ff\u77f3
tile.oilMoving.name=\u77f3\u6cb9
tile.oilStill.name=\u77f3\u6cb9
tile.copperWire.name=\u94dc\u7ebf
tile.bcMachine.0.name=\u71c3\u7164\u53d1\u7535\u673a
tile.bcMachine.1.name=\u7535\u6c60\u76d2
tile.bcMachine.2.name=\u7535\u529b\u7194\u7089
# Items
item.battery.name=\u7535\u6c60
item.circuit.name=\u7535\u5b50\u677f
item.circuit.0.name=\u7535\u5b50\u677f (\u4e00\u7ea7)
item.circuit.1.name=\u7535\u5b50\u677f (\u4e8c\u7ea7)
item.circuit.2.name=\u7535\u5b50\u677f (\u4e09\u7ea7)
item.bucketOil.name=\u77f3\u6cb9\u6876
item.wrench.name=\u6273\u624b
item.motor.name=\u9a6c\u8fbe
item.plateCopper.name=\u94dc\u677f
item.plateTin.name=\u9521\u677f
item.plateBronze.name=\u9752\u94dc\u677f
item.plateSteel.name=\u94a2\u677f
item.ingotCopper.name=\u94dc\u952d
item.ingotTin.name=\u9521\u952d
item.ingotBronze.name=\u9752\u94dc\u952d
item.ingotSteel.name=\u94a2\u952d
item.dustBronze.name=\u9752\u94dc\u7c89
item.dustSteel.name=\u94a2\u7c89

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B