Fix Gate of the Fold endless loop (#743)
This commit is contained in:
parent
dce6bf1e93
commit
cebf71c329
|
@ -106,20 +106,20 @@ public class BlockDimensionalPortal extends BlockIntegerContainer
|
|||
PortalLocation portal = linkedLocations.get(1);
|
||||
if (portal.getDimension() == world.provider.getDimension())
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner()));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), false));
|
||||
} else
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension()));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension(), false));
|
||||
}
|
||||
} else if (linkedLocations.get(1).equals(new PortalLocation(masterRitualStone.getBlockPos().up(), world.provider.getDimension())))
|
||||
{
|
||||
PortalLocation portal = linkedLocations.get(0);
|
||||
if (portal.getDimension() == world.provider.getDimension())
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner()));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), false));
|
||||
} else
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension()));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension(), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,10 +52,10 @@ public class ItemSigilTeleposition extends ItemSigilBase
|
|||
BlockPos blockPos = new BlockPos(getValue(stack.getTagCompound(), Constants.NBT.X_COORD), getValue(stack.getTagCompound(), Constants.NBT.Y_COORD), getValue(stack.getTagCompound(), Constants.NBT.Z_COORD)).up();
|
||||
if (world.provider.getDimension() == getValue(stack.getTagCompound(), Constants.NBT.DIMENSION_ID))
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(blockPos, player, getOwnerUUID(stack)));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(blockPos, player, getOwnerUUID(stack), true));
|
||||
} else
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(blockPos, player, getOwnerUUID(stack), world, getValue(stack.getTagCompound(), Constants.NBT.DIMENSION_ID)));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(blockPos, player, getOwnerUUID(stack), world, getValue(stack.getTagCompound(), Constants.NBT.DIMENSION_ID), true));
|
||||
}
|
||||
}
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
|
|
|
@ -28,15 +28,17 @@ public class Teleports
|
|||
|
||||
public static class TeleportSameDim extends Teleport
|
||||
{
|
||||
private final boolean teleposer;
|
||||
|
||||
public TeleportSameDim(int x, int y, int z, Entity entity, String networkToDrain)
|
||||
public TeleportSameDim(int x, int y, int z, Entity entity, String networkToDrain, boolean teleposer)
|
||||
{
|
||||
super(x, y, z, entity, networkToDrain);
|
||||
this(new BlockPos(x, y, z), entity, networkToDrain, teleposer);
|
||||
}
|
||||
|
||||
public TeleportSameDim(BlockPos blockPos, Entity entity, String networkToDrain)
|
||||
public TeleportSameDim(BlockPos blockPos, Entity entity, String networkToDrain, boolean teleposer)
|
||||
{
|
||||
super(blockPos, entity, networkToDrain);
|
||||
this.teleposer = teleposer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,8 +54,9 @@ public class Teleports
|
|||
if (network.getCurrentEssence() < getTeleportCost())
|
||||
return;
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z))))
|
||||
return;
|
||||
if (teleposer)
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z))))
|
||||
return;
|
||||
|
||||
network.syphon(getTeleportCost());
|
||||
|
||||
|
@ -65,15 +68,17 @@ public class Teleports
|
|||
player.timeUntilPortal = 150;
|
||||
|
||||
player.worldObj.playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z)));
|
||||
if (teleposer)
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z)));
|
||||
} else
|
||||
{
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
|
||||
if (network.getCurrentEssence() < (getTeleportCost() / 10))
|
||||
return;
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z))))
|
||||
return;
|
||||
if (teleposer)
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z))))
|
||||
return;
|
||||
|
||||
network.syphon(getTeleportCost() / 10);
|
||||
|
||||
|
@ -84,7 +89,8 @@ public class Teleports
|
|||
world.resetUpdateEntityTick();
|
||||
|
||||
entity.worldObj.playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z)));
|
||||
if (teleposer)
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,25 +103,24 @@ public class Teleports
|
|||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class TeleportToDim extends Teleport
|
||||
{
|
||||
@Getter
|
||||
private World oldWorld;
|
||||
@Getter
|
||||
private int newWorldID;
|
||||
private boolean teleposer;
|
||||
|
||||
public TeleportToDim(int x, int y, int z, Entity entity, String networkToDrain, World oldWorld, int newWorld)
|
||||
public TeleportToDim(int x, int y, int z, Entity entity, String networkToDrain, World oldWorld, int newWorld, boolean teleposer)
|
||||
{
|
||||
super(x, y, z, entity, networkToDrain);
|
||||
this.oldWorld = oldWorld;
|
||||
this.newWorldID = newWorld;
|
||||
this(new BlockPos(x, y, z), entity, networkToDrain, oldWorld, newWorld, teleposer);
|
||||
}
|
||||
|
||||
public TeleportToDim(BlockPos blockPos, Entity entity, String networkToDrain, World oldWorld, int newWorldID)
|
||||
public TeleportToDim(BlockPos blockPos, Entity entity, String networkToDrain, World oldWorld, int newWorldID, boolean teleposer)
|
||||
{
|
||||
super(blockPos, entity, networkToDrain);
|
||||
this.oldWorld = oldWorld;
|
||||
this.newWorldID = newWorldID;
|
||||
this.teleposer = teleposer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,8 +144,9 @@ public class Teleports
|
|||
if (network.getCurrentEssence() < getTeleportCost())
|
||||
return;
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
|
||||
return;
|
||||
if (teleposer)
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
|
||||
return;
|
||||
|
||||
network.syphon(getTeleportCost());
|
||||
|
||||
|
@ -149,7 +155,8 @@ public class Teleports
|
|||
player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5);
|
||||
player.worldObj.updateEntityWithOptionalForce(player, false);
|
||||
player.connection.sendPacket(new SPacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
|
||||
if (teleposer)
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
|
||||
}
|
||||
|
||||
} else if (!entity.worldObj.isRemote)
|
||||
|
@ -158,8 +165,9 @@ public class Teleports
|
|||
if (network.getCurrentEssence() < (getTeleportCost() / 10))
|
||||
return;
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
|
||||
return;
|
||||
if (teleposer)
|
||||
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
|
||||
return;
|
||||
|
||||
network.syphon(getTeleportCost() / 10);
|
||||
|
||||
|
@ -181,7 +189,8 @@ public class Teleports
|
|||
|
||||
oldWorldServer.resetUpdateEntityTick();
|
||||
newWorldServer.resetUpdateEntityTick();
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
|
||||
if (teleposer)
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
|
||||
}
|
||||
entity.timeUntilPortal = entity instanceof EntityLiving ? 150 : 20;
|
||||
newWorldServer.playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
|
||||
|
|
|
@ -110,36 +110,36 @@ public class TileTeleposer extends TileInventory implements ITickable
|
|||
|
||||
if (focusWorld.equals(worldObj))
|
||||
{
|
||||
if (originalWorldEntities != null && !originalWorldEntities.isEmpty())
|
||||
if (!originalWorldEntities.isEmpty())
|
||||
{
|
||||
for (Entity entity : originalWorldEntities)
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID)));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), true));
|
||||
}
|
||||
}
|
||||
|
||||
if (focusWorldEntities != null && !focusWorldEntities.isEmpty())
|
||||
if (!focusWorldEntities.isEmpty())
|
||||
{
|
||||
for (Entity entity : focusWorldEntities)
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID)));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), true));
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (originalWorldEntities != null && !originalWorldEntities.isEmpty())
|
||||
if (!originalWorldEntities.isEmpty())
|
||||
{
|
||||
for (Entity entity : originalWorldEntities)
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), worldObj, focusWorld.provider.getDimension()));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), worldObj, focusWorld.provider.getDimension(), true));
|
||||
}
|
||||
}
|
||||
|
||||
if (focusWorldEntities != null && !focusWorldEntities.isEmpty())
|
||||
if (!focusWorldEntities.isEmpty())
|
||||
{
|
||||
for (Entity entity : focusWorldEntities)
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), focusWorld, worldObj.provider.getDimension()));
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), focusWorld, worldObj.provider.getDimension(), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue