moved over from other repo

got around to moving this so Calc could help me with the clean up of it.
So far i havn't changed much but will soon. The main focus for the next
week on the mod will be just cleanup and bug fixing. I will also be
moving the motor from steam power to here. The mod has alos been renamed
since now it contains more than just pipes.
This commit is contained in:
Rseifert 2012-11-14 13:16:22 -05:00
commit 28f62284a0
61 changed files with 4350 additions and 0 deletions

22
.gitattributes vendored Normal file
View file

@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

163
.gitignore vendored Normal file
View file

@ -0,0 +1,163 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store

View file

@ -0,0 +1,33 @@
package dark.BasicUtilities;
import cpw.mods.fml.client.registry.ClientRegistry;
import dark.BasicUtilities.machines.TileEntityPump;
import dark.BasicUtilities.mechanical.TileEntityRod;
import dark.BasicUtilities.pipes.TileEntityPipe;
import dark.BasicUtilities.renders.RenderGearRod;
import dark.BasicUtilities.renders.RenderLTank;
import dark.BasicUtilities.renders.RenderPipe;
import dark.BasicUtilities.renders.RenderPump;
import dark.BasicUtilities.tanks.TileEntityLTank;
public class BPClientProxy extends BPCommonProxy
{
@Override
public void preInit()
{
}
@Override
public void Init()
{
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPipe.class, new RenderPipe());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPump.class, new RenderPump());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRod.class, new RenderGearRod());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLTank.class, new RenderLTank());
}
@Override
public void postInit()
{
}
}

View file

@ -0,0 +1,37 @@
package dark.BasicUtilities;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class BPCommonProxy implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
// TODO Auto-generated method stub
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
// TODO Auto-generated method stub
return null;
}
public void preInit()
{
}
public void Init()
{
}
public void postInit()
{
}
}

View file

@ -0,0 +1,243 @@
package dark.BasicUtilities;
import java.io.File;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.Configuration;
import universalelectricity.core.UEConfig;
import universalelectricity.prefab.network.PacketManager;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
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 cpw.mods.fml.common.registry.LanguageRegistry;
import dark.BasicUtilities.ItemParts.basicParts;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.machines.BlockMachine;
import dark.BasicUtilities.machines.BlockValve;
import dark.BasicUtilities.machines.ItemMachine;
import dark.BasicUtilities.machines.TileEntityPump;
import dark.BasicUtilities.mechanical.BlockRod;
import dark.BasicUtilities.mechanical.TileEntityRod;
import dark.BasicUtilities.pipes.BlockPipe;
import dark.BasicUtilities.pipes.ItemPipe;
import dark.BasicUtilities.pipes.TileEntityPipe;
import dark.BasicUtilities.tanks.ItemTank;
import dark.BasicUtilities.tanks.TileEntityLTank;
/**
* Used in the creation of a new mod class
*
* @author Rseifert
*
*/
@Mod(modid = BasicUtilitiesMain.NAME, name = BasicUtilitiesMain.NAME, version = BasicUtilitiesMain.VERSION, dependencies = "after:BasicComponents")
@NetworkMod(channels =
{ BasicUtilitiesMain.CHANNEL }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
public class BasicUtilitiesMain extends DummyModContainer
{
// TODO need changed on release
public static final String VERSION = "0.2.0";
// Constants
public static final String NAME = "BasicUtilities";
public static final String CHANNEL = "BPipes";
public static final String textureFile = "/dark/BasicUtilities/textures/";
public static final String BlOCK_PNG = "";
public static final String ITEM_PNG = "/dark/generaltextures/Items.png";
public static final Configuration CONFIGURATION = new Configuration(
new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
// Block and Item vars
public final static int BLOCK_ID_PREFIX = 2056;
public final static int ITEM_ID_PREFIX = 10056;
public static Block pipe = new BlockPipe(UEConfig.getBlockConfigID(
CONFIGURATION, "block Pipe", BLOCK_ID_PREFIX)).setBlockName("pipe");
public static Block machine = new BlockMachine(UEConfig.getBlockConfigID(
CONFIGURATION, "machine set", BLOCK_ID_PREFIX))
.setBlockName("pump");
public static Block valve = new BlockValve(UEConfig.getBlockConfigID(
CONFIGURATION, "valve", BLOCK_ID_PREFIX + 2)).setBlockName("valve");
public static Block rod = new BlockRod(UEConfig.getBlockConfigID(
CONFIGURATION, "mechanical rod", BLOCK_ID_PREFIX + 3));
public static Item parts = new ItemParts(UEConfig.getItemConfigID(
CONFIGURATION, "parts", ITEM_ID_PREFIX));
public static Item itemPipes = new ItemPipe(UEConfig.getItemConfigID(
CONFIGURATION, "item Pipe", ITEM_ID_PREFIX + 1));
public static Item itemTank = new ItemTank(UEConfig.getItemConfigID(
CONFIGURATION, "item tank", ITEM_ID_PREFIX + 2));
public static Item gauge = new ItemGuage(UEConfig.getItemConfigID(
CONFIGURATION, "guage", ITEM_ID_PREFIX + 3));
// mod stuff
@SidedProxy(clientSide = "dark.BasicUtilities.BPClientProxy", serverSide = "dark.BasicUtilities.BPCommonProxy")
public static BPCommonProxy proxy;
public static BasicUtilitiesMain instance;
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
instance = this;
proxy.preInit();
GameRegistry.registerBlock(pipe);
GameRegistry.registerBlock(rod);
GameRegistry.registerBlock(machine, ItemMachine.class);
}
@Init
public void Init(FMLInitializationEvent event)
{
proxy.Init();
// register
GameRegistry.registerTileEntity(TileEntityPipe.class, "pipe");
GameRegistry.registerTileEntity(TileEntityPump.class, "pump");
GameRegistry.registerTileEntity(TileEntityRod.class, "rod");
GameRegistry.registerTileEntity(TileEntityLTank.class, "ltank");
// Names and lang stuff
// Pipe Names
for (int i = 0; i < Liquid.values().length; i++)
{
LanguageRegistry.addName((new ItemStack(itemPipes, 1, i)),
Liquid.getLiquid(i).lName + " Pipe");
}
// liquid tank names
for (int i = 0; i < Liquid.values().length; i++)
{
LanguageRegistry.addName((new ItemStack(itemTank, 1, i)),
Liquid.getLiquid(i).lName + " Tank");
}
for (int i = 0; i < ItemParts.basicParts.values().length; i++)
{
LanguageRegistry.addName((new ItemStack(parts, 1, i)),
ItemParts.basicParts.values()[i].name);
}
// machines
LanguageRegistry.addName((new ItemStack(machine, 1, 0)), "WaterPump");
LanguageRegistry.addName((new ItemStack(machine, 1, 4)),
"WaterCondensor");
// mechanical rod
LanguageRegistry.addName((new ItemStack(rod, 1)), "MechRod");
// Tools
LanguageRegistry.addName((new ItemStack(gauge, 1, 0)), "PipeGuage");
}
@PostInit
public void PostInit(FMLPostInitializationEvent event)
{
proxy.postInit();
GameRegistry.addRecipe(new ItemStack(this.gauge, 1, 0), new Object[]
{
"TVT", " T ", 'V', new ItemStack(parts, 1, 7), 'T',
new ItemStack(parts, 1, 1) });
// iron tube
GameRegistry.addRecipe(new ItemStack(parts, 2, 1), new Object[]
{
"@@@", '@', Item.ingotIron });
// obby tube
GameRegistry.addRecipe(new ItemStack(parts, 2, 2), new Object[]
{
"@@@", '@', Block.obsidian });
// nether tube
GameRegistry
.addRecipe(new ItemStack(parts, 2, 3),
new Object[]
{ "N@N", 'N', Block.netherrack, '@',
new ItemStack(parts, 2, 2) });
// seal
GameRegistry.addRecipe(new ItemStack(parts, 2, 4), new Object[]
{ "@@",
"@@", '@', Item.leather });
// slime steal
GameRegistry.addShapelessRecipe(new ItemStack(parts, 1, 5),
new Object[]
{ new ItemStack(parts, 1, 4),
new ItemStack(Item.slimeBall, 1) });// stick seal
// crafting pipes
// {"black", "red", "green", "brown", "blue", "purple", "cyan",
// "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta",
// "orange", "white"};
GameRegistry.addRecipe(new ItemStack(rod, 1), new Object[]
{ "I@I",
'I', Item.ingotIron, '@', new ItemStack(parts, 1, 1) });
// water
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, 1),
new Object[]
{ new ItemStack(parts, 1, 1),
new ItemStack(parts, 1, 4),
new ItemStack(Item.dyePowder, 1, 4) });
// lava TODO change to use obby pipe and nether items
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, 2),
new Object[]
{ new ItemStack(parts, 1, 2),
new ItemStack(Item.dyePowder, 1, 1) });
// oil
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, 3),
new Object[]
{ new ItemStack(parts, 1, 1),
new ItemStack(parts, 1, 4),
new ItemStack(Item.dyePowder, 1, 0) });
// fuel
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, 4),
new Object[]
{ new ItemStack(parts, 1, 1),
new ItemStack(parts, 1, 4),
new ItemStack(Item.dyePowder, 1, 11) });
GameRegistry.addRecipe(new ItemStack(parts, 1, 7), new Object[]
{
"T@T", 'T', new ItemStack(parts, 1, 1), '@', Block.lever });// valve
GameRegistry.addRecipe(new ItemStack(parts, 1, 6), new Object[]
{
" @ ", "@ @", " @ ", '@', Item.ingotIron });// tank
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, 0),
new Object[]
{ new ItemStack(parts, 1, 6),
new ItemStack(parts, 1, 4),
new ItemStack(Item.dyePowder, 1, 15) });
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, 1),
new Object[]
{ new ItemStack(parts, 1, 6),
new ItemStack(parts, 1, 4),
new ItemStack(Item.dyePowder, 1, 4) });
// lava TODO change to use obby pipe and nether items
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, 2),
new Object[]
{ new ItemStack(parts, 1, 6), Block.obsidian,
Block.obsidian, Block.obsidian, Block.obsidian });
// oil
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, 3),
new Object[]
{ new ItemStack(parts, 1, 6),
new ItemStack(parts, 1, 4),
new ItemStack(Item.dyePowder, 1, 0) });
// fuel
GameRegistry.addShapelessRecipe(
new ItemStack(itemTank, 1, Liquid.Fuel.ordinal()),
new Object[]
{
new ItemStack(parts, 1, basicParts.Tank.ordinal()),
new ItemStack(parts, 1, 4),
new ItemStack(Item.dyePowder, 1, 11) });
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, 0),
new Object[]
{ new ItemStack(parts, 1, 1),
new ItemStack(parts, 1, 4) });
GameRegistry.addRecipe(new ItemStack(machine, 1, 0), new Object[]
{
"@T@", "BPB", "@P@", '@', new ItemStack(Item.ingotIron, 2),
'B', new ItemStack(parts, 1, 7), 'P',
new ItemStack(Block.pistonBase), 'T',
new ItemStack(parts, 1, 6) });
}
}

View file

@ -0,0 +1,114 @@
package dark.BasicUtilities;
import java.util.List;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import dark.BasicUtilities.api.IMechanical;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.pipes.TileEntityPipe;
import dark.BasicUtilities.tanks.TileEntityLTank;
public class ItemGuage extends Item
{
private int spawnID;
public ItemGuage(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("guage");
this.setCreativeTab(CreativeTabs.tabTools);
this.setMaxStackSize(1);
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(this, 1, 0));
}
@Override
public int getIconFromDamage(int par1)
{
switch(par1)
{
case 0: return 24;
}
return this.iconIndex;
}
public String getTextureFile() {
return BasicUtilitiesMain.ITEM_PNG;
}
@Override
public String getItemName()
{
return "guage";
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if(!par3World.isRemote)
{
if(itemStack.getItemDamage() == 0)
{
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
if(blockEntity instanceof TileEntityPipe)
{
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
Liquid type = pipeEntity.getType();
int steam = pipeEntity.getStoredLiquid(type);
int pressure = pipeEntity.presure;
String typeName = type.lName;
String print = "Error";
print = typeName +" " + steam +" @ "+pressure+"PSI";
player.sendChatToPlayer(print);
return true;
}
if(blockEntity instanceof TileEntityLTank)
{
TileEntityLTank pipeEntity = (TileEntityLTank) blockEntity;
Liquid type = pipeEntity.getType();
int steam = pipeEntity.getStoredLiquid(type);
String typeName = type.lName;
String print = "Error";
print = typeName +" " + steam;
player.sendChatToPlayer(print);
return true;
}
if(blockEntity instanceof IMechanical)
{
IMechanical rod = (IMechanical) blockEntity;
int steam = rod.getForce();
int pressure = rod.getAnimationPos();
String print = "Error";
print = " " + steam +"N "+pressure*45+"degrees";
player.sendChatToPlayer(print);
return true;
}
}
}
return false;
}
public String getItemNameIS(ItemStack par1ItemStack)
{
int var3 = par1ItemStack.getItemDamage();
switch(var3)
{
case 0: return "PipeGuage";
}
return this.getItemName();
}
}

View file

@ -0,0 +1,69 @@
package dark.BasicUtilities;
import java.util.List;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
public class ItemParts extends Item
{
public enum basicParts
{
Bronze("Bronze Tube", 0), Iron("Iron Tube", 1), Obby("Obby Tube", 2),
Nether("Nether Tube", 3), Seal("Seal", 16), SlimeSeal("Slime Seal", 17),
Tank("unfinished Tank", 18), Valve("Valve", 19);
public String name;
public int itemIndex;
private basicParts(String name, int itemIndex)
{
this.name = name;
this.itemIndex = itemIndex;
}
}
public ItemParts(int par1)
{
super(par1);
this.setItemName("Parts");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
this.setCreativeTab(CreativeTabs.tabMaterials);
}
@Override
public int getIconFromDamage(int par1)
{
if (par1 < basicParts.values().length) { return basicParts.values()[par1].itemIndex; }
return par1;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
if (itemstack.getItemDamage() < basicParts.values().length) { return basicParts.values()[itemstack.getItemDamage()].name; }
return "unkown";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < basicParts.values().length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
public String getTextureFile()
{
return BasicUtilitiesMain.ITEM_PNG;
}
@Override
public String getItemName()
{
return "parts";
}
}

View file

@ -0,0 +1,57 @@
package dark.BasicUtilities;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.RenderBlocks;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import dark.BasicUtilities.renders.ModelGearRod;
import dark.BasicUtilities.renders.ModelPump;
public class ItemRenderHelper implements ISimpleBlockRenderingHandler {
public static ItemRenderHelper instance = new ItemRenderHelper();
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
private ModelPump modelPump = new ModelPump();
private ModelGearRod modelRod = new ModelGearRod();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if(block.blockID == BasicUtilitiesMain.machine.blockID && metadata < 4)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.0F, (float)1.1F, (float)0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture("/textures/pumps/Pump.png"));
modelPump.renderMain(0.0725F);
modelPump.renderC1(0.0725F);
modelPump.renderC2(0.0725F);
modelPump.renderC3(0.0725F);
GL11.glPopMatrix();
}
if(block.blockID == BasicUtilitiesMain.rod.blockID)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.0F, (float)1.5F, (float)0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture("/textures/GearRod.png"));
modelRod.render(0.0825F,0);
GL11.glPopMatrix();
}
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public boolean shouldRender3DInInventory() {
return true;
}
public int getRenderId()
{
return renderID;
}
}

View file

@ -0,0 +1,26 @@
package dark.BasicUtilities.api;
import net.minecraftforge.common.ForgeDirection;
public class Beam {
//might need a more complex system for this later but for now this will work
public int intensity; //Beam intensity level
public boolean light; //Can prodcue light, might use this later
public ForgeDirection movDir; //Used to find the beams current direction
public Beam()
{
this(0,false,ForgeDirection.UNKNOWN);
}
Beam(int i, boolean light, ForgeDirection dir)
{
intensity = i;
this.light = light;
movDir = dir;
}
public static int getBeamLevel(Beam beam)
{
return beam.intensity;
}
}

View file

@ -0,0 +1,26 @@
package dark.BasicUtilities.api;
import net.minecraftforge.common.ForgeDirection;
public interface IBeamProducer {
/**
* onProduceLiquid
* block.
* @param type - the type of liquid
* @param regInt - requested beam intensity
* @param side - The side
* @return New Beam - Return a vol of liquid type that is produced
*/
public int createNewBeam(int type, int reqInt, ForgeDirection side);
/**
* canProduceLiquid
* block.
* @param type - the type of liquid
* @param side - The side
* @return boolean - True if can, false if can't produce liquid of type or on that side
* Also used for connection rules of pipes'
*/
public boolean canCreateBeam(int type, ForgeDirection side);
}

View file

@ -0,0 +1,16 @@
package dark.BasicUtilities.api;
import net.minecraftforge.common.ForgeDirection;
public interface IHeatProducer
{
/**
* onProduceElectricity is called when a conductor is connected to the producer block in which the conductor will demand power from the producer
* block.
* @param jouls - The maximum jouls can be transfered
* @param up - The side of block in which the conductor is on
* @return jouls - Return jouls to consumer
*/
public float onProduceHeat(float jouls, ForgeDirection up);
}

View file

@ -0,0 +1,39 @@
package dark.BasicUtilities.api;
import net.minecraftforge.common.ForgeDirection;
/**
* Based off of Calclavia's old wire API
* @author DarkGuardsman
*
*/
public interface ILiquidConsumer
{
/**
* onRecieveLiquid
* @param vol - The amount this block received.
* @param side - The side of the block in which the liquid came from.
* @parm type - The type of liquid being received
* @return vol - The amount liquid that can't be recieved
*/
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side);
/**
* You can use this to check if a pipe can connect to this liquid consumer to properly render the graphics
* @param forgeDirection - The side in which the volume is coming from.
* @parm type - The type of liquid
* @return Returns true or false if this consumer can receive a volume at this given tick or moment.
*/
public boolean canRecieveLiquid(Liquid type, ForgeDirection forgeDirection);
/**
* @return Return the stored liquid of type in this consumer.
*/
public int getStoredLiquid(Liquid type);
/**
* @return Return the maximum amount of stored liquid this consumer can get.
*/
public int getLiquidCapacity(Liquid type);
}

View file

@ -0,0 +1,38 @@
package dark.BasicUtilities.api;
import net.minecraftforge.common.ForgeDirection;
/**
* Based off of Calclavia's old wire API
* @author DarkGuardsman
*
*/
public interface ILiquidProducer
{
/**
* onProduceLiquid
* block.
* @param type - the type of liquid
* @param maxvol - The maximum vol or requested volume
* @param side - The side
* @return vol - Return a vol of liquid type that is produced
*/
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side);
/**
* canProduceLiquid
* block.
* @param type - the type of liquid
* @param side - The side
* @return boolean - True if can, false if can't produce liquid of type or on that side
* Also used for connection rules of pipes'
*/
public boolean canProduceLiquid(Liquid type, ForgeDirection side);
public boolean canProducePresure(Liquid type, ForgeDirection side);
/**
*
* @param type - liquid type
* @param side - side this of presure
* @return pressure that is used to output liquid on
*/
public int presureOutput(Liquid type, ForgeDirection side);
}

View file

@ -0,0 +1,36 @@
package dark.BasicUtilities.api;
import net.minecraftforge.common.ForgeDirection;
// mechanical
public interface IMechanical {
/**
*
* @param side the rpm is coming from
* @return rpm that the block is running at
*/
public int getForceSide(ForgeDirection side);
public int getForce();
/**
*
* @param side
* @return if mechanical force can be outputed from this side
*/
public boolean canOutputSide(ForgeDirection side);
/**
*
* @param side
* @return if mechanical force can be inputed from this side
*/
public boolean canInputSide(ForgeDirection side);
/**
*
* @param RPM being applied to this machine
* @return the rpm after the load has been applied
*/
public int applyForce(int force);
/**
* not required but is handy to get animation position of some mechanical block
* @return int between 0 -7
*/
public int getAnimationPos();
}

View file

@ -0,0 +1,5 @@
package dark.BasicUtilities.api;
public interface IStorageTank extends ILiquidConsumer {
}

View file

@ -0,0 +1,64 @@
package dark.BasicUtilities.api;
import net.minecraft.src.Block;
/**
* System too easily reference a liquid type and its info
* @author Rseifert
*
*/
public enum Liquid {
// -1 == null || unused
STEAM("Steam",false,true,-1,-1,100),
WATER("Water",false,false,Block.waterStill.blockID,Block.waterMoving.blockID,32),
LAVA("Lava",false,false,Block.lavaStill.blockID,Block.lavaMoving.blockID,20),
OIL("Oil",true,false,-1,-1,32),//BasicComponents.oilStill.blockID,BasicComponents.oilMoving.blockID),
Fuel("Fuel",true,false,-1,-1,40),
Air("Air",false,true,0,-1,100),
Methain("Methain",true,true,-1,-1,100),
BioFuel("BioFuel",true,false,-1,-1,40),
Coolent("Coolent",false,false,-1,-1,40),
NukeWaste("NukeWaste",false,false,-1,-1,20),
Ether("Ether",false,false,-1,-1,100),
DEFUALT("Empty",false,false,-1,-1,0);
public final boolean flamable;//can it catch on fire, not used but might be
public final boolean isGas;//is it a gas, used to find if it floats
public final int Still;//if there is a block of still liquid linked to this
public final int Moving;//if there is a block of moving liquid linked to this
public final String lName;//Default name for the liquid
public final int defaultPresure;//default pressure output of the liquid
private Liquid(String name,boolean flame,boolean gas,int block, int Moving,int dPressure)
{
this.flamable = flame;
this.isGas = gas;
this.Still = block;
this.Moving = Moving;
this.lName = name;
this.defaultPresure = dPressure;
}
/**
* Only use this if you are converting from the old system
* Or have a special need for it
* @param id of liquid
* @return Liquid Object
*/
public static Liquid getLiquid(int id)
{
if (id >= 0 && id < Liquid.values().length)
{
return Liquid.values()[id];
}
return DEFUALT;
}
public static Liquid getLiquidByBlock(int bBlock) {
for(int i = 0; i < Liquid.values().length;i++)
{
Liquid selected = Liquid.getLiquid(i);
if(bBlock == selected.Still)
{
return selected;
}
}
return Liquid.DEFUALT;
}
}

View file

@ -0,0 +1,125 @@
package dark.BasicUtilities.api;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import net.minecraftforge.common.ForgeDirection;
public class MHelper {
/**
* you will have to tell your TileEntity to trade up if liquid or down if gas. I suggest having your onRecieveLiquid
* pump liquid one block up if you block is full.
* @param entity - entity at center of search
* @return an Array containing TileEntities around the TileEntity
*/
public static TileEntity[] getSourounding(World world, int x, int y, int z)
{
TileEntity[] list = new TileEntity[]{null,null,null,null,null,null};
for(int i =0; i< 6;i++)
{
ForgeDirection d = ForgeDirection.getOrientation(i);
TileEntity aEntity = world.getBlockTileEntity(x+d.offsetX, y+d.offsetY, z+d.offsetZ);
if(aEntity instanceof TileEntity)
{
list[i] = aEntity;
}
}
return list;
}
/**
* Used to help trade liquid without having to do too much work
* @param blockEntity - tile entity trading the liquid
* @param type - liquid type being traded
* @param vol - the volume to be traded
* @return the remaining untraded liquid
*/
public static int shareLiquid(World world, int x, int y, int z,int vol,int max, Liquid type)
{
TileEntity ent = world.getBlockTileEntity(x, y, z);
int currentVol = vol;
int tCount = 1;
boolean rise = type.isGas;
if(currentVol <= 0)
{
return 0;
}
ForgeDirection st = ForgeDirection.getOrientation(rise ? 1 : 0);
TileEntity first = world.getBlockTileEntity(x+st.offsetX, y+st.offsetY, z+st.offsetZ);
//trades to the first, bottom for liquid, top for gas
if(first instanceof IStorageTank && currentVol > 0 && ((IStorageTank) first).getStoredLiquid(type) < ((IStorageTank) first).getLiquidCapacity(type))
{
currentVol = ((ILiquidConsumer) first).onReceiveLiquid(type, currentVol, st);
}
int vAve = currentVol;
TileEntity[] TeA = MHelper.getSourounding(world,x,y,z);
for(int i = 2; i < 6; i++)
{
if(TeA[i] instanceof IStorageTank)
{
vAve += ((IStorageTank)TeA[i]).getStoredLiquid(type);
tCount++;
}
}
vAve = (int)(vAve/tCount);
//trades to side if anything is left
for(int i = 2; i < 6;i++)
{
ForgeDirection side = ForgeDirection.getOrientation(i);
TileEntity sSide = world.getBlockTileEntity(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
if(currentVol <= 0 || currentVol <= vAve)
{
break;
}
if(sSide instanceof IStorageTank &&((IStorageTank) sSide).getStoredLiquid(type) < vAve)
{
int tA = vAve -Math.max((vAve - currentVol), 0);
currentVol = ((ILiquidConsumer) sSide).onReceiveLiquid(type, tA, st) -tA + currentVol;
}
}
//trades to the opposite of the first if anything is left
/**
* need to find a way to solve it just trading back the ammount on next cycle
if(currentVol > 0)
{
TileEntity last = world.getBlockTileEntity(x+st.getOpposite().offsetX, y+st.getOpposite().offsetY, z+st.getOpposite().offsetZ);
if(last instanceof IStorageTank && currentVol == max)
{
currentVol = ((ILiquidConsumer) last).onReceiveLiquid(type, max/10, st.getOpposite()) + currentVol -(max/10);
}
}
*/
return Math.max(currentVol,0);
}
/**
*
* @param entity - entity in question
* @return 1-4 if corner 0 if not a corner
* you have to figure out which is which depending on what your using this for
* 1 should be north east 2 south east
*/
public static int corner(TileEntity entity)
{
TileEntity[] en = getSourounding(entity.worldObj, entity.xCoord,entity.yCoord,entity.zCoord);
if(en[4] != null && en[2] != null && en[5] == null && en[3] == null)
{
return 3;
}
if(en[2] != null && en[5] != null && en[3] == null && en[4] == null)
{
return 4;
}
if(en[5] != null && en[3] != null && en[4] == null && en[2] == null)
{
return 1;
}
if(en[3] != null && en[4] != null && en[2] == null && en[5] == null)
{
return 2;
}
return 0;
}
}

View file

@ -0,0 +1,33 @@
package dark.BasicUtilities.creative;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
/**
* A block that can only be accessed from the
* creative menu used to both test the mod
* and other odd things
* @author Rseifert
*
*/
public class BlockCreative extends BlockContainer {
protected BlockCreative(int par1)
{
super(par1, Material.iron);
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return null;
}
@Override
public TileEntity createNewTileEntity(World var1, int meta)
{
return null;
}
}

View file

@ -0,0 +1,74 @@
package dark.BasicUtilities.machines;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import dark.BasicUtilities.ItemRenderHelper;
import dark.BasicUtilities.tanks.TileEntityLTank;
public class BlockMachine extends BlockContainer
{
public BlockMachine(int id)
{
super(id, Material.iron);
this.setBlockName("Machine");
this.setCreativeTab(CreativeTabs.tabBlock);
this.setRequiresSelfNotify();
this.blockIndexInTexture = 26;
this.setHardness(1f);
this.setResistance(3f);
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return ItemRenderHelper.renderID;
}
public int damageDropped(int meta)
{
if(meta < 4)
{
return 0;
}
return meta;
}
@Override
public TileEntity createNewTileEntity(World var1,int meta) {
// TODO Auto-generated method stub
if(meta < 4)
{
return new TileEntityPump();
}
if(meta == 4)
{
return new TileEntityCondenser();
}
if(meta == 5)
{
return new TileEntityLTank();
}
return null;
}
@Override
public TileEntity createNewTileEntity(World var1) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -0,0 +1,180 @@
package dark.BasicUtilities.machines;
import java.util.Random;
import dark.BasicUtilities.BasicUtilitiesMain;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
public class BlockValve extends universalelectricity.prefab.BlockMachine
{
public BlockValve(int id)
{
super("Valve", id, Material.iron);
this.setBlockName("Valve");
this.setCreativeTab(CreativeTabs.tabRedstone);
this.setRequiresSelfNotify();
this.blockIndexInTexture = 26;
}
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player)
{
TileEntity te = world.getBlockTileEntity(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if(te instanceof TileEntityValve)
{
TileEntityValve valve = (TileEntityValve) te;
if(meta < 8)
{
if(!valve.on){
valve.on = true;
}else{
valve.on = false;
}
}
}
return false;
}
//rotation valve around y axis
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer player)
{
int meta = world.getBlockMetadata(x, y, z);
if(meta < 4)
{
if(meta == 3)
{
world.setBlockMetadataWithNotify(x, y, z, 0);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, meta+1);
}
return true;
}
if(meta > 3 && meta < 8)
{
if(meta == 7)
{
world.setBlockMetadataWithNotify(x, y, z, 4);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, meta+1);
}
return true;
}
if(meta > 7 && meta < 12)
{
if(meta == 11)
{
world.setBlockMetadataWithNotify(x, y, z, 8);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, meta+1);
}
return true;
}
if(meta > 11 && meta < 16)
{
if(meta == 15)
{
world.setBlockMetadataWithNotify(x, y, z, 12);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, meta+1);
}
return true;
}
return false;
}
//one shift click inverts pipe to face up
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer player)
{
int meta = world.getBlockMetadata(x, y, z);
if(meta < 4)
{
world.setBlockMetadataWithNotify(x, y, z, meta+4);
return true;
}
if(meta > 3 && meta < 8)
{
world.setBlockMetadataWithNotify(x, y, z, meta-4);
return true;
}
if(meta > 7 && meta < 12)
{
world.setBlockMetadataWithNotify(x, y, z, meta+4);
return true;
}
if(meta > 11 && meta < 16)
{
world.setBlockMetadataWithNotify(x, y, z, meta-4);
return true;
}
return false;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return -1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return this.blockID;
}
public int damageDropped(int meta)
{
if(meta < 8)
{
return 0;
}
if(meta < 16 && meta > 7)
{
return 4;
}
return 0;
}
//Per tick
public int conductorCapacity()
{
return 1;
}
@Override
public TileEntity createNewTileEntity(World var1) {
// TODO Auto-generated method stub
return new TileEntityValve();
}
@Override
public String getTextureFile() {
return BasicUtilitiesMain.ITEM_PNG;
}
}

View file

@ -0,0 +1,125 @@
package dark.BasicUtilities.machines;
import java.util.List;
import dark.BasicUtilities.BasicUtilitiesMain;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemBlock;
import net.minecraft.src.ItemStack;
import net.minecraft.src.MathHelper;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
public class ItemMachine extends ItemBlock
{
int index = 26;
private int spawnID;
public ItemMachine(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("Machine");
this.setCreativeTab(CreativeTabs.tabRedstone);
}
@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 BasicUtilitiesMain.ITEM_PNG;
}
@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 = BasicUtilitiesMain.machine.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 (BasicUtilitiesMain.pipe.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

@ -0,0 +1,125 @@
package dark.BasicUtilities.machines;
import java.util.List;
import dark.BasicUtilities.BasicUtilitiesMain;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemBlock;
import net.minecraft.src.ItemStack;
import net.minecraft.src.MathHelper;
import net.minecraft.src.TileEntity;
import net.minecraft.src.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(CreativeTabs.tabRedstone);
}
@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 BasicUtilitiesMain.ITEM_PNG;
}
@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 = BasicUtilitiesMain.valve.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 (BasicUtilitiesMain.pipe.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

@ -0,0 +1,110 @@
package dark.BasicUtilities.machines;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.implement.IElectricityReceiver;
import dark.BasicUtilities.api.ILiquidProducer;
import dark.BasicUtilities.api.Liquid;
public class TileEntityCondenser extends TileEntity implements ILiquidProducer, IElectricityReceiver {
int tickCount = 0;
int waterStored = 0;
int energyStored = 0;
@Override
public int onProduceLiquid(Liquid type,int maxVol, ForgeDirection side) {
if(type == Liquid.WATER)
{
int tradeW = Math.min(maxVol, waterStored);
waterStored -= tradeW;
return tradeW;
}
return 0;
}
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("energyStored", (int)this.energyStored);
par1NBTTagCompound.setInteger("waterStored", (int)this.waterStored);
}
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.energyStored = par1NBTTagCompound.getInteger("energyStored");
this.waterStored = par1NBTTagCompound.getInteger("waterStored");
}
public void updateEntity()
{
if(energyStored > 100 && waterStored < 3)
{
energyStored -= 100;
waterStored += 1;
}
}
@Override
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER)
{
return true;
}
return false;
}
@Override
public void onDisable(int duration) {
// TODO Auto-generated method stub
}
@Override
public boolean isDisabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public double wattRequest() {
// TODO Auto-generated method stub
return 0;
}
@Override
public boolean canReceiveFromSide(ForgeDirection side) {
// TODO Auto-generated method stub
return false;
}
@Override
public int presureOutput(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER)
{
return 32;
}
return 0;
}
@Override
public boolean canProducePresure(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER)
{
return true;
}
return false;
}
@Override
public boolean canConnect(ForgeDirection side) {
// TODO Auto-generated method stub
return true;
}
@Override
public double getVoltage() {
// TODO Auto-generated method stub
return 120;
}
@Override
public void onReceive(TileEntity sender, double amps, double voltage,
ForgeDirection side) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,156 @@
package dark.BasicUtilities.machines;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.Vector3;
import universalelectricity.implement.IElectricityReceiver;
import universalelectricity.prefab.TileEntityElectricityReceiver;
import dark.BasicUtilities.api.ILiquidProducer;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.api.MHelper;
public class TileEntityPump extends TileEntityElectricityReceiver implements ILiquidProducer,IElectricityReceiver {
int dCount = 0;
float eStored = 0;
float eMax = 2000;
int lStored = 0;
int wMax = 10;
public Liquid type = Liquid.DEFUALT;
public TileEntity[] sList = {null,null,null,null,null,null};
private int count = 0;
@Override
public void onDisable(int duration) {
dCount = duration;
}
@Override
public boolean isDisabled() {
if(dCount <= 0)
{
return false;
}
return true;
}
@Override
public void updateEntity() {
super.updateEntity();
if(count++ >= 40)
{
count = 0;
sList = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
int bBlock = worldObj.getBlockId(xCoord, yCoord -1, zCoord);
Liquid bellow = Liquid.getLiquidByBlock(bBlock);
if(bellow != null && this.lStored <= 0)
{
this.type = bellow;
}
eStored+=200; //TODO remove after testing
if(!worldObj.isRemote)
{
if(bBlock == type.Still && this.eStored >= 200 && this.lStored < this.wMax)
{
eStored -= 200;
lStored += 1;
worldObj.setBlockAndMetadataWithNotify(xCoord, yCoord-1, zCoord, 0, 0);
}
}
}
}
/**
* Used to find the farthest source from the center location
* @param loc - center of search bounds
* @param maxRange - max search range
* @param liquid - liquid being searched for, if has no block registered to it returns null
*/
public Vector3 findDistanceSource(Vector3 loc, int maxRange, Liquid liquid)
{
//TODO create a way to scan the outer bounds
//looking for a source of x liquid
if(liquid.Still != 0 && liquid.Still != -1)
{
}
return null;
}
@Override
public boolean canReceiveFromSide(ForgeDirection side) {
if(side != ForgeDirection.DOWN)
{
return true;
}
return false;
}
@Override
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side) {
if(type == this.type && lStored > 0)
{
lStored -= 1;
return 1;
}
return 0;
}
@Override
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
int facing = 0;
switch(meta)
{
case 0: facing = 2;break;
case 1: facing = 5;break;
case 2: facing = 3;break;
case 3: facing = 4;break;
}
if(type == this.type && side != ForgeDirection.DOWN && side != ForgeDirection.UP && side != ForgeDirection.getOrientation(facing).getOpposite())
{
return true;
}
return false;
}
@Override
public int presureOutput(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER)
{
return 32;
}else
if(type == Liquid.LAVA)
{
return 10;
}else
if(type == this.type)
{
return 50;
}
return 0;
}
@Override
public boolean canProducePresure(Liquid type, ForgeDirection side) {
if(type == this.type)
{
return true;
}
return false;
}
@Override
public void onReceive(TileEntity sender, double watts, double voltage,
ForgeDirection side) {
if (wattRequest() > 0 && canConnect(side))
{
float rejectedElectricity = (float) Math.max((this.eStored + watts) - this.eMax, 0.0);
this.eStored = (float) Math.max(this.eStored + watts - rejectedElectricity, 0.0);
}
}
@Override
public double wattRequest() {
return Math.max(eMax - eStored,0);
}
}

View file

@ -0,0 +1,109 @@
package dark.BasicUtilities.machines;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import dark.BasicUtilities.api.ILiquidConsumer;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.api.MHelper;
import dark.BasicUtilities.pipes.TileEntityPipe;
public class TileEntityValve extends TileEntity implements ILiquidConsumer {
Liquid type = Liquid.DEFUALT;
int liquidStored = 0;
int lMax = 1;
int tickCount = 0;
TileEntity[] connected = {null,null,null,null,null,null};
boolean on = false;
@Override
public void updateEntity()
{
tickCount++;
if(tickCount >= 10)
{
int deltaX = 0;
int deltaZ = 0;
int deltaY = 0;
int facing = 0;
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if(meta == 0 && meta == 8)
{
facing = 2;
}
if(meta == 1 && meta == 9)
{
facing = 5;
}
if(meta == 2 && meta == 10)
{
facing = 3;
}
if(meta == 3 && meta == 11)
{
facing = 4;
}
if((meta > 3 && meta < 8)&&(meta> 11 && meta < 16))
{
facing = 0;
}
switch(facing)
{
case 0: deltaY++;break;
case 1: deltaY--;break;
case 2: deltaZ--;break;
case 5: deltaZ++;break;
case 3: deltaX--;break;
case 4: deltaX++;break;
}
connected = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
for(int i = 0;i<6;i++)
{
if(!(connected[i] instanceof TileEntityPipe))
{
connected[i] = null;
}
}
if(!worldObj.isRemote)
{
//TODO send packet
}
tickCount = 0;
}
}
@Override
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
if(this.type == Liquid.DEFUALT)
{
this.type = type;
}
return vol;
}
@Override
public boolean canRecieveLiquid(Liquid type, ForgeDirection forgeDirection) {
if(type == this.type)
{
return true;
}
return false;
}
@Override
public int getStoredLiquid(Liquid type) {
if(type == this.type)
{
return liquidStored;
}
return 0;
}
@Override
public int getLiquidCapacity(Liquid type) {
if(type == this.type)
{
return lMax;
}
return 0;
}
}

View file

@ -0,0 +1,81 @@
package dark.BasicUtilities.mechanical;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Material;
import net.minecraft.src.MathHelper;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import net.minecraftforge.common.ForgeDirection;
import dark.BasicUtilities.ItemRenderHelper;
public class BlockRod extends universalelectricity.prefab.BlockMachine {
public BlockRod(int par1) {
super("MechanicRod", par1, Material.iron);
this.setCreativeTab(CreativeTabs.tabRedstone);
}
@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 boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer)
{
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 TileEntity createNewTileEntity(World var1)
{
return new TileEntityRod();
}
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return ItemRenderHelper.renderID;
}
}

View file

@ -0,0 +1,138 @@
package dark.BasicUtilities.mechanical;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.Vector3;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.IMechanical;
public class TileEntityRod extends TileEntity implements IPacketReceiver,IMechanical {
public int pos = 0;
private int force = 0;
private int pForce = 0;
public int aForce = 0;
public int forceMax = 1000;
private int tickCount = 0;
private int posCount = 0;
private ForgeDirection frontDir;
private ForgeDirection backDir;
private TileEntity bb;
private TileEntity ff;
@Override
public void updateEntity()
{
super.updateEntity();
if(tickCount++ >=10)
{ tickCount = 0;
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
frontDir = ForgeDirection.getOrientation(meta);
backDir = ForgeDirection.getOrientation(meta).getOpposite();
bb = worldObj.getBlockTileEntity(xCoord+backDir.offsetX, yCoord, zCoord+backDir.offsetZ);
ff = worldObj.getBlockTileEntity(xCoord+frontDir.offsetX, yCoord, zCoord+frontDir.offsetZ);
if(force > 0)
{
int posCountA = (forceMax/force) & 10;
if(posCount++ >= posCountA)
{
pos ++;if(pos > 7){pos = 0;};
}
}
if(bb instanceof TileEntityRod)
{
this.pos = ((IMechanical)bb).getAnimationPos();
}
if(!worldObj.isRemote)
{
if(ff instanceof IMechanical)
{
if(((IMechanical) ff).canInputSide(backDir))
{
((IMechanical) ff).applyForce(aForce);
}
}
if(bb instanceof IMechanical)
{
if(((IMechanical) bb).canOutputSide(frontDir))
{
this.force = ((IMechanical) bb).getForce();
}
}else
{
this.force -=Math.max(force/10, 0);
}
aForce = Math.max(force - 10,0);
if(this.force != this.pForce)
{
Packet packet = PacketManager.getPacket(BasicUtilitiesMain.CHANNEL,this, new Object[]{force});
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 40);
}
this.pForce = this.force;
}
}
}
@Override
public int getForceSide(ForgeDirection side) {
return aForce;
}
@Override
public boolean canOutputSide(ForgeDirection side) {
if(side == frontDir)
{
return true;
}
return false;
}
@Override
public boolean canInputSide(ForgeDirection side) {
if(side == backDir)
{
return true;
}
return false;
}
@Override
public int applyForce(int force) {
this.force = force;
return force;
}
@Override
public void handlePacketData(INetworkManager network, int packetType,
Packet250CustomPayload packet, EntityPlayer player,
ByteArrayDataInput data) {
try
{
this.force = data.readInt();
}catch(Exception e)
{
e.printStackTrace();
System.out.print("MechRodDataFailure \n");
}
}
@Override
public int getAnimationPos() {
return this.pos;
}
@Override
public int getForce() {
// TODO Auto-generated method stub
return this.force;
}
}

View file

@ -0,0 +1,85 @@
package dark.BasicUtilities.pipes;
import java.util.Random;
import dark.BasicUtilities.BasicUtilitiesMain;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.EntityItem;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
public class BlockPipe extends BlockContainer
{
public BlockPipe(int id)
{
super(id, Material.iron);
this.setBlockName("Pipe");
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
this.setHardness(1f);
this.setResistance(3f);
}
public boolean isOpaqueCube(){return false;}
public boolean renderAsNormalBlock(){return false;}
public int getRenderType(){return -1;}
public int idDropped(int par1, Random par2Random, int par3){return 0;}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, 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)
{
super.onNeighborBlockChange(world, x, y, z, blockID);
}
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockId(par2, par3, par4);
return var5 == 0 || blocksList[var5].blockMaterial.isGroundCover();
}
@Override
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public TileEntity createNewTileEntity(World var1) {
// TODO Auto-generated method stub
return new TileEntityPipe();
}
@Override
public void breakBlock(World world, int x, int y, int z,int par5, int par6)
{
super.breakBlock(world, x, y, z, par5, par6);
TileEntity ent = world.getBlockTileEntity(x, y, z);
Random furnaceRand = new Random();
if(ent instanceof TileEntityPipe)
{
TileEntityPipe pipe = (TileEntityPipe) ent;
int meta = pipe.type.ordinal();
float var8 = furnaceRand.nextFloat() * 0.8F + 0.1F;
float var9 = furnaceRand.nextFloat() * 0.8F + 0.1F;
float var10 = furnaceRand.nextFloat() * 0.8F + 0.1F;
EntityItem var12 = new EntityItem(world, (double)((float)x + var8), (double)((float)y + var9),
(double)((float)z + var10), new ItemStack(BasicUtilitiesMain.itemPipes, 1, meta));
float var13 = 0.05F;
var12.motionX = (double)((float)furnaceRand.nextGaussian() * var13);
var12.motionY = (double)((float)furnaceRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double)((float)furnaceRand.nextGaussian() * var13);
world.spawnEntityInWorld(var12);
}
}
}

View file

@ -0,0 +1,128 @@
package dark.BasicUtilities.pipes;
import java.util.List;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.Liquid;
public class ItemPipe extends Item
{
int index = 32;//32 + 4 rows alloted to pipes
private int spawnID;
public ItemPipe(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("pipe");
this.setCreativeTab(CreativeTabs.tabRedstone);
}
@Override
public int getIconFromDamage(int par1)
{
return par1+index;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return itemstack.getItemDamage() < Liquid.values().length ? Liquid.getLiquid(itemstack.getItemDamage()).lName+" Pipe" : "Empty Pipe";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i = 0; i < Liquid.values().length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
public String getTextureFile() {
return BasicUtilitiesMain.ITEM_PNG;
}
@Override
public String getItemName()
{
return "Pipes";
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
int blockID = par3World.getBlockId(par4, par5, par6);
spawnID = BasicUtilitiesMain.pipe.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 (BasicUtilitiesMain.pipe.canPlaceBlockAt(par3World,par4,par5,par6))
{
Block var9 = Block.blocksList[this.spawnID];
par3World.editingBlocks = true;
if (par3World.setBlockWithNotify(par4, par5, par6, var9.blockID))
{
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, par2EntityPlayer);
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
if(blockEntity instanceof TileEntityPipe)
{
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
Liquid dm = Liquid.getLiquid(par1ItemStack.getItemDamage());
pipeEntity.setType(dm);
}
}
--par1ItemStack.stackSize;
par3World.editingBlocks = false;
return true;
}
}
par3World.editingBlocks = false;
return false;
}
}

View file

@ -0,0 +1,225 @@
package dark.BasicUtilities.pipes;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.Vector3;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.ILiquidConsumer;
import dark.BasicUtilities.api.ILiquidProducer;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.api.MHelper;
public class TileEntityPipe extends TileEntity implements ILiquidConsumer, IPacketReceiver
{
protected Liquid type = Liquid.DEFUALT;
public int capacity = 2;
public int presure = 0;
public int connectedUnits = 0;
public int liquidStored = 0;
private int count = 0;
private int count2 = 0;
protected boolean firstUpdate = true;
public TileEntity[] connectedBlocks =
{ null, null, null, null, null, null };
public int getPressure()
{
return this.presure;
}
@Override
public void updateEntity()
{
if (++count >= 5)
{
count = 0;
this.connectedBlocks = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
this.presure = this.updatePressure();
if (!worldObj.isRemote)
{
if (firstUpdate || count2++ >= 5)
{
count2 = 0;
firstUpdate = false;
Packet packet = PacketManager.getPacket(BasicUtilitiesMain.CHANNEL, this, this.type.ordinal() );
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 60);
}
for (int i = 0; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i).getOpposite();
if (connectedBlocks[i] instanceof ILiquidProducer && ((ILiquidProducer) connectedBlocks[i]).canProduceLiquid(this.type, dir))
{
int vol = ((ILiquidProducer) connectedBlocks[i]).onProduceLiquid(this.type, this.capacity - this.liquidStored, dir);
this.liquidStored = Math.min(this.liquidStored + vol,
this.capacity);
}
if (connectedBlocks[i] instanceof ILiquidConsumer && ((ILiquidConsumer) connectedBlocks[i]).canRecieveLiquid(this.type, dir) && this.liquidStored > 0 && this.presure > 0)
{
if (connectedBlocks[i] instanceof TileEntityPipe)
{
this.liquidStored--;
int vol = ((ILiquidConsumer) connectedBlocks[i]).onReceiveLiquid(this.type, Math.max(this.liquidStored, 1), dir);
this.liquidStored += vol;
}
else
{
this.liquidStored = ((ILiquidConsumer) connectedBlocks[i]).onReceiveLiquid(this.type, this.liquidStored, dir);
}
}
}
}
}
}
/**
* used to cause the pipes presure to update depending on what is connected
* to it
*
* @return
*/
public int updatePressure()
{
int highestPressure = 0;
this.connectedUnits = 0;
for (int i = 0; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i).getOpposite();
if (connectedBlocks[i] instanceof ILiquidConsumer && ((ILiquidConsumer) connectedBlocks[i]).canRecieveLiquid(this.type, dir))
{
this.connectedUnits++;
if (connectedBlocks[i] instanceof TileEntityPipe)
{
if (((TileEntityPipe) connectedBlocks[i]).getPressure() > highestPressure)
{
highestPressure = ((TileEntityPipe) connectedBlocks[i]).getPressure();
}
}
}
else if (connectedBlocks[i] instanceof ILiquidProducer && ((ILiquidProducer) connectedBlocks[i]).canProduceLiquid(this.type, dir))
{
this.connectedUnits++;
if (((ILiquidProducer) connectedBlocks[i]).canProducePresure(this.type, dir) && ((ILiquidProducer) connectedBlocks[i]).presureOutput(this.type, dir) > highestPressure)
{
highestPressure = ((ILiquidProducer) connectedBlocks[i]).presureOutput(this.type, ForgeDirection.getOrientation(i));
}
}
else
{
connectedBlocks[i] = null;
}
}
return highestPressure - 1;
}
// ---------------
// liquid stuff
// ---------------
@Override
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side)
{
if (type == this.type)
{
int rejectedVolume = Math.max((this.getStoredLiquid(type) + vol) - this.capacity, 0);
this.liquidStored = Math.min(Math.max((liquidStored + vol - rejectedVolume), 0), this.capacity);
return rejectedVolume;
}
return vol;
}
/**
* @return Return the stored volume in this pipe.
*/
@Override
public int getStoredLiquid(Liquid type)
{
if (type == this.type) { return this.liquidStored; }
return 0;
}
@Override
public int getLiquidCapacity(Liquid type)
{
if (type == this.type) { return this.capacity; }
return 0;
}
// find wether or not this side of X block can recieve X liquid type. Also
// use to determine connection of a pipe
@Override
public boolean canRecieveLiquid(Liquid type, ForgeDirection side)
{
if (type == this.type) { return true; }
return false;
}
// returns liquid type
public Liquid getType()
{
return this.type;
}
// used by the item to set the liquid type on spawn
public void setType(Liquid rType)
{
this.type = rType;
}
// ---------------------
// data
// --------------------
@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput data)
{
try
{
this.setType(Liquid.getLiquid(data.readInt()));
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Reads a tile entity from NBT.
*/
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.liquidStored = par1NBTTagCompound.getInteger("liquid");
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
}
/**
* Writes a tile entity to NBT.
*/
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("liquid", this.liquidStored);
par1NBTTagCompound.setInteger("type", this.type.ordinal());
}
}

View file

@ -0,0 +1,138 @@
// Date: 9/25/2012 4:29:17 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.BasicUtilities.renders;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelGearRod extends ModelBase
{
//fields
ModelRenderer Rod;
ModelRenderer front;
ModelRenderer back;
ModelRenderer f2;
ModelRenderer b2;
ModelRenderer b3;
ModelRenderer b4;
ModelRenderer b1;
ModelRenderer f1;
ModelRenderer f4;
ModelRenderer f3;
ModelRenderer Rod2;
public ModelGearRod()
{
textureWidth = 64;
textureHeight = 32;
Rod = new ModelRenderer(this, 0, 0);
Rod.addBox(-1.5F, -1.5F, 0F, 3, 3, 12);
Rod.setRotationPoint(0F, 16F, -6F);
Rod.setTextureSize(64, 32);
Rod.mirror = true;
setRotation(Rod, 0F, 0F, 0F);
front = new ModelRenderer(this, 35, 0);
front.addBox(-2F, -2F, -2F, 4, 4, 2);
front.setRotationPoint(0F, 16F, -6F);
front.setTextureSize(64, 32);
front.mirror = true;
setRotation(front, 0F, 0F, 0F);
back = new ModelRenderer(this, 35, 0);
back.addBox(-2F, -2F, 0F, 4, 4, 2);
back.setRotationPoint(0F, 16F, 6F);
back.setTextureSize(64, 32);
back.mirror = true;
setRotation(back, 0F, 0F, 0.7853982F);
f2 = new ModelRenderer(this, 0, 17);
f2.addBox(0F, 0F, 0F, 1, 1, 2);
f2.setRotationPoint(1F, 17F, -10F);
f2.setTextureSize(64, 32);
f2.mirror = true;
setRotation(f2, 0F, 0F, 0F);
b2 = new ModelRenderer(this, 0, 17);
b2.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
b2.setRotationPoint(0F, 18F, 8F);
b2.setTextureSize(64, 32);
b2.mirror = true;
setRotation(b2, 0F, 0F, 0.7853982F);
b3 = new ModelRenderer(this, 0, 17);
b3.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
b3.setRotationPoint(-2F, 16F, 8F);
b3.setTextureSize(64, 32);
b3.mirror = true;
setRotation(b3, 0F, 0F, 0.7853982F);
b4 = new ModelRenderer(this, 0, 17);
b4.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
b4.setRotationPoint(2F, 16F, 8F);
b4.setTextureSize(64, 32);
b4.mirror = true;
setRotation(b4, 0F, 0F, 0.7853982F);
b1 = new ModelRenderer(this, 0, 17);
b1.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
b1.setRotationPoint(0F, 14F, 8F);
b1.setTextureSize(64, 32);
b1.mirror = true;
setRotation(b1, 0F, 0F, 0.7853982F);
f1 = new ModelRenderer(this, 0, 17);
f1.addBox(0F, 0F, 0F, 1, 1, 2);
f1.setRotationPoint(1F, 14F, -10F);
f1.setTextureSize(64, 32);
f1.mirror = true;
setRotation(f1, 0F, 0F, 0F);
f4 = new ModelRenderer(this, 0, 17);
f4.addBox(0F, 0F, 0F, 1, 1, 2);
f4.setRotationPoint(-2F, 17F, -10F);
f4.setTextureSize(64, 32);
f4.mirror = true;
setRotation(f4, 0F, 0F, 0F);
f3 = new ModelRenderer(this, 0, 17);
f3.addBox(0F, 0F, 0F, 1, 1, 2);
f3.setRotationPoint(-2F, 14F, -10F);
f3.setTextureSize(64, 32);
f3.mirror = true;
setRotation(f3, 0F, 0F, 0F);
Rod2 = new ModelRenderer(this, 0, 0);
Rod2.addBox(-1.5F, -1.5F, 0F, 3, 3, 12);
Rod2.setRotationPoint(0F, 16F, -6F);
Rod2.setTextureSize(64, 32);
Rod2.mirror = true;
setRotation(Rod2, 0F, 0F, 0.7853982F);
}
public void render(float f5,int r)
{
Rod.rotateAngleZ= 45 * r;
Rod2.rotateAngleZ= Rod.rotateAngleZ + 45;
Rod.render(f5);
Rod2.render(f5);
//TODO add rotation to rods
front.render(f5);
back.render(f5);
f2.render(f5);
b2.render(f5);
b3.render(f5);
b4.render(f5);
b1.render(f5);
f1.render(f5);
f4.render(f5);
f3.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,177 @@
// Date: 9/20/2012 12:00:21 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.BasicUtilities.renders;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelLargePipe extends ModelBase
{
//fields
ModelRenderer Mid;
ModelRenderer RightPipe;
ModelRenderer RightInter;
ModelRenderer RightConnect;
ModelRenderer LeftInter;
ModelRenderer LeftPipe;
ModelRenderer LeftConnect;
ModelRenderer TopInter;
ModelRenderer TopPipe;
ModelRenderer TopConnect;
ModelRenderer BottomPipe;
ModelRenderer BottomInter;
ModelRenderer BottomConnect;
ModelRenderer BackPipe;
ModelRenderer BackInter;
ModelRenderer BackConnect;
ModelRenderer FrontInter;
ModelRenderer FrontPipe;
ModelRenderer FrontConnect;
public ModelLargePipe()
{
textureWidth = 128;
textureHeight = 32;
Mid = new ModelRenderer(this, 50, 13);
Mid.addBox(-3F, -3F, -3F, 6, 6, 6);
Mid.setRotationPoint(0F, 16F, 0F);
Mid.setTextureSize(128, 32);
Mid.mirror = true;
setRotation(Mid, 0F, 0F, 0F);
RightPipe = new ModelRenderer(this, 25, 0);
RightPipe.addBox(0F, -3F, -3F, 4, 6, 6);
RightPipe.setRotationPoint(3F, 16F, 0F);
RightPipe.setTextureSize(128, 32);
RightPipe.mirror = true;
setRotation(RightPipe, 0F, 0F, 0F);
RightInter = new ModelRenderer(this, 98, 0);
RightInter.addBox(0F, -4F, -4F, 1, 8, 8);
RightInter.setRotationPoint(2F, 16F, 0F);
RightInter.setTextureSize(128, 32);
RightInter.mirror = true;
setRotation(RightInter, 0F, 0F, 0F);
RightConnect = new ModelRenderer(this, 98, 0);
RightConnect.addBox(0F, -4F, -4F, 1, 8, 8);
RightConnect.setRotationPoint(7F, 16F, 0F);
RightConnect.setTextureSize(128, 32);
RightConnect.mirror = true;
setRotation(RightConnect, 0F, 0F, 0F);
LeftInter = new ModelRenderer(this, 98, 0);
LeftInter.addBox(-1F, -4F, -4F, 1, 8, 8);
LeftInter.setRotationPoint(-2F, 16F, 0F);
LeftInter.setTextureSize(128, 32);
LeftInter.mirror = true;
setRotation(LeftInter, 0F, 0F, 0F);
LeftPipe = new ModelRenderer(this, 25, 0);
LeftPipe.addBox(-4F, -3F, -3F, 4, 6, 6);
LeftPipe.setRotationPoint(-3F, 16F, 0F);
LeftPipe.setTextureSize(128, 32);
LeftPipe.mirror = true;
setRotation(LeftPipe, 0F, 0F, 0F);
LeftConnect = new ModelRenderer(this, 98, 0);
LeftConnect.addBox(-1F, -4F, -4F, 1, 8, 8);
LeftConnect.setRotationPoint(-7F, 16F, 0F);
LeftConnect.setTextureSize(128, 32);
LeftConnect.mirror = true;
setRotation(LeftConnect, 0F, 0F, 0F);
TopInter = new ModelRenderer(this, 77, 17);
TopInter.addBox(-4F, -1F, -4F, 8, 1, 8);
TopInter.setRotationPoint(0F, 14F, 0F);
TopInter.setTextureSize(128, 32);
TopInter.mirror = true;
setRotation(TopInter, 0F, 0F, 0F);
TopPipe = new ModelRenderer(this, 50, 0);
TopPipe.addBox(-3F, -4F, -3F, 6, 4, 6);
TopPipe.setRotationPoint(0F, 13F, 0F);
TopPipe.setTextureSize(128, 32);
TopPipe.mirror = true;
setRotation(TopPipe, 0F, 0F, 0F);
TopConnect = new ModelRenderer(this, 77, 17);
TopConnect.addBox(-4F, -1F, -4F, 8, 1, 8);
TopConnect.setRotationPoint(0F, 9F, 0F);
TopConnect.setTextureSize(128, 32);
TopConnect.mirror = true;
setRotation(TopConnect, 0F, 0F, 0F);
BottomPipe = new ModelRenderer(this, 50, 0);
BottomPipe.addBox(-3F, 0F, -3F, 6, 4, 6);
BottomPipe.setRotationPoint(0F, 19F, 0F);
BottomPipe.setTextureSize(128, 32);
BottomPipe.mirror = true;
setRotation(BottomPipe, 0F, 0F, 0F);
BottomInter = new ModelRenderer(this, 77, 17);
BottomInter.addBox(-4F, 0F, -4F, 8, 1, 8);
BottomInter.setRotationPoint(0F, 18F, 0F);
BottomInter.setTextureSize(128, 32);
BottomInter.mirror = true;
setRotation(BottomInter, 0F, 0F, 0F);
BottomConnect = new ModelRenderer(this, 77, 17);
BottomConnect.addBox(-4F, 0F, -4F, 8, 1, 8);
BottomConnect.setRotationPoint(0F, 23F, 0F);
BottomConnect.setTextureSize(128, 32);
BottomConnect.mirror = true;
setRotation(BottomConnect, 0F, 0F, 0F);
BackPipe = new ModelRenderer(this, 0, 0);
BackPipe.addBox(-3F, -3F, 0F, 6, 6, 4);
BackPipe.setRotationPoint(0F, 16F, 3F);
BackPipe.setTextureSize(128, 32);
BackPipe.mirror = true;
setRotation(BackPipe, 0F, 0F, 0F);
BackInter = new ModelRenderer(this, 0, 23);
BackInter.addBox(-4F, -4F, 0F, 8, 8, 1);
BackInter.setRotationPoint(0F, 16F, 2F);
BackInter.setTextureSize(128, 32);
BackInter.mirror = true;
setRotation(BackInter, 0F, 0F, 0F);
BackConnect = new ModelRenderer(this, 0, 23);
BackConnect.addBox(-4F, -4F, 0F, 8, 8, 1);
BackConnect.setRotationPoint(0F, 16F, 7F);
BackConnect.setTextureSize(128, 32);
BackConnect.mirror = true;
setRotation(BackConnect, 0F, 0F, 0F);
FrontInter = new ModelRenderer(this, 0, 23);
FrontInter.addBox(-4F, -4F, -1F, 8, 8, 1);
FrontInter.setRotationPoint(0F, 16F, -2F);
FrontInter.setTextureSize(128, 32);
FrontInter.mirror = true;
setRotation(FrontInter, 0F, 0F, 0F);
FrontPipe = new ModelRenderer(this, 0, 0);
FrontPipe.addBox(-3F, -3F, -4F, 6, 6, 4);
FrontPipe.setRotationPoint(0F, 16F, -3F);
FrontPipe.setTextureSize(128, 32);
FrontPipe.mirror = true;
setRotation(FrontPipe, 0F, 0F, 0F);
FrontConnect = new ModelRenderer(this, 0, 23);
FrontConnect.addBox(-4F, -4F, -1F, 8, 8, 1);
FrontConnect.setRotationPoint(0F, 16F, -7F);
FrontConnect.setTextureSize(128, 32);
FrontConnect.mirror = true;
setRotation(FrontConnect, 0F, 0F, 0F);
}
public void renderMiddle() { Mid.render(0.0625F); }
public void renderBottom() { BottomPipe.render(0.0625F); BottomConnect.render(0.0625F); BottomInter.render(0.0625F);}
public void renderTop() { TopPipe.render(0.0625F);TopConnect.render(0.0625F); TopInter.render(0.0625F);}
public void renderLeft() { LeftPipe.render(0.0625F);LeftConnect.render(0.0625F); LeftInter.render(0.0625F);}
public void renderRight() { RightPipe.render(0.0625F);RightConnect.render(0.0625F); RightInter.render(0.0625F);}
public void renderBack() { BackPipe.render(0.0625F); BackConnect.render(0.0625F);BackInter.render(0.0625F); }
public void renderFront() { FrontPipe.render(0.0625F);FrontConnect.render(0.0625F);FrontInter.render(0.0625F);}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,419 @@
// Date: 10/8/2012 7:31:40 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.BasicUtilities.renders;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
import dark.BasicUtilities.pipes.TileEntityPipe;
import dark.BasicUtilities.tanks.TileEntityLTank;
public class ModelLiquidTank extends ModelBase
{
//fields
ModelRenderer Mid;
ModelRenderer Corner;
ModelRenderer Corner2;
ModelRenderer Corner3;
ModelRenderer Corner4;
ModelRenderer C8;
ModelRenderer C7;
ModelRenderer C6;
ModelRenderer C5;
ModelRenderer C4;
ModelRenderer C;
ModelRenderer C3;
ModelRenderer C2;
ModelRenderer GuageT;
ModelRenderer GuageB;
ModelRenderer Guage;
ModelRenderer GuageR;
ModelRenderer GuageGlass;
ModelRenderer GuageL;
ModelRenderer GuageT2;
ModelRenderer GuageB2;
ModelRenderer Guage2;
ModelRenderer GuageR2;
ModelRenderer GuageGlass2;
ModelRenderer GuageL2;
ModelRenderer GuageT3;
ModelRenderer GuageB3;
ModelRenderer Guage3;
ModelRenderer GuageR3;
ModelRenderer GuageGlass3;
ModelRenderer GuageL3;
ModelRenderer GuageT4;
ModelRenderer GuageB4;
ModelRenderer Guage4;
ModelRenderer GuageR4;
ModelRenderer GuageGlass4;
ModelRenderer GuageL4;
ModelRenderer CCBottom;
ModelRenderer CCRight;
ModelRenderer CCLeft;
ModelRenderer CCFront;
ModelRenderer CCBack;
ModelRenderer CCTop;
public ModelLiquidTank()
{
textureWidth = 128;
textureHeight = 128;
Mid = new ModelRenderer(this, 0, 50);
Mid.addBox(-6F, 0F, -6F, 12, 14, 12);
Mid.setRotationPoint(0F, 9F, 0F);
Mid.setTextureSize(128, 128);
Mid.mirror = true;
setRotation(Mid, 0F, 0F, 0F);
Corner = new ModelRenderer(this, 0, 30);
Corner.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner.setRotationPoint(-7F, 8F, 7F);
Corner.setTextureSize(128, 128);
Corner.mirror = true;
setRotation(Corner, 0F, 0F, 0F);
Corner2 = new ModelRenderer(this, 0, 30);
Corner2.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner2.setRotationPoint(-7F, 8F, -7F);
Corner2.setTextureSize(128, 128);
Corner2.mirror = true;
setRotation(Corner2, 0F, 0F, 0F);
Corner3 = new ModelRenderer(this, 0, 30);
Corner3.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner3.setRotationPoint(7F, 8F, -7F);
Corner3.setTextureSize(128, 128);
Corner3.mirror = true;
setRotation(Corner3, 0F, 0F, 0F);
Corner4 = new ModelRenderer(this, 0, 30);
Corner4.addBox(-1F, 0F, -1F, 2, 16, 2);
Corner4.setRotationPoint(7F, 8F, 7F);
Corner4.setTextureSize(128, 128);
Corner4.mirror = true;
setRotation(Corner4, 0F, 0F, 0F);
C8 = new ModelRenderer(this, 9, 35);
C8.addBox(-1F, 0F, -1F, 2, 2, 12);
C8.setRotationPoint(6F, 22F, -5F);
C8.setTextureSize(128, 128);
C8.mirror = true;
setRotation(C8, 0F, 0F, 0F);
C7 = new ModelRenderer(this, 9, 35);
C7.addBox(-1F, 0F, -1F, 2, 2, 12);
C7.setRotationPoint(-6F, 8F, -5F);
C7.setTextureSize(128, 128);
C7.mirror = true;
setRotation(C7, 0F, 0F, 0F);
C6 = new ModelRenderer(this, 9, 35);
C6.addBox(-1F, 0F, -1F, 2, 2, 12);
C6.setRotationPoint(6F, 8F, -5F);
C6.setTextureSize(128, 128);
C6.mirror = true;
setRotation(C6, 0F, 0F, 0F);
C5 = new ModelRenderer(this, 9, 30);
C5.addBox(-1F, 0F, -1F, 12, 2, 2);
C5.setRotationPoint(-5F, 8F, 6F);
C5.setTextureSize(128, 128);
C5.mirror = true;
setRotation(C5, 0F, 0F, 0F);
C4 = new ModelRenderer(this, 9, 35);
C4.addBox(-1F, 0F, -1F, 2, 2, 12);
C4.setRotationPoint(-6F, 22F, -5F);
C4.setTextureSize(128, 128);
C4.mirror = true;
setRotation(C4, 0F, 0F, 0F);
C = new ModelRenderer(this, 9, 30);
C.addBox(-1F, 0F, -1F, 12, 2, 2);
C.setRotationPoint(-5F, 22F, 6F);
C.setTextureSize(128, 128);
C.mirror = true;
setRotation(C, 0F, 0F, 0F);
C3 = new ModelRenderer(this, 9, 30);
C3.addBox(-1F, 0F, -1F, 12, 2, 2);
C3.setRotationPoint(-5F, 8F, -6F);
C3.setTextureSize(128, 128);
C3.mirror = true;
setRotation(C3, 0F, 0F, 0F);
C2 = new ModelRenderer(this, 9, 30);
C2.addBox(-1F, 0F, -1F, 12, 2, 2);
C2.setRotationPoint(-5F, 22F, -6F);
C2.setTextureSize(128, 128);
C2.mirror = true;
setRotation(C2, 0F, 0F, 0F);
//G1--------------------------------------
GuageT = new ModelRenderer(this, 54, 42);
GuageT.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT.setRotationPoint(0F, 12F, -8F);
GuageT.setTextureSize(128, 128);
GuageT.mirror = true;
setRotation(GuageT, 0F, 0F, 0F);
GuageB = new ModelRenderer(this, 54, 42);
GuageB.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB.setRotationPoint(0F, 12F, -8F);
GuageB.setTextureSize(128, 128);
GuageB.mirror = true;
setRotation(GuageB, 0F, 0F, 0F);
Guage = new ModelRenderer(this, 54, 32);
Guage.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage.setRotationPoint(0F, 12F, -7F);
Guage.setTextureSize(128, 128);
Guage.mirror = true;
setRotation(Guage, 0F, 0F, 0F);
GuageR = new ModelRenderer(this, 44, 32);
GuageR.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR.setRotationPoint(0F, 12F, -7F);
GuageR.setTextureSize(128, 128);
GuageR.mirror = true;
setRotation(GuageR, 0F, 0F, 0F);
GuageGlass = new ModelRenderer(this, 60, 32);
GuageGlass.addBox(-1F, 0F, 0F, 2, 8, 1);
GuageGlass.setRotationPoint(0F, 12F, -8F);
GuageGlass.setTextureSize(128, 128);
GuageGlass.mirror = true;
setRotation(GuageGlass, 0F, 0F, 0F);
GuageL = new ModelRenderer(this, 44, 32);
GuageL.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL.setRotationPoint(0F, 12F, -7F);
GuageL.setTextureSize(128, 128);
GuageL.mirror = true;
setRotation(GuageL, 0F, 0F, 0F);
//G2----------------------------------
GuageT2 = new ModelRenderer(this, 54, 42);
GuageT2.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT2.setRotationPoint(-8F, 12F, 0F);
GuageT2.setTextureSize(128, 128);
GuageT2.mirror = true;
setRotation(GuageT2, 0F, 1.570796F, 0F);
GuageB2 = new ModelRenderer(this, 54, 42);
GuageB2.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB2.setRotationPoint(-8F, 12F, 0F);
GuageB2.setTextureSize(128, 128);
GuageB2.mirror = true;
setRotation(GuageB2, 0F, 1.570796F, 0F);
Guage2 = new ModelRenderer(this, 54, 32);
Guage2.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage2.setRotationPoint(-7F, 12F, 0F);
Guage2.setTextureSize(128, 128);
Guage2.mirror = true;
setRotation(Guage2, 0F, 1.570796F, 0F);
GuageR2 = new ModelRenderer(this, 44, 32);
GuageR2.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR2.setRotationPoint(-7F, 12F, 0F);
GuageR2.setTextureSize(128, 128);
GuageR2.mirror = true;
setRotation(GuageR2, 0F, 1.570796F, 0F);
GuageGlass2 = new ModelRenderer(this, 60, 32);
GuageGlass2.addBox(-1F, 0F, 0F, 2, 8, 1);
GuageGlass2.setRotationPoint(-8F, 12F, 0F);
GuageGlass2.setTextureSize(128, 128);
GuageGlass2.mirror = true;
setRotation(GuageGlass2, 0F, 1.570796F, 0F);
GuageL2 = new ModelRenderer(this, 44, 32);
GuageL2.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL2.setRotationPoint(-7F, 12F, 0F);
GuageL2.setTextureSize(128, 128);
GuageL2.mirror = true;
setRotation(GuageL2, 0F, 1.570796F, 0F);
//G3--------------------------------------
GuageT3 = new ModelRenderer(this, 54, 42);
GuageT3.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT3.setRotationPoint(0F, 12F, 8F);
GuageT3.setTextureSize(128, 128);
GuageT3.mirror = true;
setRotation(GuageT3, 0F, 3.141593F, 0F);
GuageB3 = new ModelRenderer(this, 54, 42);
GuageB3.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB3.setRotationPoint(0F, 12F, 8F);
GuageB3.setTextureSize(128, 128);
GuageB3.mirror = true;
setRotation(GuageB3, 0F, 3.141593F, 0F);
Guage3 = new ModelRenderer(this, 54, 32);
Guage3.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage3.setRotationPoint(0F, 12F, 7F);
Guage3.setTextureSize(128, 128);
Guage3.mirror = true;
setRotation(Guage3, 0F, 3.141593F, 0F);
GuageR3 = new ModelRenderer(this, 44, 32);
GuageR3.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR3.setRotationPoint(0F, 12F, 7F);
GuageR3.setTextureSize(128, 128);
GuageR3.mirror = true;
setRotation(GuageR3, 0F, 3.141593F, 0F);
GuageGlass3 = new ModelRenderer(this, 60, 32);
GuageGlass3.addBox(-1F, 0F, 0F, 2, 8, 1);
GuageGlass3.setRotationPoint(0F, 12F, 8F);
GuageGlass3.setTextureSize(128, 128);
GuageGlass3.mirror = true;
setRotation(GuageGlass3, 0F, 3.141593F, 0F);
GuageL3 = new ModelRenderer(this, 44, 32);
GuageL3.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL3.setRotationPoint(0F, 12F, 7F);
GuageL3.setTextureSize(128, 128);
GuageL3.mirror = true;
setRotation(GuageL3, 0F, 3.141593F, 0F);
//G4-------------------------------
GuageT4 = new ModelRenderer(this, 54, 42);
GuageT4.addBox(-1F, -1F, 0F, 2, 1, 2);
GuageT4.setRotationPoint(8F, 12F, 0F);
GuageT4.setTextureSize(128, 128);
GuageT4.mirror = true;
setRotation(GuageT4, 0F, -1.570796F, 0F);
GuageB4 = new ModelRenderer(this, 54, 42);
GuageB4.addBox(-1F, 8F, 0F, 2, 1, 2);
GuageB4.setRotationPoint(8F, 12F, 0F);
GuageB4.setTextureSize(128, 128);
GuageB4.mirror = true;
setRotation(GuageB4, 0F, -1.570796F, 0F);
Guage4 = new ModelRenderer(this, 54, 32);
Guage4.addBox(-1F, 0F, 0F, 2, 8, 1);
Guage4.setRotationPoint(7F, 12F, 0F);
Guage4.setTextureSize(128, 128);
Guage4.mirror = true;
setRotation(Guage4, 0F, -1.570796F, 0F);
GuageR4 = new ModelRenderer(this, 44, 32);
GuageR4.addBox(1F, -1F, -1F, 2, 10, 2);
GuageR4.setRotationPoint(7F, 12F, 0F);
GuageR4.setTextureSize(128, 128);
GuageR4.mirror = true;
setRotation(GuageR4, 0F, -1.570796F, 0F);
GuageGlass4 = new ModelRenderer(this, 60, 32);
GuageGlass4.addBox(-1F, 0F, 0F, 2, 8, 1);
GuageGlass4.setRotationPoint(8F, 12F, 0F);
GuageGlass4.setTextureSize(128, 128);
GuageGlass4.mirror = true;
setRotation(GuageGlass4, 0F, -1.570796F, 0F);
GuageL4 = new ModelRenderer(this, 44, 32);
GuageL4.addBox(-3F, -1F, -1F, 2, 10, 2);
GuageL4.setRotationPoint(7F, 12F, 0F);
GuageL4.setTextureSize(128, 128);
GuageL4.mirror = true;
setRotation(GuageL4, 0F, -1.570796F, 0F);
//Pipe Connectors
CCBottom = new ModelRenderer(this, 0, 0);
CCBottom.addBox(-3F, -9F, -3F, 6, 1, 6);
CCBottom.setRotationPoint(0F, 15F, 0F);
CCBottom.setTextureSize(128, 128);
CCBottom.mirror = true;
setRotation(CCBottom, 3.141593F, 0F, 0F);
CCRight = new ModelRenderer(this, 0, 0);
CCRight.addBox(-3F, -8F, -3F, 6, 2, 6);
CCRight.setRotationPoint(0F, 15F, 0F);
CCRight.setTextureSize(128, 128);
CCRight.mirror = true;
setRotation(CCRight, 0F, 0F, -1.570796F);
CCLeft = new ModelRenderer(this, 0, 0);
CCLeft.addBox(-3F, -8F, -3F, 6, 2, 6);
CCLeft.setRotationPoint(0F, 15F, 0F);
CCLeft.setTextureSize(128, 128);
CCLeft.mirror = true;
setRotation(CCLeft, 0F, 0F, 1.570796F);
CCFront = new ModelRenderer(this, 0, 0);
CCFront.addBox(-3F, -8F, -3F, 6, 2, 6);
CCFront.setRotationPoint(0F, 15F, 0F);
CCFront.setTextureSize(128, 128);
CCFront.mirror = true;
setRotation(CCFront, 1.570796F, 0F, 0F);
CCBack = new ModelRenderer(this, 0, 0);
CCBack.addBox(-3F, -8F, -3F, 6, 2, 6);
CCBack.setRotationPoint(0F, 15F, 0F);
CCBack.setTextureSize(128, 128);
CCBack.mirror = true;
setRotation(CCBack, -1.570796F, 0F, 0F);
CCTop = new ModelRenderer(this, 0, 0);
CCTop.addBox(-3F, -7F, -3F, 6, 1, 6);
CCTop.setRotationPoint(0F, 15F, 0F);
CCTop.setTextureSize(128, 128);
CCTop.mirror = true;
setRotation(CCTop, 0F, 0F, 0F);
}
public void renderMain(TileEntityLTank te ,float f5)
{
//render regardless of sides
Mid.render(f5);
Corner.render(f5);
Corner2.render(f5);
Corner3.render(f5);
Corner4.render(f5);
C8.render(f5);
C7.render(f5);
C6.render(f5);
C5.render(f5);
C4.render(f5);
C.render(f5);
C3.render(f5);
C2.render(f5);
CCTop.render(f5);CCBottom.render(f5);
//Front
if(te.cc[2] instanceof TileEntityPipe)
{
CCFront.render(f5);
}else
{
GuageT.render(f5);
GuageB.render(f5);
Guage.render(f5);
GuageR.render(f5);
GuageGlass.render(f5);
GuageL.render(f5);
}
//back
if(te.cc[3] instanceof TileEntityPipe)
{
CCBack.render(f5);
}else
{
GuageT3.render(f5);
Guage3.render(f5);
Guage3.render(f5);
GuageR3.render(f5);
GuageGlass3.render(f5);
GuageL3.render(f5);
}
//right
if(te.cc[4] instanceof TileEntityPipe)
{
CCRight.render(f5);
}else
{
GuageT4.render(f5);
Guage4.render(f5);
Guage4.render(f5);
GuageR4.render(f5);
GuageGlass4.render(f5);
GuageL4.render(f5);
}
//left
if(te.cc[5] instanceof TileEntityPipe)
{
CCLeft.render(f5);
}else
{
GuageT2.render(f5);
Guage2.render(f5);
Guage2.render(f5);
GuageR2.render(f5);
GuageGlass2.render(f5);
GuageL2.render(f5);
}
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,132 @@
package dark.BasicUtilities.renders;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelLiquidTankCorner extends ModelBase
{
//fields
ModelRenderer sOne;
ModelRenderer sTwo;
ModelRenderer d7;
ModelRenderer d5;
ModelRenderer d3;
ModelRenderer d4;
ModelRenderer d1;
ModelRenderer d6;
ModelRenderer d2;
ModelRenderer d8;
ModelRenderer d9;
ModelRenderer d10;
ModelRenderer face;
public ModelLiquidTankCorner()
{
textureWidth = 128;
textureHeight = 128;
sOne = new ModelRenderer(this, 0, 30);
sOne.addBox(-1F, 0F, -1F, 2, 16, 2);
sOne.setRotationPoint(-7F, 8F, 7F);
sOne.setTextureSize(128, 128);
sOne.mirror = true;
setRotation(sOne, 0F, 0F, 0F);
sTwo = new ModelRenderer(this, 0, 30);
sTwo.addBox(-1F, 0F, -1F, 2, 16, 2);
sTwo.setRotationPoint(-7F, 8F, -7F);
sTwo.setTextureSize(128, 128);
sTwo.mirror = true;
setRotation(sTwo, 0F, 0F, 0F);
d7 = new ModelRenderer(this, 43, 2);
d7.addBox(-1F, 0F, -1F, 2, 16, 12);
d7.setRotationPoint(-7F, 8F, -5F);
d7.setTextureSize(128, 128);
d7.mirror = true;
setRotation(d7, 0F, 0F, 0F);
d5 = new ModelRenderer(this, 9, 12);
d5.addBox(-1F, 0F, -1F, 14, 16, 2);
d5.setRotationPoint(-5F, 8F, 7F);
d5.setTextureSize(128, 128);
d5.mirror = true;
setRotation(d5, 0F, 0F, 0F);
d3 = new ModelRenderer(this, 9, 67);
d3.addBox(-1.5F, 0F, -1.3F, 20, 2, 2);
d3.setRotationPoint(-6F, 22F, -6F);
d3.setTextureSize(128, 128);
d3.mirror = true;
setRotation(d3, 0F, -0.7853982F, 0F);
d4 = new ModelRenderer(this, 9, 88);
d4.addBox(0F, 0F, -9F, 5, 2, 4);
d4.setRotationPoint(-6F, 22F, 6F);
d4.setTextureSize(128, 128);
d4.mirror = true;
setRotation(d4, 0F, 0F, 0F);
d1 = new ModelRenderer(this, 9, 67);
d1.addBox(-1.5F, 0F, -1.3F, 20, 2, 2);
d1.setRotationPoint(-6F, 8F, -6F);
d1.setTextureSize(128, 128);
d1.mirror = true;
setRotation(d1, 0F, -0.7853982F, 0F);
d6 = new ModelRenderer(this, 9, 75);
d6.addBox(-1.5F, 0F, -1.3F, 17, 2, 2);
d6.setRotationPoint(-6F, 22F, -4F);
d6.setTextureSize(128, 128);
d6.mirror = true;
setRotation(d6, 0F, -0.7853982F, 0F);
d2 = new ModelRenderer(this, 9, 80);
d2.addBox(0F, 0F, -5F, 9, 2, 5);
d2.setRotationPoint(-6F, 22F, 6F);
d2.setTextureSize(128, 128);
d2.mirror = true;
setRotation(d2, 0F, 0F, 0F);
d8 = new ModelRenderer(this, 9, 75);
d8.addBox(-1.5F, 0F, -1.3F, 17, 2, 2);
d8.setRotationPoint(-6F, 8F, -4F);
d8.setTextureSize(128, 128);
d8.mirror = true;
setRotation(d8, 0F, -0.7853982F, 0F);
d9 = new ModelRenderer(this, 9, 88);
d9.addBox(0F, 0F, -9F, 5, 2, 4);
d9.setRotationPoint(-6F, 8F, 6F);
d9.setTextureSize(128, 128);
d9.mirror = true;
setRotation(d9, 0F, 0F, 0F);
d10 = new ModelRenderer(this, 9, 80);
d10.addBox(0F, 0F, -5F, 9, 2, 5);
d10.setRotationPoint(-6F, 8F, 6F);
d10.setTextureSize(128, 128);
d10.mirror = true;
setRotation(d10, 0F, 0F, 0F);
face = new ModelRenderer(this, 0, 50);
face.addBox(-8.5F, 0F, 0F, 17, 14, 2);
face.setRotationPoint(0F, 9F, 0F);
face.setTextureSize(128, 128);
face.mirror = true;
setRotation(face, 0F, -0.7853982F, 0F);
}
public void render(float f5)
{
sOne.render(f5);
sTwo.render(f5);
d7.render(f5);
d5.render(f5);
d3.render(f5);
d4.render(f5);
d1.render(f5);
d6.render(f5);
d2.render(f5);
d8.render(f5);
d9.render(f5);
d10.render(f5);
face.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,93 @@
package dark.BasicUtilities.renders;
import net.minecraft.src.*;
public class ModelPipe extends ModelBase
{
//fields
ModelRenderer Middle;
ModelRenderer Right;
ModelRenderer Left;
ModelRenderer Back;
ModelRenderer Front;
ModelRenderer Top;
ModelRenderer Bottom;
public ModelPipe()
{
textureWidth = 64;
textureHeight = 32;
Middle = new ModelRenderer(this, 0, 0);
Middle.addBox(-1F, -1F, -1F, 4, 4, 4);
Middle.setRotationPoint(-1F, 15F, -1F);
Middle.setTextureSize(64, 32);
Middle.mirror = true;
setRotation(Middle, 0F, 0F, 0F);
Right = new ModelRenderer(this, 21, 0);
Right.addBox(0F, 0F, 0F, 6, 4, 4);
Right.setRotationPoint(2F, 14F, -2F);
Right.setTextureSize(64, 32);
Right.mirror = true;
setRotation(Right, 0F, 0F, 0F);
Left = new ModelRenderer(this, 21, 0);
Left.addBox(0F, 0F, 0F, 6, 4, 4);
Left.setRotationPoint(-8F, 14F, -2F);
Left.setTextureSize(64, 32);
Left.mirror = true;
setRotation(Left, 0F, 0F, 0F);
Back = new ModelRenderer(this, 0, 11);
Back.addBox(0F, 0F, 0F, 4, 4, 6);
Back.setRotationPoint(-2F, 14F, 2F);
Back.setTextureSize(64, 32);
Back.mirror = true;
setRotation(Back, 0F, 0F, 0F);
Front = new ModelRenderer(this, 0, 11);
Front.addBox(0F, 0F, 0F, 4, 4, 6);
Front.setRotationPoint(-2F, 14F, -8F);
Front.setTextureSize(64, 32);
Front.mirror = true;
setRotation(Front, 0F, 0F, 0F);
Top = new ModelRenderer(this, 21, 11);
Top.addBox(0F, 0F, 0F, 4, 6, 4);
Top.setRotationPoint(-2F, 8F, -2F);
Top.setTextureSize(64, 32);
Top.mirror = true;
setRotation(Top, 0F, 0F, 0F);
Bottom = new ModelRenderer(this, 21, 11);
Bottom.addBox(0F, 0F, 0F, 4, 6, 4);
Bottom.setRotationPoint(-2F, 18F, -2F);
Bottom.setTextureSize(64, 32);
Bottom.mirror = true;
setRotation(Bottom, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.renderMiddle();
this.renderBottom();
this.renderTop();
this.renderLeft();
this.renderRight();
this.renderBack();
this.renderFront();
}
public void renderMiddle() { Middle.render(0.0625F); }
public void renderBottom() { Bottom.render(0.0625F); }
public void renderTop() { Top.render(0.0625F); }
public void renderLeft() { Left.render(0.0625F); }
public void renderRight() { Right.render(0.0625F); }
public void renderBack() { Back.render(0.0625F); }
public void renderFront() { Front.render(0.0625F);}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,140 @@
// Date: 9/3/2012 6:12:15 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.BasicUtilities.renders;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelPump extends ModelBase
{
//fields
ModelRenderer Main;
ModelRenderer sidePort;
ModelRenderer FrontPort;
ModelRenderer pivit;
ModelRenderer crank;
ModelRenderer Rope;
ModelRenderer pivit2;
ModelRenderer Piston;
ModelRenderer pPlate;
ModelRenderer Rope2;
ModelRenderer BackPort;
public ModelPump()
{
textureWidth = 128;
textureHeight = 128;
Main = new ModelRenderer(this, 0, 0);
Main.addBox(-5F, 0F, -5F, 10, 13, 10);
Main.setRotationPoint(1F, 11F, 0F);
Main.setTextureSize(128, 128);
Main.mirror = true;
setRotation(Main, 0F, 0F, 0F);
sidePort = new ModelRenderer(this, 0, 76);
sidePort.addBox(-6F, -3F, -3F, 6, 6, 6);
sidePort.setRotationPoint(8F, 16F, 0F);
sidePort.setTextureSize(128, 128);
sidePort.mirror = true;
setRotation(sidePort, 0F, 0F, 0F);
FrontPort = new ModelRenderer(this, 0, 63);
FrontPort.addBox(-3F, -3F, 0F, 6, 6, 6);
FrontPort.setRotationPoint(0F, 16F, -8F);
FrontPort.setTextureSize(128, 128);
FrontPort.mirror = true;
setRotation(FrontPort, 0F, 0F, 0F);
pivit = new ModelRenderer(this, 0, 40);
pivit.addBox(-1F, 0F, -1F, 2, 3, 1);
pivit.setRotationPoint(0F, 8F, 1F);
pivit.setTextureSize(128, 128);
pivit.mirror = true;
setRotation(pivit, 0F, 0F, 0F);
crank = new ModelRenderer(this, 48, 0);
crank.addBox(-8F, 0F, -1F, 14, 2, 1);
crank.setRotationPoint(0F, 7F, 0F);
crank.setTextureSize(128, 128);
crank.mirror = true;
setRotation(crank, 0F, 0F, 0F);
Rope = new ModelRenderer(this, 0, 28);
Rope.addBox(0F, 0F, 0F, 1, 7, 1);
Rope.setRotationPoint(4F, 8F, -1F);
Rope.setTextureSize(128, 128);
Rope.mirror = true;
setRotation(Rope, 0F, 0F, 0F);
pivit2 = new ModelRenderer(this, 0, 40);
pivit2.addBox(-1F, 0F, -1F, 2, 3, 1);
pivit2.setRotationPoint(0F, 8F, -1F);
pivit2.setTextureSize(128, 128);
pivit2.mirror = true;
setRotation(pivit2, 0F, 0F, 0F);
pPlate = new ModelRenderer(this, 34, 30);
pPlate.addBox(0F, 0F, 0F, 1, 12, 1);
pPlate.setRotationPoint(-5F, 12F, -1F);
pPlate.setTextureSize(128, 128);
pPlate.mirror = true;
setRotation(pPlate, 0F, 0F, 0F);
Piston = new ModelRenderer(this, 20, 30);
Piston.addBox(0F, 0F, 0F, 3, 12, 3);
Piston.setRotationPoint(-8F, 12F, -2F);
Piston.setTextureSize(128, 128);
Piston.mirror = true;
setRotation(Piston, 0F, 0F, 0F);
Rope2 = new ModelRenderer(this, 0, 28);
Rope2.addBox(0F, 0F, 0F, 1, 7, 1);
Rope2.setRotationPoint(-7F, 8F, -1F);
Rope2.setTextureSize(128, 128);
Rope2.mirror = true;
setRotation(Rope2, 0F, 0F, 0F);
BackPort = new ModelRenderer(this, 0, 50);
BackPort.addBox(-3F, -3F, -6F, 6, 6, 6);
BackPort.setRotationPoint(0F, 16F, 8F);
BackPort.setTextureSize(128, 128);
BackPort.mirror = true;
setRotation(BackPort, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
public void renderMain(float f5)
{
Main.render(f5);
pivit.render(f5);
crank.render(f5);
Rope.render(f5);
pivit2.render(f5);
Piston.render(f5);
pPlate.render(f5);
Rope2.render(f5);
}
public void renderC1(float f5)
{
sidePort.render(f5);
}
public void renderC2(float f5)
{
FrontPort.render(f5);
}
public void renderC3(float f5)
{
BackPort.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,44 @@
package dark.BasicUtilities.renders;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import dark.BasicUtilities.mechanical.TileEntityRod;
public class RenderGearRod extends TileEntitySpecialRenderer
{
private ModelGearRod model;
public RenderGearRod()
{
model = new ModelGearRod();
}
public void renderAModelAt(TileEntityRod tileEntity, double d, double d1, double d2, float f)
{
bindTextureByName("/textures/GearRod.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
switch(meta)
{
case 0: GL11.glRotatef(90f, 1f, 0f, 0f);break;
case 1: GL11.glRotatef(-90f, 1f, 0f, 0f);break;
case 2:GL11.glRotatef(0f, 0f, 1f, 0f);break;
case 5:GL11.glRotatef(90f, 0f, 1f, 0f);break;
case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break;
case 4:GL11.glRotatef(270f, 0f, 1f, 0f);break;
}
model.render(0.0625F,tileEntity.pos);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
this.renderAModelAt((TileEntityRod)tileEntity, var2, var4, var6, var8);
}
}

View file

@ -0,0 +1,65 @@
package dark.BasicUtilities.renders;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.api.MHelper;
import dark.BasicUtilities.tanks.TileEntityLTank;
public class RenderLTank extends TileEntitySpecialRenderer
{
private Liquid type = Liquid.DEFUALT;
private ModelLiquidTank model;
private ModelLiquidTankCorner modelC;
private int pos = 0;
public RenderLTank()
{
model = new ModelLiquidTank();
modelC = new ModelLiquidTankCorner();
}
public void renderAModelAt(TileEntityLTank te, double d, double d1, double d2, float f)
{
type = te.getType();
pos = Math.min(te.getStoredLiquid(type),4);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if(MHelper.corner(te) > 0)
{
bindTextureByName(BasicUtilitiesMain.textureFile+"tanks/LiquidTankCorner.png");
int corner = MHelper.corner(te);
switch(corner)
{
case 2: GL11.glRotatef(270f, 0f, 1f, 0f);break;
case 3: GL11.glRotatef(0f, 0f, 1f, 0f);break;
case 4: GL11.glRotatef(90f, 0f, 1f, 0f);break;
case 1: GL11.glRotatef(180f, 0f, 1f, 0f);break;
}
modelC.render(0.0625F);
}
else
{
switch(type.ordinal())
{
//case 0: bindTextureByName(BasicPipesMain.textureFile+"/pipes/SixSteamPipe.png");break;
default:bindTextureByName(BasicUtilitiesMain.textureFile+"tanks/LiquidTank"+pos+".png"); break;
}
model.renderMain(te, 0.0625F);
}
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
this.renderAModelAt((TileEntityLTank)tileEntity, var2, var4, var6, var8);
}
}

View file

@ -0,0 +1,63 @@
package dark.BasicUtilities.renders;
import net.minecraft.src.ModelBase;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.pipes.TileEntityPipe;
public class RenderPipe extends TileEntitySpecialRenderer
{
Liquid type;
int size = 6;
private ModelPipe fourPipe;
private ModelLargePipe SixPipe;
private ModelBase model = fourPipe;
public RenderPipe()
{
fourPipe = new ModelPipe();
SixPipe = new ModelLargePipe();
}
public void renderAModelAt(TileEntityPipe tileEntity, double d, double d1, double d2, float f)
{
//Texture file
type = tileEntity.getType();
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
switch(type.ordinal())
{
case 0: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixSteamPipe.png");break;
case 1: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixWaterPipe.png");break;
case 2: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixLavaPipe.png");break;
case 3: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixOilPipe.png");break;
default:bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/DefaultPipe.png"); break;
}
if(tileEntity.connectedBlocks[0] != null) SixPipe.renderBottom();
if(tileEntity.connectedBlocks[1] != null) SixPipe.renderTop();
if(tileEntity.connectedBlocks[3] != null) SixPipe.renderFront();
if(tileEntity.connectedBlocks[2] != null) SixPipe.renderBack();
if(tileEntity.connectedBlocks[5] != null) SixPipe.renderRight();
if(tileEntity.connectedBlocks[4] != null) SixPipe.renderLeft();
SixPipe.renderMiddle();
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
this.renderAModelAt((TileEntityPipe)tileEntity, var2, var4, var6, var8);
}
}

View file

@ -0,0 +1,58 @@
package dark.BasicUtilities.renders;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.machines.TileEntityPump;
public class RenderPump extends TileEntitySpecialRenderer
{
int type = 0;
private ModelPump model;
public RenderPump()
{
model = new ModelPump();
}
public void renderAModelAt(TileEntityPump tileEntity, double d, double d1, double d2, float f)
{
Liquid type = tileEntity.type;
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
switch(type.ordinal())
{
default: bindTextureByName(BasicUtilitiesMain.textureFile+"pumps/Pump.png");break;
case 1:bindTextureByName(BasicUtilitiesMain.textureFile+"pumps/WaterPump.png");break;//water
case 2:bindTextureByName(BasicUtilitiesMain.textureFile+"pumps/LavaPump.png");break;//lava
case 3:bindTextureByName(BasicUtilitiesMain.textureFile+"pumps/OilPump.png");break;//oil
//case 4://fuel
}
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
switch(meta)
{
case 1:GL11.glRotatef(0f, 0f, 1f, 0f);break;
case 2:GL11.glRotatef(90f, 0f, 1f, 0f);break;
case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break;
case 0:GL11.glRotatef(270f, 0f, 1f, 0f);break;
}
model.renderMain(0.0625F);
model.renderC1(0.0625F);
model.renderC2(0.0625F);
model.renderC3(0.0625F);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
this.renderAModelAt((TileEntityPump)tileEntity, var2, var4, var6, var8);
}
}

View file

@ -0,0 +1,128 @@
package dark.BasicUtilities.tanks;
import java.util.List;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.Liquid;
public class ItemTank extends Item
{
int index = 64;//64 + 2 rows alloted to pipes
private int spawnID;
public ItemTank(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("tank");
this.setCreativeTab(CreativeTabs.tabRedstone);
}
@Override
public int getIconFromDamage(int par1)
{
return par1+index;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return itemstack.getItemDamage() < Liquid.values().length ? Liquid.getLiquid(itemstack.getItemDamage()).lName+" Tank" : "unknown";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i = 0; i < Liquid.values().length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
public String getTextureFile() {
return BasicUtilitiesMain.ITEM_PNG;
}
@Override
public String getItemName()
{
return "Pipes";
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
int blockID = par3World.getBlockId(par4, par5, par6);
spawnID = BasicUtilitiesMain.machine.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 (BasicUtilitiesMain.pipe.canPlaceBlockAt(par3World,par4,par5,par6))
{
Block var9 = Block.blocksList[this.spawnID];
par3World.editingBlocks = true;
if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, var9.blockID,5))
{
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, par2EntityPlayer);
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
if(blockEntity instanceof TileEntityLTank)
{
TileEntityLTank pipeEntity = (TileEntityLTank) blockEntity;
Liquid dm = Liquid.getLiquid(par1ItemStack.getItemDamage());
pipeEntity.setType(dm);
}
}
--par1ItemStack.stackSize;
par3World.editingBlocks = false;
return true;
}
}
par3World.editingBlocks = false;
return false;
}
}

View file

@ -0,0 +1,211 @@
package dark.BasicUtilities.tanks;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.Vector3;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.ILiquidProducer;
import dark.BasicUtilities.api.IStorageTank;
import dark.BasicUtilities.api.Liquid;
import dark.BasicUtilities.api.MHelper;
public class TileEntityLTank extends TileEntity implements IStorageTank,ILiquidProducer,IPacketReceiver{
public TileEntity[] cc = {null,null,null,null,null,null};
public Liquid type = Liquid.DEFUALT;
public int LStored = 0;
public int pLStored = 0;
public int LMax = 4;
private int count = 0;
private int count2 = 0;
private boolean firstUpdate = true;
public void updateEntity()
{
if(++count >= 5)
{
count = 0;
this.cc = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
if(!worldObj.isRemote)
{
MHelper.shareLiquid(worldObj,xCoord, yCoord, zCoord,this.LStored,this.getLiquidCapacity(type), type);
if(firstUpdate ||(this.LStored != pLStored)|| count2 >= 100)
{
count2 = 0;
firstUpdate = false;
Packet packet = PacketManager.getPacket(BasicUtilitiesMain.CHANNEL, this, new Object[]{type.ordinal(),LStored});
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 20);
}
this.pLStored = this.LStored;
}
}
}
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
nbt.setInteger("Vol", this.LStored);
nbt.setInteger("type", this.type.ordinal());
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
this.LStored = nbt.getInteger("Vol");
this.type = Liquid.getLiquid(nbt.getInteger("type"));
}
//--------------------
//Liquid stuff
//------------------------------------
@Override
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side)
{
if(type == this.type)
{
if(this.LStored < this.getLiquidCapacity(this.type))
{
int rejectedVolume = Math.max((this.getStoredLiquid(type) + vol) - this.LMax, 0);
this.LStored = Math.min(Math.max((LStored + vol - rejectedVolume),0),this.LMax);
return rejectedVolume;
}else
{
TileEntity te = null;
if(this.type.isGas)
{
worldObj.getBlockTileEntity(xCoord, yCoord+1, zCoord);
}else
{
worldObj.getBlockTileEntity(xCoord, yCoord-1, zCoord);
}
if( te instanceof IStorageTank)
{
return ((IStorageTank)te).onReceiveLiquid(type, vol, ForgeDirection.UNKNOWN);
}
}
}
return vol;
}
@Override
public boolean canRecieveLiquid(Liquid type, ForgeDirection side) {
if(type == this.type)
{
if(this.type.isGas && side == ForgeDirection.UP)
{
return false;
}
if(!this.type.isGas && side == ForgeDirection.DOWN)
{
return false;
}
return true;
}
return false;
}
@Override
public int getStoredLiquid(Liquid type) {
if(type == this.type)
{
return LStored;
}
return 0;
}
@Override
public int getLiquidCapacity(Liquid type) {
if(type == this.type)
{
return LMax;
}
return 0;
}
public Liquid getType() {
// TODO Auto-generated method stub
return type;
}
@Override
public int onProduceLiquid(Liquid type, int vol, ForgeDirection side) {
if(type == this.type && this.LStored > 1 && vol > 0)
{
//TODO correct / do math for
LStored--;
return 1;
}
return 0;
}
@Override
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == this.type)
{
if(this.type.isGas && side == ForgeDirection.UP)
{
return true;
}
if(!this.type.isGas && side == ForgeDirection.DOWN)
{
return true;
}
}
return false;
}
@Override
public boolean canProducePresure(Liquid type, ForgeDirection side) {
if(type == this.type)
{
if(this.type.isGas && side == ForgeDirection.DOWN)
{
return true;
}
if(!this.type.isGas && side == ForgeDirection.UP)
{
return true;
}
}
return false;
}
@Override
public int presureOutput(Liquid type, ForgeDirection side) {
if(type == this.type)
{
return this.type.defaultPresure;
}
return 0;
}
@Override
public void handlePacketData(INetworkManager network, int packetType,
Packet250CustomPayload packet, EntityPlayer player,
ByteArrayDataInput data) {
try
{
this.type = Liquid.getLiquid(data.readInt());
this.LStored = data.readInt();
}catch(Exception e)
{
e.printStackTrace();
System.out.print("Fail reading data for Storage tank \n");
}
}
public void setType(Liquid dm) {
this.type = dm;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB