• 2

    posted a message on [1.7.10]Minecraft Forge Modding Tutorials! - Now with Custom Fluid Tank Tutorial and Structure Generation!
    Greetings! I am HyperElectron. I decided that learning to make Minecraft Forge mods were hard by myself. I didnt understand anything. Now I have tons of knowledge I want to share with you guys. So far I've done all the beginner tutorials, and working on doing the intermediate ones. To read my tutorials, visit my website here. Hope all of you will learn alot from my tutorials :)

    Tutorials on website:
    Setting up forge and eclipse
    Basic Block
    Basic Item
    Custom crafting, smelting and ore dictionary recipes
    Creative Tab
    Ore generation
    Structure Generation

    Fluid Tank tutorial (post below) Fluid tank is up and running, the tile entity is now there.

    Want any new tutorials or having some problems? Comment below or email me (contact on website).
    http://septoxel.wix.com/forgingmc
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on Pipes not inputting
    Hello, I've been hard at work for the last week developing pipes. I have almost successfully done so except they do not input from adjacent tanks. And to be honest I have no idea why, that's why I've turned to you guys for help in the hope I can be lead into the right direction. Thank you in advanced.



    The Pipe's Tile Entity:

     
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Set;
    
    import ryan.mod.utils.BlockCoords;
    import ryan.mod.utils.FluidUtils;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.NetworkManager;
    import net.minecraft.network.Packet;
    import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraftforge.common.util.ForgeDirection;
    import net.minecraftforge.fluids.Fluid;
    import net.minecraftforge.fluids.FluidStack;
    import net.minecraftforge.fluids.FluidTank;
    import net.minecraftforge.fluids.FluidTankInfo;
    import net.minecraftforge.fluids.IFluidHandler;
    
    public class TileEntityBasicPipe extends TileEntity implements IFluidHandler{
    
    public FluidTank tank = new FluidTank(1000);
     public boolean needsUpdate = false;
     private int updateTimer = 0;
     public ForgeDirection lastProvider;
     public ArrayList<ForgeDirection> validOutputs = new ArrayList();
     public HashMap<ForgeDirection, FluidTank> subTanks = new HashMap();
     public ForgeDirection lastProvidie;
    
    
     public TileEntityBasicPipe() {
     
     
     lastProvider = ForgeDirection.UNKNOWN;
     lastProvidie = ForgeDirection.UNKNOWN;
     
     validOutputs.add(ForgeDirection.DOWN);
     validOutputs.add(ForgeDirection.EAST);
     validOutputs.add(ForgeDirection.NORTH);
     validOutputs.add(ForgeDirection.SOUTH);
     validOutputs.add(ForgeDirection.UP);
     validOutputs.add(ForgeDirection.WEST);
     
     subTanks.put(ForgeDirection.UP, new FluidTank(100));
     subTanks.put(ForgeDirection.DOWN, new FluidTank(100));
     subTanks.put(ForgeDirection.NORTH, new FluidTank(100));
     subTanks.put(ForgeDirection.SOUTH, new FluidTank(100));
     subTanks.put(ForgeDirection.EAST, new FluidTank(100));
     subTanks.put(ForgeDirection.WEST, new FluidTank(100));
     
     }
     
     
     
     public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
     {
     needsUpdate = true;
     if(doFill)
     {
     
     lastProvider = from;
     }
     for(ForgeDirection dire : validOutputs){
     if(from == dire)
     {
     return this.subTanks.get(from).fill(resource, doFill);
     
     }
     else
     {
     return this.tank.fill(resource, doFill);
     }
     }
     
     return 0;
     }
     
     public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
     {
     if(doDrain)
     {
     lastProvidie = from;
     }
     
     if(resource != null && !resource.isFluidEqual(tank.getFluid())){
     
     return null;
     }
     
     return this.tank.drain(resource.amount, doDrain);
     }
     
     public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
     {
     if(doDrain)
     {
     lastProvidie = from;
     }
     
     
     return this.subTanks.get(from).drain(maxDrain, doDrain);
     
     
    }
     
     public boolean canFill(ForgeDirection from, Fluid fluid)
     {
     return true;
     }
     
     public boolean canDrain(ForgeDirection from, Fluid fluid)
     {
     return true;
     }
     
     public FluidTankInfo[] getTankInfo(ForgeDirection from)
     {
     return new FluidTankInfo[] {this.tank.getInfo()};
     }
     
     public float getAdjustedVolume()
     {
     float amount = tank.getFluidAmount();
     float capacity = tank.getCapacity();
     float volume = (amount/capacity)*0.8F; 
     return volume;
     }
     
     
     
     
     public void updateEntity() 
     {
     needsUpdate = true;
     if (needsUpdate) 
     {
     if (updateTimer == 0) 
     { 
     updateTimer = 16; // every 10 tick(s) it will send an update
     } 
     else 
     { 
     --updateTimer;
     if (updateTimer == 0) 
     { 
     //drainFromTanks();
     distrubeLiquids();
     outputLiquids();
     worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
     needsUpdate = false;
     }
     }
     }
     }
     
     @Override
     public void readFromNBT(NBTTagCompound tag)
     {
     super.readFromNBT(tag);
     tank.readFromNBT(tag);
     }
    
    @Override
     public void writeToNBT(NBTTagCompound tag)
     {
     super.writeToNBT(tag);
     tank.writeToNBT(tag);
     
     
     }
     
     @Override
     public Packet getDescriptionPacket()
     {
     NBTTagCompound tag = new NBTTagCompound();
     writeToNBT(tag);
     return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag);
     }
    
    @Override
     public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
     {
     NBTTagCompound tag = pkt.func_148857_g();
     readFromNBT(tag);
     }
    
    public void changeOutputs(){
     
     
     for(ForgeDirection dire : ForgeDirection.VALID_DIRECTIONS){
     TileEntity tile = this.worldObj.getTileEntity(xCoord + dire.offsetX, yCoord + dire.offsetY, zCoord + dire.offsetZ);
     if(tile != null && tile instanceof IFluidHandler){
     validOutputs.clear();
     validOutputs.add(dire);
     
     
     
     }
     
     }
     
     
     }
     
     public ForgeDirection getForgeDirection(ForgeDirection dire, Fluid fluid){
     return canFill(dire, fluid) ? dire.getOpposite() : ForgeDirection.UNKNOWN;
     }
    
    
     
     public void drainFromTanks(){
     Set<ForgeDirection> connections = this.getOutputs().keySet();
     Fluid f = tank.getFluid() == null ? null : tank.getFluid().getFluid();
     for (ForgeDirection dir : connections) {
    
    IFluidHandler extTank = FluidUtils.getExternalTanks(worldObj, new BlockCoords(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ));
     if(extTank != null) {
    
    boolean foundFluid = false;
     FluidTankInfo[] info = extTank.getTankInfo(dir.getOpposite());
     if(info != null) {
     for (FluidTankInfo inf : info) {
     if(inf != null && inf.fluid != null && inf.fluid.amount > 0) {
     foundFluid = true;
     }
     }
     }
     if(!foundFluid) {
     return;
     }
     FluidStack couldDrain = extTank.drain(dir, 100, false);
     if(couldDrain != null && couldDrain.amount > 0 && canFill(dir, couldDrain.getFluid()))
     {
     int used = fill(dir.getOpposite(), couldDrain, false);
     if(used > 0)
     used = extTank.drain(dir, 100, true).amount;
     
     couldDrain.amount = used;
     used = fill(dir, couldDrain, true);
     
     
     }
     }
     }
     }
     
     
     
     
     
     
     
     
    
    public synchronized void distrubeLiquids() {
     Set<ForgeDirection> connected = this.getOutputs().keySet();
    
    
     if (connected.contains(lastProvider))
     connected.remove(lastProvider);
    
    int output = Math.min(tank.getFluidAmount(), 100);
     int connectedAmount = connected.size();
     if (connectedAmount < 1)
     connectedAmount = 1;
     int scaledAmount = output / connectedAmount;
    
    for (ForgeDirection dirOut : connected)
     {
     if (this.tank.getFluid() == null)
     break;
    
    /* DEBUG
     debugLog.add("Moving to "+dirOut+"ern SubTank");
     */
     FluidStack tempFS = new FluidStack(tank.getFluid().getFluid(), scaledAmount);
     int fit = subTanks.get(dirOut).fill(tempFS, false);
     /* DEBUG
     debugLog.add("SubTank will accept "+fit+"mb");
     */
     if (fit > 0)
     fit = tank.drain(fit, true).amount;
     /* DEBUG
     debugLog.add("Internal Tank was drained by "+fit+"mb");
     */
     tempFS.amount = fit;
     fit = subTanks.get(dirOut).fill(tempFS, true);
     /* DEBUG
     debugLog.add("SubTank was filled by "+fit+"mb");
     if(fit > 0)
     printDebugLog = true;
     debugLog.add("Internal Tank now contains: "+internalTank.getFluidAmount()+"mb");
     debugLog.add("SubTank now contains: "+subTanks.get(dirOut).getFluidAmount()+"mb");
     */
     
     }
     /* DEBUG
     if(printDebugLog)
     {
     for(String s: debugLog)
     System.out.println(s);
     debugLog.clear();
     }
     printDebugLog = false;
     */
    
    //Get Fluid from most recent InputTank
     FluidTank inputTank = subTanks.get(lastProvider);
     if (inputTank != null && inputTank.getFluid() != null) //Tank can be null if input was received from top
     {
     /* DEBUG
     debugLog.add("Importing from "+lastProvider+"ern SubTank");
     */
     FluidStack tempFS = new FluidStack(inputTank.getFluid().getFluid(), Math.min(inputTank.getFluidAmount(), 100));
     int fit = tank.fill(tempFS, false);
     /* DEBUG
     debugLog.add("Internal Tank will accept "+fit+"mb");
     */
     if (fit > 0)
     fit = inputTank.drain(fit, true).amount;
     /* DEBUG
     debugLog.add("Import Tank was drained by "+fit+"mb");
     */
     tempFS.amount = fit;
     fit = tank.fill(tempFS, true);
     
     markForUpdate();
     }
     
     
     }
     
     public synchronized void outputLiquids() {
     
     HashMap<ForgeDirection, TileEntity> connected = this.getOutputs();
     if(connected.containsKey(lastProvider)){
     connected.remove(lastProvider);
     }
     
     
     
     if(connected.size() != 0)
     {
     for(ForgeDirection dire : connected.keySet())
     {
     if(subTanks.get(dire) != null && subTanks.get(dire).getFluid() != null){
     
     FluidStack fluid = new FluidStack(subTanks.get(dire).getFluid().getFluid(), Math.min(subTanks.get(dire).getFluidAmount(), 100));
     int fit = ((IFluidHandler)connected.get(dire)).fill(dire.getOpposite(), fluid, false);
     if(fit > 0)
     
     fit = this.drain(dire, fit, true).amount;
     
     fluid.amount = fit;
     fit = ((IFluidHandler)connected.get(dire)).fill(dire.getOpposite(), fluid, true);
     
     
     }
     
     
     }
     
     }
     
     
     }
     
     public void markForUpdate(){
     
     this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
     
     }
    
    
     public HashMap<ForgeDirection, TileEntity> getOutputs() {
     HashMap<ForgeDirection, TileEntity> map = new HashMap();
     for(ForgeDirection dire : validOutputs){
     TileEntity tile = this.worldObj.getTileEntity(xCoord + dire.offsetX, yCoord + dire.offsetY, zCoord + dire.offsetZ);
     if(tile != null && tile instanceof IFluidHandler){
     map.put(dire, tile);
     //System.out.println("Tank at: " + dire);
     }
     
     }
     return map;
     
     }
    
     
    
    
     
     
     
     
     
     
    }
    
    



    Thanks again!

    Posted in: Modification Development
  • 0

    posted a message on Auga Tech - Now with liquids!
    Welcome to Auga Tech!



    Firstly, you may be thinking, what does "Auga" mean? If not, you're wondering what is mod is about and what it can do for you.

    Note: This mod is still a work in progress, more things are coming and bugs will be fixed.

    Now to the mod!

    Auga tech is all about liquids. What makes Auga Tech so different to other technology based mods is that the machines require no power! The machines all run on liquids. The machines will use 'fuel liquid' to run (of course you cant use any old liquid!) To create these fuels to start off with, you'll have to use a fuel mixer. Using a solid catalyst with a certain liquid sill create a certain fuel. Example: Coal and water. No batteries included, only tanks! Now what everyone has been waiting for: the screeshots.

    Sceenshots:

    See attachments


    What this mod will be able to do is limitless. We've got plans for ore processing, mob spawning, liquid pumping, farm automation and much more!

    All suggestions welcome!

    Authours:

    Code: Minecraftthing

    Textures and models: PineappleNinja87
    Posted in: WIP Mods
  • 0

    posted a message on Help with Custom Fluid Tank
    I figured out the issue, the BasicTank block did not extend Block Container. Thanks for your help though!
    Posted in: Modification Development
  • 0

    posted a message on Help with Custom Fluid Tank
    The issue with that method seems to be the 'fill' method, when I look through the fill method in the tile entity, I cant find anything that could be pointing null.

    onBlockActivated Method

     @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
    
    ItemStack stack = player.inventory.getCurrentItem();
    if (stack != null) {
    
    FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);
    TileEntityBasicTank tank = (TileEntityBasicTank) world.getTileEntity(x, y, z);
    
    if (liquid != null) {
    
    int amount = tank.fill(ForgeDirection.UNKNOWN, liquid, false);
    
    if (amount == liquid.amount) {
    
    tank.fill(ForgeDirection.UNKNOWN, liquid, true);
    if (!player.capabilities.isCreativeMode)
    player.inventory.setInventorySlotContents(player.inventory.currentItem, Utilities.useItemSafely(stack));
    
    return true;
    }
    
    else
    return true;
    }
    
    else if (FluidContainerRegistry.isBucket(stack)) {
    
    FluidTankInfo[] tanks = tank.getTankInfo(ForgeDirection.UNKNOWN);
    
    if (tanks[0] != null) {
    
    FluidStack fillFluid = tanks[0].fluid;
    ItemStack fillStack = FluidContainerRegistry.fillFluidContainer(fillFluid, stack);
    
    if (fillStack != null) {
    
    tank.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.getFluidForFilledItem(fillStack).amount, true);
    
    if (!player.capabilities.isCreativeMode) {
    
    if (stack.stackSize == 1)
    player.inventory.setInventorySlotContents(player.inventory.currentItem, fillStack);
    
    else {
    player.inventory.setInventorySlotContents(player.inventory.currentItem, Utilities.useItemSafely(stack));
    
    if (!player.inventory.addItemStackToInventory(fillStack))
    player.dropPlayerItemWithRandomChoice(fillStack, false);
    }
    }
    return true;
    }
    
    else
    return true;
    }
    }
    }
    
    return false;
    }

    Line 110:
     int amount = tank.fill(ForgeDirection.UNKNOWN, liquid, false); 
    Posted in: Modification Development
  • 0

    posted a message on Help with Custom Fluid Tank
    Hello,

    I recently got back into modding and I've being looking into making my own custom fluid tank. I was teaching myself how to do it using GYTH on GitHub, but Im not sure if missed anything or if I did something wrong.



    [22:42:23] [Client thread/FATAL]: Unreported exception thrown!
    java.lang.NullPointerException
    at ryan.mod.blocks.BasicTank.onBlockActivated(BasicTank.java:127) ~[BasicTank.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376) ~[PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2033) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
    at GradleStart.main(GradleStart.java:45) [start/:?]
    [22:42:23] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
    // My bad.

    Time: 16/01/15 10:42 PM
    Description: Unexpected error

    java.lang.NullPointerException: Unexpected error
    at ryan.mod.blocks.BasicTank.onBlockActivated(BasicTank.java:127)
    at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2033)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028)
    at net.minecraft.client.Minecraft.run(Minecraft.java:951)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
    at GradleStart.main(GradleStart.java:45)


    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------

    -- Head --
    Stacktrace:
    at ryan.mod.blocks.BasicTank.onBlockActivated(BasicTank.java:127)
    at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518)

    -- Affected level --
    Details:
    Level name: MpServer
    All players: 1 total; [EntityClientPlayerMP['Player484'/234, l='MpServer', x=-2078.41, y=6.62, z=666.26]]
    Chunk stats: MultiplayerChunkCache: 289, 289
    Level seed: 0
    Level generator: ID 01 - flat, ver 0. Features enabled: false
    Level generator options:
    Level spawn location: World: (-2081,4,654), Chunk: (at 15,0,14 in -131,40; contains blocks -2096,0,640 to -2081,255,655), Region: (-5,1; contains chunks -160,32 to -129,63, blocks -2560,0,512 to -2049,255,1023)
    Level time: 12656 game time, 4144 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 82 total; [EntitySlime['Slime'/137, l='MpServer', x=-2013.46, y=4.47, z=596.53], EntitySlime['Slime'/20333, l='MpServer', x=-2143.03, y=4.00, z=717.28], EntitySlime['Slime'/139, l='MpServer', x=-2024.50, y=4.00, z=639.06], EntitySlime['Slime'/138, l='MpServer', x=-2014.60, y=4.00, z=646.89], EntitySlime['Slime'/141, l='MpServer', x=-2021.11, y=4.00, z=649.07], EntitySlime['Slime'/140, l='MpServer', x=-2006.13, y=4.47, z=674.52], EntityClientPlayerMP['Player484'/234, l='MpServer', x=-2078.41, y=6.62, z=666.26], EntityChicken['Chicken'/143, l='MpServer', x=-2015.56, y=4.00, z=708.59], EntitySlime['Slime'/142, l='MpServer', x=-2042.02, y=4.00, z=687.98], EntityChicken['Chicken'/131, l='MpServer', x=-2029.56, y=4.00, z=596.38], EntitySheep['Sheep'/133, l='MpServer', x=-2016.78, y=4.00, z=604.78], EntityChicken['Chicken'/132, l='MpServer', x=-2018.69, y=4.00, z=603.63], EntitySheep['Sheep'/135, l='MpServer', x=-2016.53, y=4.00, z=592.03], EntitySheep['Sheep'/134, l='MpServer', x=-2031.97, y=4.00, z=600.09], EntitySheep['Sheep'/157, l='MpServer', x=-2002.78, y=4.00, z=584.22], EntitySheep['Sheep'/158, l='MpServer', x=-2009.97, y=4.00, z=590.94], EntitySlime['Slime'/144, l='MpServer', x=-2011.86, y=4.00, z=720.50], EntitySlime['Slime'/145, l='MpServer', x=-2021.26, y=4.00, z=746.26], EntitySlime['Slime'/147, l='MpServer', x=-2027.59, y=4.00, z=744.38], EntitySlime['Slime'/32, l='MpServer', x=-2152.31, y=4.95, z=739.10], EntityPig['Pig'/39, l='MpServer', x=-2142.09, y=4.00, z=601.78], EntitySlime['Slime'/36, l='MpServer', x=-2152.97, y=4.00, z=597.32], EntityCow['Cow'/42, l='MpServer', x=-2128.34, y=4.00, z=609.50], EntitySlime['Slime'/52346, l='MpServer', x=-2138.94, y=4.00, z=647.78], EntityCow['Cow'/43, l='MpServer', x=-2139.38, y=4.00, z=625.53], EntitySlime['Slime'/162, l='MpServer', x=-2008.66, y=5.01, z=686.77], EntityChicken['Chicken'/161, l='MpServer', x=-2002.53, y=4.00, z=607.66], EntityCow['Cow'/40, l='MpServer', x=-2138.09, y=4.00, z=597.84], EntitySlime['Slime'/46, l='MpServer', x=-2144.41, y=4.47, z=707.77], EntitySlime['Slime'/167, l='MpServer', x=-2005.63, y=5.00, z=697.74], EntitySlime['Slime'/47, l='MpServer', x=-2153.52, y=4.00, z=716.63], EntitySlime['Slime'/166, l='MpServer', x=-2005.90, y=4.69, z=695.33], EntityCow['Cow'/44, l='MpServer', x=-2128.41, y=4.00, z=628.69], EntitySlime['Slime'/165, l='MpServer', x=-2018.40, y=4.00, z=723.73], EntityPig['Pig'/45, l='MpServer', x=-2140.38, y=4.00, z=645.78], EntityCow['Cow'/51, l='MpServer', x=-2119.50, y=4.00, z=616.78], EntitySlime['Slime'/50, l='MpServer', x=-2124.03, y=4.00, z=593.96], EntitySlime['Slime'/48, l='MpServer', x=-2142.21, y=4.00, z=733.11], EntitySlime['Slime'/55, l='MpServer', x=-2100.45, y=4.95, z=647.80], EntityCow['Cow'/54, l='MpServer', x=-2124.97, y=4.00, z=642.13], EntitySlime['Slime'/53, l='MpServer', x=-2107.49, y=4.00, z=637.63], EntityPig['Pig'/52, l='MpServer', x=-2129.38, y=4.00, z=616.22], EntitySlime['Slime'/59, l='MpServer', x=-2110.53, y=4.00, z=732.97], EntitySlime['Slime'/58, l='MpServer', x=-2112.77, y=4.00, z=678.48], EntityChicken['Chicken'/57, l='MpServer', x=-2114.06, y=4.00, z=662.34], EntitySlime['Slime'/56, l='MpServer', x=-2127.25, y=4.00, z=644.25], EntityCow['Cow'/63, l='MpServer', x=-2108.50, y=4.00, z=622.34], EntitySlime['Slime'/183, l='MpServer', x=-2010.03, y=4.00, z=668.66], EntityCow['Cow'/62, l='MpServer', x=-2111.97, y=4.00, z=609.06], EntityPig['Pig'/61, l='MpServer', x=-2104.57, y=4.00, z=612.03], EntitySlime['Slime'/60327, l='MpServer', x=-2005.94, y=4.81, z=707.05], EntitySlime['Slime'/64, l='MpServer', x=-2113.72, y=4.00, z=625.53], EntitySlime['Slime'/65, l='MpServer', x=-2110.38, y=4.00, z=691.78], EntitySlime['Slime'/66, l='MpServer', x=-2102.06, y=4.00, z=683.44], EntitySlime['Slime'/76, l='MpServer', x=-2105.09, y=4.00, z=705.59], EntitySlime['Slime'/77, l='MpServer', x=-2098.98, y=4.95, z=737.23], EntitySlime['Slime'/73, l='MpServer', x=-2080.31, y=4.00, z=589.53], EntitySlime['Slime'/75, l='MpServer', x=-2103.15, y=4.00, z=612.51], EntitySlime['Slime'/19863, l='MpServer', x=-2014.63, y=4.00, z=713.41], EntityChicken['Chicken'/87, l='MpServer', x=-2071.63, y=4.00, z=668.53], EntitySlime['Slime'/86, l='MpServer', x=-2076.38, y=4.00, z=664.38], EntitySlime['Slime'/36982, l='MpServer', x=-2122.53, y=4.00, z=652.81], EntitySlime['Slime'/93, l='MpServer', x=-2040.26, y=4.00, z=626.48], EntitySpider['Spider'/95, l='MpServer', x=-2063.01, y=4.00, z=668.59], EntityChicken['Chicken'/94, l='MpServer', x=-2042.56, y=4.00, z=652.59], EntitySlime['Slime'/45349, l='MpServer', x=-2028.31, y=4.00, z=732.31], EntitySlime['Slime'/98, l='MpServer', x=-2056.50, y=4.00, z=679.46], EntitySlime['Slime'/99, l='MpServer', x=-2066.78, y=4.00, z=738.66], EntityChicken['Chicken'/96, l='MpServer', x=-2043.63, y=4.00, z=696.44], EntityPig['Pig'/97, l='MpServer', x=-2055.34, y=4.00, z=699.91], EntitySlime['Slime'/110, l='MpServer', x=-2053.37, y=4.00, z=630.84], EntityChicken['Chicken'/111, l='MpServer', x=-2046.53, y=4.00, z=651.53], EntitySheep['Sheep'/108, l='MpServer', x=-2043.91, y=4.00, z=595.03], EntitySlime['Slime'/109, l='MpServer', x=-2048.53, y=4.00, z=638.88], EntityPig['Pig'/117, l='MpServer', x=-2034.56, y=4.00, z=714.75], EntityPig['Pig'/116, l='MpServer', x=-2050.91, y=4.00, z=704.19], EntityChicken['Chicken'/115, l='MpServer', x=-2037.59, y=4.00, z=686.59], EntitySpider['Spider'/114, l='MpServer', x=-2042.91, y=4.00, z=686.28], EntityPig['Pig'/113, l='MpServer', x=-2039.84, y=4.00, z=678.59], EntityChicken['Chicken'/112, l='MpServer', x=-2035.19, y=4.00, z=671.72], EntitySheep['Sheep'/127, l='MpServer', x=-2018.88, y=4.00, z=591.09], EntitySlime['Slime'/56992, l='MpServer', x=-2006.25, y=4.00, z=727.50]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
    Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2555)
    at net.minecraft.client.Minecraft.run(Minecraft.java:980)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
    at GradleStart.main(GradleStart.java:45)



    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Anisotropic Filtering: Off (1)
    [22:42:23] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\ewykrt\Documents\Minecraft Modding\Forge Workspace\eclipse\.\crash-reports\crash-2015-01-16_22.42.23-client.txt
    AL lib: (EE) alc_cleanup: 1 device not closed


    Right click with empty bucket error:

    [22:55:44] [Client thread/FATAL]: Unreported exception thrown!
    java.lang.NullPointerException
    at ryan.mod.blocks.BasicTank.onBlockActivated(BasicTank.java:110) ~[BasicTank.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376) ~[PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2033) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
    at GradleStart.main(GradleStart.java:45) [start/:?]
    [22:55:44] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
    // This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]

    Time: 16/01/15 10:55 PM
    Description: Unexpected error

    java.lang.NullPointerException: Unexpected error
    at ryan.mod.blocks.BasicTank.onBlockActivated(BasicTank.java:110)
    at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2033)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028)
    at net.minecraft.client.Minecraft.run(Minecraft.java:951)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
    at GradleStart.main(GradleStart.java:45)


    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------

    -- Head --
    Stacktrace:
    at ryan.mod.blocks.BasicTank.onBlockActivated(BasicTank.java:110)
    at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518)

    -- Affected level --
    Details:
    Level name: MpServer
    All players: 1 total; [EntityClientPlayerMP['Player652'/234, l='MpServer', x=-2079.11, y=6.62, z=667.39]]
    Chunk stats: MultiplayerChunkCache: 289, 289
    Level seed: 0
    Level generator: ID 01 - flat, ver 0. Features enabled: false
    Level generator options:
    Level spawn location: World: (-2081,4,654), Chunk: (at 15,0,14 in -131,40; contains blocks -2096,0,640 to -2081,255,655), Region: (-5,1; contains chunks -160,32 to -129,63, blocks -2560,0,512 to -2049,255,1023)
    Level time: 12895 game time, 4383 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 78 total; [EntitySlime['Slime'/137, l='MpServer', x=-2026.13, y=4.00, z=732.62], EntitySlime['Slime'/136, l='MpServer', x=-2037.76, y=4.00, z=739.75], EntitySlime['Slime'/139, l='MpServer', x=-2030.78, y=4.00, z=733.47], EntityChicken['Chicken'/129, l='MpServer', x=-2029.56, y=4.00, z=596.38], EntitySheep['Sheep'/131, l='MpServer', x=-2024.94, y=4.00, z=598.97], EntityChicken['Chicken'/130, l='MpServer', x=-2019.03, y=4.00, z=602.69], EntitySheep['Sheep'/133, l='MpServer', x=-2025.81, y=4.00, z=597.13], EntitySheep['Sheep'/132, l='MpServer', x=-2031.97, y=4.00, z=600.09], EntitySlime['Slime'/135, l='MpServer', x=-2016.50, y=4.81, z=638.65], EntitySlime['Slime'/134, l='MpServer', x=-2024.01, y=4.00, z=626.70], EntityChicken['Chicken'/153, l='MpServer', x=-2010.38, y=4.00, z=611.44], EntitySlime['Slime'/154, l='MpServer', x=-2001.72, y=4.00, z=595.00], EntitySlime['Slime'/155, l='MpServer', x=-2002.98, y=4.00, z=647.02], EntitySlime['Slime'/156, l='MpServer', x=-2020.50, y=4.00, z=671.06], EntitySlime['Slime'/158, l='MpServer', x=-2009.79, y=4.14, z=671.99], EntitySlime['Slime'/159, l='MpServer', x=-2000.57, y=4.00, z=680.53], EntitySlime['Slime'/35, l='MpServer', x=-2156.72, y=4.00, z=708.47], EntityPig['Pig'/38, l='MpServer', x=-2142.81, y=4.00, z=602.44], EntityCow['Cow'/39, l='MpServer', x=-2138.09, y=4.00, z=597.84], EntitySlime['Slime'/36, l='MpServer', x=-2141.73, y=4.96, z=736.84], EntityCow['Cow'/42, l='MpServer', x=-2145.78, y=4.00, z=626.34], EntitySlime['Slime'/163, l='MpServer', x=-2006.31, y=4.00, z=704.31], EntityCow['Cow'/43, l='MpServer', x=-2128.41, y=4.00, z=628.69], EntityChicken['Chicken'/162, l='MpServer', x=-2015.56, y=4.00, z=708.59], EntityCow['Cow'/40, l='MpServer', x=-2126.66, y=4.00, z=600.25], EntitySlime['Slime'/10006, l='MpServer', x=-2129.06, y=4.00, z=644.28], EntityPig['Pig'/41, l='MpServer', x=-2133.03, y=4.00, z=612.06], EntitySlime['Slime'/160, l='MpServer', x=-1999.63, y=4.00, z=685.41], EntitySlime['Slime'/46, l='MpServer', x=-2155.90, y=4.00, z=714.73], EntitySlime['Slime'/167, l='MpServer', x=-2017.51, y=4.14, z=720.70], EntitySlime['Slime'/47, l='MpServer', x=-2155.28, y=4.00, z=729.37], EntitySlime['Slime'/166, l='MpServer', x=-2008.50, y=4.00, z=710.47], EntityPig['Pig'/44, l='MpServer', x=-2147.25, y=4.00, z=649.59], EntitySlime['Slime'/45, l='MpServer', x=-2133.20, y=4.61, z=638.04], EntityCow['Cow'/51, l='MpServer', x=-2119.19, y=4.00, z=616.47], EntitySlime['Slime'/50, l='MpServer', x=-2130.13, y=4.00, z=584.43], EntitySlime['Slime'/55, l='MpServer', x=-2130.59, y=4.00, z=660.29], EntitySlime['Slime'/54, l='MpServer', x=-2139.63, y=4.96, z=645.30], EntityCow['Cow'/53, l='MpServer', x=-2124.97, y=4.00, z=642.13], EntitySlime['Slime'/52, l='MpServer', x=-2123.62, y=4.81, z=616.63], EntityPig['Pig'/59, l='MpServer', x=-2104.91, y=4.00, z=611.63], EntitySlime['Slime'/57, l='MpServer', x=-2107.34, y=4.00, z=689.91], EntityChicken['Chicken'/56, l='MpServer', x=-2114.06, y=4.00, z=662.34], EntitySlime['Slime'/63, l='MpServer', x=-2095.18, y=4.81, z=636.28], EntitySlime['Slime'/62, l='MpServer', x=-2114.78, y=4.00, z=615.13], EntityCow['Cow'/61, l='MpServer', x=-2108.50, y=4.00, z=622.34], EntityCow['Cow'/60, l='MpServer', x=-2111.97, y=4.00, z=609.06], EntitySlime['Slime'/68, l='MpServer', x=-2109.89, y=4.47, z=744.26], EntitySlime['Slime'/69, l='MpServer', x=-2110.08, y=4.14, z=746.79], EntitySlime['Slime'/64, l='MpServer', x=-2091.51, y=4.00, z=643.99], EntitySlime['Slime'/65, l='MpServer', x=-2096.53, y=4.00, z=691.60], EntitySlime['Slime'/66, l='MpServer', x=-2120.88, y=4.00, z=697.41], EntitySlime['Slime'/43157, l='MpServer', x=-2028.26, y=4.83, z=727.47], EntitySlime['Slime'/67, l='MpServer', x=-2115.98, y=4.00, z=699.28], EntitySlime['Slime'/26072, l='MpServer', x=-2133.72, y=4.00, z=635.01], EntityChicken['Chicken'/87, l='MpServer', x=-2067.75, y=4.00, z=664.74], EntitySlime['Slime'/86, l='MpServer', x=-2076.38, y=4.14, z=664.49], EntitySlime['Slime'/95, l='MpServer', x=-2055.59, y=4.00, z=649.16], EntitySlime['Slime'/94, l='MpServer', x=-2065.97, y=4.00, z=630.78], EntitySlime['Slime'/89, l='MpServer', x=-2078.13, y=4.00, z=743.53], EntitySpider['Spider'/88, l='MpServer', x=-2063.00, y=4.00, z=665.72], EntityClientPlayerMP['Player652'/234, l='MpServer', x=-2079.11, y=6.62, z=667.39], EntityPig['Pig'/98, l='MpServer', x=-2050.91, y=4.00, z=704.19], EntitySlime['Slime'/96, l='MpServer', x=-2059.22, y=4.81, z=668.57], EntityPig['Pig'/97, l='MpServer', x=-2055.34, y=4.00, z=699.91], EntityChicken['Chicken'/110, l='MpServer', x=-2035.19, y=4.00, z=671.72], EntityPig['Pig'/111, l='MpServer', x=-2039.84, y=4.00, z=678.59], EntityChicken['Chicken'/108, l='MpServer', x=-2053.44, y=4.00, z=653.47], EntityChicken['Chicken'/109, l='MpServer', x=-2042.56, y=4.00, z=652.59], EntitySheep['Sheep'/106, l='MpServer', x=-2043.91, y=4.00, z=595.03], EntitySlime['Slime'/3737, l='MpServer', x=-2146.31, y=4.00, z=636.22], EntitySlime['Slime'/107, l='MpServer', x=-2030.13, y=4.00, z=622.78], EntityPig['Pig'/116, l='MpServer', x=-2034.56, y=4.00, z=714.75], EntitySlime['Slime'/115, l='MpServer', x=-2052.79, y=4.61, z=696.52], EntityChicken['Chicken'/114, l='MpServer', x=-2043.63, y=4.00, z=696.44], EntityChicken['Chicken'/113, l='MpServer', x=-2037.59, y=4.00, z=686.59], EntitySpider['Spider'/112, l='MpServer', x=-2042.94, y=4.00, z=686.28], EntitySheep['Sheep'/124, l='MpServer', x=-2018.88, y=4.00, z=591.09]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
    Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2555)
    at net.minecraft.client.Minecraft.run(Minecraft.java:980)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
    at GradleStart.main(GradleStart.java:45)



    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Anisotropic Filtering: Off (1)
    [22:55:44] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\ewykrt\Documents\Minecraft Modding\Forge Workspace\eclipse\.\crash-reports\crash-2015-01-16_22.55.44-client.txt
    AL lib: (EE) alc_cleanup: 1 device not closed


    Right click with full bucket:

    package ryan.mod.tile;

    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.NetworkManager;
    import net.minecraft.network.Packet;
    import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraftforge.common.util.ForgeDirection;
    import net.minecraftforge.fluids.Fluid;
    import net.minecraftforge.fluids.FluidContainerRegistry;
    import net.minecraftforge.fluids.FluidRegistry;
    import net.minecraftforge.fluids.FluidStack;
    import net.minecraftforge.fluids.FluidTank;
    import net.minecraftforge.fluids.FluidTankInfo;
    import net.minecraftforge.fluids.IFluidHandler;

    public class TileEntityBasicTank extends TileEntity implements IFluidHandler{

    public FluidTank tank;

    public TileEntityBasicTank() {

    tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 2);
    }

    /**
    * Sets the capacity of the tank based on buckets.
    *
    * @param tankCapacityModifier: The amount of buckets the tank can hold.
    */
    public void setTankCapacity(int tankCapacityModifier) {

    tank.setCapacity(tankCapacityModifier);
    }

    /**
    * Decreases the capacity of the tank based on buckets. If the decrease amount is more than the tank
    * capacity, the capacity will be set to 0.
    *
    * @param tankCapacityModifier: The amount of buckets to decrease the tanks capacity by.
    */
    public void decreaseTankCapacity(int tankCapacityModifier) {

    if (tank.getCapacity() > FluidContainerRegistry.BUCKET_VOLUME * tankCapacityModifier)
    tank.setCapacity(tank.getCapacity() - (FluidContainerRegistry.BUCKET_VOLUME * tankCapacityModifier));

    else
    tank.setCapacity(0);
    }

    /**
    * Increases the capacity of the tank based on buckets.
    *
    * @param tankCapacityModifier: The amount of additional buckets this tank can hold.
    */
    public void increaseTankCapacity(int tankCapacityModifier) {

    tank.setCapacity(tank.getCapacity() + (FluidContainerRegistry.BUCKET_VOLUME * tankCapacityModifier));
    }

    @Override
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {

    this.readFromNBT(pkt.func_148857_g());
    this.worldObj.func_147479_m(xCoord, yCoord, zCoord);
    }

    @Override
    public Packet getDescriptionPacket() {

    NBTTagCompound nbt = new NBTTagCompound();
    this.writeToNBT(nbt);
    return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbt);
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt) {

    super.readFromNBT(nbt);


    tank.setCapacity(nbt.getInteger("TankCapacity") * FluidContainerRegistry.BUCKET_VOLUME);
    if (nbt.getBoolean("hasFluid"))
    tank.setFluid(FluidRegistry.getFluidStack(nbt.getString("fluidName"), nbt.getInteger("fluidAmount")));

    else
    tank.setFluid(null);
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {

    super.writeToNBT(nbt);

    nbt.setBoolean("hasFluid", tank.getFluid() != null);

    if (tank.getFluid() != null) {

    nbt.setString("fluidName", tank.getFluid().getFluid().getName());
    nbt.setInteger("fluidAmount", tank.getFluidAmount());
    }


    nbt.setInteger("TankCapacity", tank.getCapacity() / FluidContainerRegistry.BUCKET_VOLUME);

    }

    @Override
    public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {

    int amount = tank.fill(resource, doFill);

    if (amount > 0 && doFill)
    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);

    return amount;
    }

    @Override
    public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {

    if (tank.getFluidAmount() > 0 && tank.getFluid().getFluid() != resource.getFluid())
    return this.drain(from, resource.amount, doDrain);

    return null;
    }

    @Override
    public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {

    FluidStack fluidStack = tank.drain(maxDrain, doDrain);

    if (fluidStack != null && doDrain)
    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);

    return fluidStack;
    }

    @Override
    public boolean canFill(ForgeDirection from, Fluid fluid) {

    return tank.getFluid().getFluid() == fluid && tank.getFluidAmount() < tank.getCapacity();
    }

    @Override
    public boolean canDrain(ForgeDirection from, Fluid fluid) {

    return tank.getFluidAmount() > 0;
    }

    @Override
    public FluidTankInfo[] getTankInfo(ForgeDirection from) {

    FluidStack fluidStack = tank.getFluid();

    if (fluidStack != null)
    return new FluidTankInfo[] { new FluidTankInfo(fluidStack.copy(), tank.getCapacity()) };

    return new FluidTankInfo[] { null };
    }
    }


    Here are is the Tile Entity:

    package ryan.mod.blocks;

    import java.util.Random;

    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import ryan.mod.Constants;
    import ryan.mod.MainModFile;
    import ryan.mod.tile.TileEntityBasicTank;
    import net.darkhax.gyth.client.renderer.RenderModularTank;
    import net.darkhax.gyth.common.tileentity.TileEntityModularTank;
    import net.darkhax.gyth.utils.EnumTankData;
    import net.darkhax.gyth.utils.Utilities;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.world.Explosion;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    import net.minecraftforge.common.util.ForgeDirection;
    import net.minecraftforge.fluids.FluidContainerRegistry;
    import net.minecraftforge.fluids.FluidStack;
    import net.minecraftforge.fluids.FluidTankInfo;

    public class BasicTank extends Block {

    public static int renderID;

    public BasicTank() {
    super(Material.glass);
    setCreativeTab(MainModFile.augaTab);
    setBlockName(Constants.MOD_ID + "_" + Constants.BASIC_TANK_NAME);
    setBlockTextureName(Constants.MOD_ID + ":" + Constants.BASIC_TANK_TEXTURE);
    GameRegistry.registerBlock(this, Constants.BASIC_TANK_NAME);

    }

    @Override
    public boolean hasComparatorInputOverride() {

    return true;
    }

    public TileEntity createNewTileEntity(World world, int meta) {

    return new TileEntityBasicTank();
    }

    @Override
    public boolean isOpaqueCube() {

    return false;
    }

    @Override
    public int getRenderType() {

    return renderID;
    }

    @Override
    public boolean renderAsNormalBlock() {

    return false;
    }

    @Override
    public int getRenderBlockPass() {

    return 1;
    }



    @Override
    public int quantityDropped(Random rnd) {

    return 0;
    }




    @Override
    public int getComparatorInputOverride(World world, int x, int y, int z, int opSide) {

    return 0;
    }

    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {

    ItemStack stack = player.inventory.getCurrentItem();
    if (stack != null) {

    FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);
    TileEntityBasicTank tank = (TileEntityBasicTank) world.getTileEntity(x, y, z);

    if (liquid != null) {

    int amount = tank.fill(ForgeDirection.UNKNOWN, liquid, false);

    if (amount == liquid.amount) {

    tank.fill(ForgeDirection.UNKNOWN, liquid, true);
    if (!player.capabilities.isCreativeMode)
    player.inventory.setInventorySlotContents(player.inventory.currentItem, Utilities.useItemSafely(stack));

    return true;
    }

    else
    return true;
    }

    else if (FluidContainerRegistry.isBucket(stack)) {

    FluidTankInfo[] tanks = tank.getTankInfo(ForgeDirection.UNKNOWN);

    if (tanks[0] != null) {

    FluidStack fillFluid = tanks[0].fluid;
    ItemStack fillStack = FluidContainerRegistry.fillFluidContainer(fillFluid, stack);

    if (fillStack != null) {

    tank.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.getFluidForFilledItem(fillStack).amount, true);

    if (!player.capabilities.isCreativeMode) {

    if (stack.stackSize == 1)
    player.inventory.setInventorySlotContents(player.inventory.currentItem, fillStack);

    else {
    player.inventory.setInventorySlotContents(player.inventory.currentItem, Utilities.useItemSafely(stack));

    if (!player.inventory.addItemStackToInventory(fillStack))
    player.dropPlayerItemWithRandomChoice(fillStack, false);
    }
    }
    return true;
    }

    else
    return true;
    }
    }
    }

    return false;
    }

    @Override
    public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {

    if (!player.capabilities.isCreativeMode) {

    TileEntityModularTank tank = (TileEntityModularTank) world.getTileEntity(x, y, z);
    Utilities.dropStackInWorld(world, x, y, z, Utilities.getTankStackFromTile(tank, !player.isSneaking()));
    }

    return world.setBlockToAir(x, y, z);
    }

    @Override
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {

    if (stack.hasTagCompound()) {

    TileEntityModularTank tank = (TileEntityModularTank) world.getTileEntity(x, y, z);

    if (tank != null) {

    NBTTagCompound tagFluid = stack.getTagCompound().getCompoundTag("Fluid");

    if (tagFluid != null) {

    FluidStack liquid = FluidStack.loadFluidStackFromNBT(tagFluid);
    tank.tank.setFluid(liquid);
    }


    }
    }
    }

    @Override
    public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {

    Utilities.dropStackInWorld(world, x, y, z, Utilities.getTankStackFromTile((TileEntityModularTank) world.getTileEntity(x, y, z), true));
    world.setBlockToAir(x, y, z);
    onBlockDestroyedByExplosion(world, x, y, z, explosion);
    }
    }

    And the Tank Block:

    Thanks in advanced
    Posted in: Modification Development
  • 0

    posted a message on I Need a Place to Learn
    Firstly, do some basic applications or something just to make sure you understand the key concepts in Java. Make sure you know how all of them work like Classes, Enums, Interfaces, constructors, etc. If you're into youtube, there are plenty, I watched VSWE but that was for 1.6.4. I just got back into modding so I used this tutorial: http://www.orangetutorial.com/#sthash.csNVAMhu.dpbs
    Posted in: Modification Development
  • 0

    posted a message on [Request] Basic Teleporting Mod
    What about telepads?
    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on Technical Tinkerer
    Wooo I hope this comes out as soon as possible !!
    As a mod developer myself, I am very interested in how you are going to portray this in a unique and interesting way.
    Posted in: WIP Mods
  • 0

    posted a message on The Ender Crate
    I give 100% Support
    Posted in: Suggestions
  • 1

    posted a message on Shape shifting mod
    There is morph by iChun... you can morph into any mob even from mods, and players when you kill it.
    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on Space machinery Idea
    I have thought of an idea about space engineering. Well, now I need you guys to tell me in the comments what you think. Anyway enough of my rambling, here's the idea:

    Space engineering. There are many mods about mining quarries or something to drill materials and ores out of the ground. NASA said they might be considering asteroid mining. What if I was to add that as a mod?

    Asteroid Miner
    This is an entity that when, sent into space, will automatically mine ores for you. It will of course be expensive and need some sort of power. When lost power, it will crash back into the earth creating an explosion, but depending on what chest you craft it with, it will either destroy itself and the contents will be all over the floor, or saving the craft and killing the contents. So this will make it that players will have to plan their space missions.

    Thats all for now, but expect it to be updated tomorrow.
    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on [Forge][1.7]Machinery Mod
    Good luck! No seriously good luck your going to need it. Power systems are really really hard! Anyway thought I better give you the source code link for buildcraft https://github.com/BuildCraft/BuildCraft.
    Posted in: WIP Mods
  • 0

    posted a message on Minecraft Crashes (NullPointerException)
    Yep! your world generator class SHOULD NOT be abstract. Here is my world generator class as a refenence:
    /*
    *** MADE BY MITHION'S .SCHEMATIC TO JAVA CONVERTING TOOL v1.6 ***
    */
    package theRobots.structures;
    import java.util.Random;
    import theRobots.RobotBase;
    import theRobots.TileEntity.TileEntityAltar;
    import net.minecraft.block.Block;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.world.World;
    import net.minecraft.world.gen.feature.WorldGenerator;
    public class BasicDungeon extends WorldGenerator
    {
    protected int[] GetValidSpawnBlocks() {
      return new int[] {
       Block.stone.blockID,
       Block.grass.blockID,
       Block.dirt.blockID,
       Block.cobblestone.blockID,
       Block.sand.blockID,
       Block.gravel.blockID
      };
    }
    public boolean LocationIsValidSpawn(World world, int i, int j, int k){
      int distanceToAir = 0;
      int checkID = world.getBlockId(i, j, k);
      while (checkID != 0){
       distanceToAir++;
       checkID = world.getBlockId(i, j + distanceToAir, k);
      }
      if (distanceToAir > 1){
       return false;
      }
      j += distanceToAir - 1;
      int blockID = world.getBlockId(i, j, k);
      int blockIDAbove = world.getBlockId(i, j+1, k);
      int blockIDBelow = world.getBlockId(i, j-1, k);
      for (int x : GetValidSpawnBlocks()){
       if (blockIDAbove != 0){
        return false;
       }
       if (blockID == x){
        return true;
       }else if (blockID == Block.snow.blockID && blockIDBelow == x){
        return true;
       }
      }
      return false;
    }
    public BasicDungeon() { }
    public boolean generate(World world, Random rand, int i, int j, int k) {
      //check that each corner is one of the valid spawn blocks
      if(!LocationIsValidSpawn(world, i, j, k) || !LocationIsValidSpawn(world, i + 10, j, k) || !LocationIsValidSpawn(world, i + 10, j, k + 10) || !LocationIsValidSpawn(world, i, j, k + 10))
      {
       return false;
      }
    //after some world.setBlock(x, y, z, Block.BlockID);
    Also i don't think you need to instantate the IWorldgenerator class at all in the main mod class. All you need is
    GameRegistry.registerWorldGenerator(new ClassThatImplementsIWorldGenerator);
    Posted in: Modification Development
  • 0

    posted a message on [1.6.4] Spawning Wither Skull entities does not spawn correctly
    this works mostly well: What it will do is fire the wither skull in your position.. you just need to change its position..
       EntityWitherSkull skull = new EntityWitherSkull(par2World, par3EntityPlayer, 0.1, 0.1, 0.1);
       Vec3 look = par3EntityPlayer.getLookVec();
       skull.setPosition(
    				  par3EntityPlayer.posX + look.xCoord * 5,
    				  par3EntityPlayer.posY + look.yCoord * 5,
    				  par3EntityPlayer.posZ + look.zCoord * 5);
    skull.accelerationX = look.xCoord * 0.1;
    skull.accelerationY = look.yCoord * 0.1;
    skull.accelerationZ = look.zCoord * 0.1;
      
      
        par2World.spawnEntityInWorld(skull);
    	 
    Posted in: Modification Development
  • To post a comment, please .