Fixed placement of chunk ticket release due to scoping

Added in missing ticket releases
This commit is contained in:
Nicholas Ignoffo 2018-08-26 13:49:02 -07:00
parent 8e16e590ea
commit 6062b68661

View file

@ -1,12 +1,12 @@
package WayofTime.bloodmagic.ritual.portal;
import WayofTime.bloodmagic.core.data.SoulNetwork;
import WayofTime.bloodmagic.core.data.SoulTicket;
import WayofTime.bloodmagic.event.TeleposeEvent;
import WayofTime.bloodmagic.teleport.Teleport;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import net.minecraft.entity.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.SoundEvents;
@ -136,16 +136,18 @@ public class Teleports {
if (!player.getEntityWorld().isRemote) {
SoulNetwork network = NetworkHelper.getSoulNetwork(networkOwner);
if (network.getCurrentEssence() < getTeleportCost())
if (network.getCurrentEssence() < getTeleportCost()) {
ForgeChunkManager.releaseTicket(chunkTicket);
return;
}
if (teleposer && MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.getEntityWorld(), entity.getPosition(), newWorldServer, targetTeleposer)))
if (teleposer && MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.getEntityWorld(), entity.getPosition(), newWorldServer, targetTeleposer))) {
ForgeChunkManager.releaseTicket(chunkTicket);
return;
}
network.syphon(ticket(oldWorld, player, getTeleportCost()));
/* begin brandon3055 "BrandonsCore" intedimensional teleportation code */
PlayerList playerList = server.getPlayerList();
@ -217,9 +219,9 @@ public class Teleports {
}
newWorldServer.playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
ForgeChunkManager.releaseTicket(chunkTicket);
} else {
entity.timeUntilPortal = 10;
ForgeChunkManager.releaseTicket(chunkTicket);
}
}
}