net.minecraft.world.World.setSpawnPoint()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中net.minecraft.world.World.setSpawnPoint()方法的一些代码示例,展示了World.setSpawnPoint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.setSpawnPoint()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:setSpawnPoint

World.setSpawnPoint介绍

暂无

代码示例

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void setSpawnPoint(@Nonnull BlockPos pos) {
 wrapped.setSpawnPoint(pos);
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public void setSpawnPoint(BlockPos pos) {
  getActualWorld().setSpawnPoint(pos);
}

代码示例来源:origin: McJtyMods/LostCities

BlockPos pos = new BlockPos(x, y, z);
if (isValidStandingPosition(world, pos)) {
  world.setSpawnPoint(pos.up());
  return;

代码示例来源:origin: thraaawn/CompactMachines

@SubscribeEvent
public static void createSpawnPoint(WorldEvent.CreateSpawnPosition event) {
  World world = event.getWorld();
  if(world.isRemote || !(world instanceof WorldServer)) {
    return;
  }
  WorldServer worldServer = (WorldServer)world;
  if(!(worldServer.getChunkProvider().chunkGenerator instanceof SkyChunkGenerator)) {
    return;
  }
  float centerPos = 16.0f - (SkyTerrainGenerator.ROOM_DIMENSION / 2.0f);
  int heightPos = SkyTerrainGenerator.ROOM_FLOOR_HEIGHT - SkyTerrainGenerator.ROOM_DIMENSION + 2;
  Logz.info("Overriding world spawn point");
  event.getWorld().setSpawnPoint(new BlockPos(centerPos, heightPos, centerPos));
  event.setCanceled(true);
}

代码示例来源:origin: gegy1000/Terrarium

@SubscribeEvent
public static void onWorldLoad(WorldEvent.Load event) {
  World world = event.getWorld();
  if (!world.isRemote && ServerEventHandler.shouldHandle(world)) {
    TerrariumWorldData worldData = ((TerrariumWorldType) world.getWorldType()).getWorldData(world);
    if (worldData != null) {
      Coordinate spawnPosition = worldData.getSpawnPosition();
      if (spawnPosition != null) {
        world.setSpawnPoint(spawnPosition.toBlockPos());
      }
    }
    if (world instanceof WorldServer) {
      PlayerChunkMapHooks.hookWorldMap((WorldServer) world);
    }
  }
}

相关文章

微信公众号

最新文章

更多

World类方法