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

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

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

World.setSpawnPoint介绍

暂无

代码示例

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

  1. @Override
  2. public void setSpawnPoint(@Nonnull BlockPos pos) {
  3. wrapped.setSpawnPoint(pos);
  4. }

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

  1. @Override
  2. public void setSpawnPoint(BlockPos pos) {
  3. getActualWorld().setSpawnPoint(pos);
  4. }

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

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

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

  1. @SubscribeEvent
  2. public static void createSpawnPoint(WorldEvent.CreateSpawnPosition event) {
  3. World world = event.getWorld();
  4. if(world.isRemote || !(world instanceof WorldServer)) {
  5. return;
  6. }
  7. WorldServer worldServer = (WorldServer)world;
  8. if(!(worldServer.getChunkProvider().chunkGenerator instanceof SkyChunkGenerator)) {
  9. return;
  10. }
  11. float centerPos = 16.0f - (SkyTerrainGenerator.ROOM_DIMENSION / 2.0f);
  12. int heightPos = SkyTerrainGenerator.ROOM_FLOOR_HEIGHT - SkyTerrainGenerator.ROOM_DIMENSION + 2;
  13. Logz.info("Overriding world spawn point");
  14. event.getWorld().setSpawnPoint(new BlockPos(centerPos, heightPos, centerPos));
  15. event.setCanceled(true);
  16. }

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

  1. @SubscribeEvent
  2. public static void onWorldLoad(WorldEvent.Load event) {
  3. World world = event.getWorld();
  4. if (!world.isRemote && ServerEventHandler.shouldHandle(world)) {
  5. TerrariumWorldData worldData = ((TerrariumWorldType) world.getWorldType()).getWorldData(world);
  6. if (worldData != null) {
  7. Coordinate spawnPosition = worldData.getSpawnPosition();
  8. if (spawnPosition != null) {
  9. world.setSpawnPoint(spawnPosition.toBlockPos());
  10. }
  11. }
  12. if (world instanceof WorldServer) {
  13. PlayerChunkMapHooks.hookWorldMap((WorldServer) world);
  14. }
  15. }
  16. }

相关文章

World类方法