Jump to content

Recommended Posts

Posted

Hey guys, im working on a lava generator rn and am trying to figure out liquid storage, is there a class i implement on my TileLavaGen? i know how to do everything else but its my first time working with liquids, and how to store them/use them for energy generation.

Posted

You don't implement interfaces anymore, that's why the Capability system exists.

You need a liquid handling capability, I do not know if Forge has one or not.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I'd personally go oldschool way using TileEntity and a float representing fluid in buckets. Like say 3.1 is 3 buckets and 10% of a bucket. Then I'd make my code logic work around that. Based on the answers above I guess that's now how is ideally done so I dunno :D

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Posted

but then other mods cant interact w/ your things

 

Well I have learned something new. Thank you.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Posted

So iv done a bit of work and got it to produce power based on the power stored, but am running into a problem

my generator stores 50k rf, once full, its supposed to just store the lava thats input into it, but whats happening is the lava is disappearing and no power is being generated

Code:

Block:

@Override
    public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY){
        if(!world.isRemote){
            TileLavaGen lavaGen = (TileLavaGen)world.getTileEntity(pos);
            ItemStack itemstack = player.getHeldItem(hand);
            Item item = itemstack.getItem();

            if(lavaGen != null && !player.isSneaking() && item != Items.LAVA_BUCKET){
                player.openGui(TechExpansion.instance, GuiHandler.GUI_LAVAGEN, world, pos.getX(), pos.getY(), pos.getZ());
            }else if(item == Items.LAVA_BUCKET && lavaGen.lavaStored.getFluidAmount() + UtilBase.BUCKET <= 8000){
                lavaGen.lavaStored.fillInternal(new FluidStack(FluidRegistry.LAVA, UtilBase.BUCKET), true);
                player.replaceItemInInventory(player.inventory.currentItem, new ItemStack(Items.BUCKET));
            }
            return true;
        }
        return true;
    }

 

 

TileEntity:

    public EnergyStorage storage = new EnergyStorage(50000);
    public static int PRODUCE = 1000;
    public static int DRAINPERTICK = 250;
    public FluidTank lavaStored = new FluidTank(8000);

public void handleGenerating() {
            if(this.lavaStored.getFluidAmount() > 0 && storage.getEnergyStored() < 50000) {
            storage.receiveEnergy(PRODUCE, false);
            this.lavaStored.drain(DRAINPERTICK, true);
        }
    }

 

also is for my FluidTank method im specifying 8000, is 1000 = 1bucket? or is that 8000 buckets?

Posted

By the way, you should be exposing the capability via getCapability.

Which is how you should access it yourself.

As for why the lava vanishes, I don't know.  Try using the debugger.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

so iv done a bit of work, and testing, it seems that it is storing it, but its only doing it on server side, so i have to relog to fix it as you can see here

how can i make it work on server side aswell so i dont need to update the client

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.