Search in sources :

Example 1 with DimensionTeleporter

use of uk.co.wehavecookies56.kk.common.world.dimension.DimensionTeleporter in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class EntityEvents method playerRespawn.

@SubscribeEvent
public void playerRespawn(net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent event) {
    if (event.isEndConquered()) {
        BlockPos spawn = new BlockPos(192, 5, 161);
        new DimensionTeleporter(event.player.world.getMinecraftServer().getServer().getWorld(Utils.getDimensionIDAndBlockPos(Strings.TraverseTown).id), Strings.TraverseTown, spawn).teleport((EntityPlayer) event.player);
    }
}
Also used : DimensionTeleporter(uk.co.wehavecookies56.kk.common.world.dimension.DimensionTeleporter) BlockPos(net.minecraft.util.math.BlockPos) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with DimensionTeleporter

use of uk.co.wehavecookies56.kk.common.world.dimension.DimensionTeleporter in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class ItemHandHeldGummiShip method onItemRightClick.

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    if (!player.world.isRemote) {
        String nextDimension = "";
        if (player.dimension == ModDimensions.destinyIslandsID) {
            nextDimension = Strings.TraverseTown;
        } else if (player.dimension == ModDimensions.traverseTownID) {
            new TeleporterOverworld(player.world.getMinecraftServer().getServer().getWorld(0)).teleport((player), player.world);
            return super.onItemRightClick(world, player, hand);
        } else {
            nextDimension = Strings.DestinyIslands;
        }
        new DimensionTeleporter(player.world.getMinecraftServer().getServer().getWorld(Utils.getDimensionIDAndBlockPos(nextDimension).id), nextDimension, Utils.getDimensionIDAndBlockPos(nextDimension).pos).teleport((EntityPlayer) player);
    }
    return super.onItemRightClick(world, player, hand);
}
Also used : TeleporterOverworld(uk.co.wehavecookies56.kk.common.world.dimension.TeleporterOverworld) DimensionTeleporter(uk.co.wehavecookies56.kk.common.world.dimension.DimensionTeleporter)

Aggregations

DimensionTeleporter (uk.co.wehavecookies56.kk.common.world.dimension.DimensionTeleporter)2 BlockPos (net.minecraft.util.math.BlockPos)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 TeleporterOverworld (uk.co.wehavecookies56.kk.common.world.dimension.TeleporterOverworld)1