Jump to content

Recommended Posts

Posted

Here I am, again! Now that my pipe renders correctly, i feel better. But what's a pipe if it doesn't transfer liquids?

So basically, this is my TE class:

https://gist.github.com/anonymous/7139d767f5265af00c6f

 

As you can see, I'm able to suck liquids in by having a water block under the pipe (Just for testing). The problem is, the pipe will keep the liquid for itself and won't transfer it to nearby pipes. The thing I don't understand is, i coded the method to transfer liquids. As you can see it gets nearby pipes, increases their liquid level and decreases its one. THat's why I'm asking for help.

I try my best, so apologies if I said something obviously stupid!

Posted

I know someone might hate me but please, my mod NEEDS these pipes. I don't know whats wrong with them :/

I try my best, so apologies if I said something obviously stupid!

Posted

Help me to help you. What's that check good for:

 

pipeTile.getFluidLevel() > 0

(see https://gist.github.com/anonymous/7139d767f5265af00c6f#file-tileentitybasepipe-L52)

 

Doesn't that imply that your adjacent pipe must already contain a fluid in order to accept more fluid? Sounds counterproductive if you ask me.

Also, shouldn't you rather check pipeTile.canInjectFluid(f) instead of [this.]canInjectFluid(f) in the same line? Just in case you want to change behavior later... ;)

 

If that's not it, how about providing some debugging information? What does it do once you reach that condition? (Step-by-step debugging?)

Posted

I cannot believe how I did that. Eagle eye down there, man! Thats my problem in real life at school and at coding: I CAN'T FOCUS. I always make this kind of little errors. Let's see if i change it what it does.

 

Thanks for even having bothered reading my crappy code :)

I try my best, so apologies if I said something obviously stupid!

Posted

Alright so now i updated the code. This is what the pipe is doing:

 

Hmm i found another pipe, let's connect to it. Done. So now we should transfer our liquids into it.. Nah! Let's keep the liquid for me

 

It's like the pipe finds himself instead of other ones so the process is handled by the single pipe itself, and it does nothing.

 

Updated code with prints for debugging: (It doesnt even print the first one so it's like it's stuck to itself instead of checking other directions too)

https://gist.github.com/anonymous/aa0643cd94e825e470c2

I try my best, so apologies if I said something obviously stupid!

Posted

I can only imagine the pain you've been through.. using only the block class to make gas flow..

 

By the way i have my idea on why it doesn't work. As i already stated, the block SHOULD check for every direction (for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) and that's ok, but instead of cycling all of them, it stops on the first one (itself) and doesn't do anything...

I try my best, so apologies if I said something obviously stupid!

Posted

I have to say I never used ForgeDirection.VALID_DIRECTIONS. Instead I used ForgeDirection.values() and skipped over ForgeDirection.UNKNOWN... which has all offsets set to 0 = this block. Thanks for that though.

 

Back to your problem. Since your loop does not feature any exit conditions, there are only two possible answers to why your loop could possibly end before all 6 "rounds" have been completed. To confirm, do some more logging... but unconditional, just to refresh your basic counting skills. ;)

One of these reasons ist that Forge.VALID_DIRECTIONS doesn't contain all valid directions in the first place, which would be total non-sense and thus the idea is trashed.

The second answer would be that you have an uncaught exception causing your method to terminate. But I guess you'd notice that one, unless you have somewhere an ingeniusly placed try {} catch (Exception ex) {} wrapper in your base code...

 

Given all this, we'd need more information on what happens internally. Do some real debugging...

 

By the way, when we say "Debugging", we're not talking about printing messages to the console. Of course that too is a technique in debugging, but is more useful to quickly check where the malfunctioning occurs: before or after the logged message. At least that's how I use it when pb]actively[/b] debugging.

Instead Eclipse grants you the ability to walk through your code step by step or - even better - set breakpoints at which you want Minecraft to interrupt in order to go through only specific parts of your code. Whilst debugging Eclipse shows you the values of variables and allows you to evaluate code under the current conditions (i.e. return value of methods using current values of parameters). It's a highly useful feature and just invaluable to solving such problems.

Posted

OK so i started debugging seriously with breakpoints. I saw that the code gets stuck on

int d2 = y + dir.offsetY;

I really don't know what's the problem. IN this moment dir.offsetY equals -1 so under the pipe.. i really don't know, maybe I should code it from scratch.

 

Some further debugging had me discover that it checks for the directions actually but it's like it doesnt find any pipe. I know this because i tried to make it set blocks around it at the directions it should check, and since it doesnt replace itself, i know that it doesnt check for itself. At least a problem solved. Now i still need to realize if it doesnt find pipes or it can't inject water in them. To discover this it's simple.

 

Btw guys i'm very glad you keep heling me. My english is not that good and my java skills aren't either, I'm learning.

 

Thanks for helping this stupid 14yrs old boy :)

I try my best, so apologies if I said something obviously stupid!

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I have used mixins once before, and it was with @At RETURN, so it worked fine. Now im trying to use it as INVOKE, and the compilation is successful, but the client crashes almost on startup (just a couple seconds after running runClient)   Im trying to inject the method finishConversion inside the ZombieVillager class. This is my Mixin class important stuff:   import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.monster.ZombieVillager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ZombieVillager.class) public class ZombieVillagerCures { @Inject(method = "finishConversion", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/entity/LivingEntity;addEffect(Lnet/minecraft/world/effect/MobEffectInstance;)Z")) private void addZombieVillagerCuredAmmount(ServerLevel level, CallbackInfo info) { System.out.println("The Mixin Worked!!! " + level); } // Lnet/minecraft/world/entity/LivingEntity;addEffect(Lnet/minecraft/world/effect/MobEffectInstance;)Z } I'm sure the issue lies in the @At cuz other @At values work fine. Its probably the fully qualified name thing. idk how to get it in VS code
    • I'm wayy less skilled than you i bet, but maybe u could try to just convert one into the other?
    • wildbackport is not working
    • Through Betafort Recovery, Bitcoin scam victims can retrieve their money. I recommend Betafort Recovery to anyone who has fallen victim to a scam and has been looking for methods and techniques to recover their lost cryptocurrency or wallets. Betafort Recovery is a reliable cryptocurrency recovery firm that assists victims in recovering their stolen cryptocurrency and offers secure solutions to protect your wallets from online scammers. I must admit that I was deeply melancholy and had given up on life until these experts could restore my $23,400 to my wallet. If you've lost your cryptocurrency and you are helpless about it, contact Betafort Recovery to get your money back. One key aspect that makes Betafort Recovery stand out is its focus on providing secure solutions to protect wallets from online scammers. It's not just about recovering lost funds; it's also about preventing future incidents and ensuring that clients' digital assets are safeguarded against potential threats. This proactive approach demonstrates their commitment to the long-term financial security of their clients. Furthermore, for individuals who have lost their cryptocurrency and are feeling helpless, reaching out to Betafort Recovery could be a turning point in their situation. The reassurance that they are legitimate for seeking help and recovering lost funds can provide much-needed relief and a sense of empowerment. Betafort Recovery as a reliable cryptocurrency recovery firm is certainly well-founded. Their ability to assist scam victims in recovering stolen cryptocurrency, their focus on providing secure solutions, and their commitment to supporting clients through challenging situations make them a valuable resource for individuals navigating the complex world of digital currencies. If you or someone you know has fallen victim to a cryptocurrency scam, contacting Betafort Recovery could be the first step towards reclaiming lost funds and regaining peace of mind.  
    • Idk how i didn't notice that, but I deleted it and fixed some other issues and now I get this https://mclo.gs/YsWacqq
  • Topics

×
×
  • Create New...

Important Information

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