Search in sources :

Example 1 with TeleporterMP

use of stevekung.mods.moreplanets.util.TeleporterMP in project MorePlanets by SteveKunG.

the class BlockSpacePortal method onBlockActivated.

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (ConfigManagerMP.enableStartedPlanet && !(ConfigManagerMP.startedPlanet.equals("planet.") || ConfigManagerMP.startedPlanet.equals("moon.") || ConfigManagerMP.startedPlanet.equals("satellite."))) {
        if (!player.isRiding() && !player.isBeingRidden() && player.isNonBoss() && player instanceof EntityPlayerMP) {
            EntityPlayerMP playerMP = (EntityPlayerMP) player;
            if (playerMP.dimension != -1) {
                playerMP.mcServer.getPlayerList().transferPlayerToDimension(playerMP, -1, new TeleporterMP(playerMP.mcServer.getWorld(-1)));
                GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMP(EnumSimplePacketMP.C_RELOAD_RENDERER, playerMP.dimension), playerMP);
            } else {
                int dimID = WorldUtil.getProviderForNameServer(WorldTickEventHandler.startedDimensionData.planetToBack).getDimension();
                playerMP.mcServer.getPlayerList().transferPlayerToDimension(playerMP, dimID, new TeleporterMP(playerMP.mcServer.getWorld(dimID)));
                GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMP(EnumSimplePacketMP.C_RELOAD_RENDERER, playerMP.dimension), playerMP);
            }
        }
    }
    return true;
}
Also used : TeleporterMP(stevekung.mods.moreplanets.util.TeleporterMP) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) PacketSimpleMP(stevekung.mods.moreplanets.network.PacketSimpleMP)

Aggregations

EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 PacketSimpleMP (stevekung.mods.moreplanets.network.PacketSimpleMP)1 TeleporterMP (stevekung.mods.moreplanets.util.TeleporterMP)1