Zarathul / simpleportals

A Minecraft mod that adds portals for easy intra- and interdimensional travel.
MIT License
2 stars 4 forks source link

For cooldown use timeUntilPortal instead of worldTime #4

Closed hupster closed 6 years ago

hupster commented 6 years ago

The worldTime of a world is used as a timebase to check the cooldown when entering a portal. But when using a mod like justEnoughDimensions, the worldTime between worlds can be different. The time of one world is compared to the other, the time since the last teleport is negative, and teleport is only allowed once.

This simple fix resolved the issue for me.

Zarathul commented 6 years ago

Oh, I never thought about that. Thank you. I hope that fixes #3. I already merged your changes locally. After I'm done changing a few other things I'll push out a new release. Should be soon™.

hupster commented 6 years ago

No problem, glad you made this mod.

Reading that issue it could be related, at least the issue of Thorf13, not the one that fboyd describes (portals working up to 3 times or so, appearing in the wrong place). The worldTime issue appears when teleporting out of a dimension, as soon as you create a worldinfo entry for it in the dimensions.json of JED. If you don't do that for the nether and the end, they worked fine for me. If you have the worldinfo entry, you could teleport out of the dimension once if you logged in in it, but if you logged in in a different dimension and used a portal to it, you couldn't get back. Makes sense, because once you used the portal the cooldown was active for a long time.

Zarathul commented 6 years ago

Reading that issue it could be related, at least the issue of Thorf13, not the one that fboyd describes

Yeah, the other one I'm still pretty sure was related to sponge.

hupster commented 6 years ago

Different issue but did you intent for mobs to be able to pass through the portals? In my logs some exceptions appeared about mobs trying to go through, so a few lines below the cooldown fix, I added this:

if (entity instanceof EntityItem && Config.powerCost > 0 && Config.powerCapacity > 0)
{
..
}
else if (!(entity instanceof EntityPlayerMP))
{
   return;
}

I didn't investigate, but if the intent is to only allow players and the power sources, it could be an easy fix.

Zarathul commented 6 years ago

Different issue but did you intent for mobs to be able to pass through the portals?

Yes. Although I never thoroughly tested it.

In my logs some exceptions appeared about mobs trying to go through

Uhh that's bad. Guess I need to look into that.