當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldEvent.CreateSpawnPosition方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.world.WorldEvent.CreateSpawnPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldEvent.CreateSpawnPosition方法的具體用法?Java WorldEvent.CreateSpawnPosition怎麽用?Java WorldEvent.CreateSpawnPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.world.WorldEvent的用法示例。


在下文中一共展示了WorldEvent.CreateSpawnPosition方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onWorldCreateSpawn

import net.minecraftforge.event.world.WorldEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOW)
public void onWorldCreateSpawn(WorldEvent.CreateSpawnPosition event)
{
    World world = event.getWorld();
    JustEnoughDimensions.logInfo("WorldEvent.CreateSpawnPosition - DIM: {}", world.provider.getDimension());

    overrideWorldInfoAndBiomeProvider(world);

    // Find a proper spawn point for the overworld that isn't inside ground...
    // For other dimensions than the regular overworld, this is done after
    // (and only if) setting up the custom WorldInfo override for a newly
    // created dimension, see overrideBiomeProviderAndFindSpawn().
    if (world.provider.getDimension() == 0)
    {
        WorldUtils.findAndSetWorldSpawn(world);

        if (event.getSettings().isBonusChestEnabled())
        {
            JustEnoughDimensions.logInfo("WorldEvent.CreateSpawnPosition - Generating a bonus chest");
            WorldUtils.createBonusChest(world);
        }

        event.setCanceled(true);
    }
}
 
開發者ID:maruohon,項目名稱:justenoughdimensions,代碼行數:26,代碼來源:JEDEventHandler.java

示例2: onCreateSpawn

import net.minecraftforge.event.world.WorldEvent; //導入方法依賴的package包/類
public void onCreateSpawn(WorldEvent.CreateSpawnPosition event) {
    WorldServer world = (WorldServer)(event.getWorld());
    if (ignore(world.getWorldType(),this.newSettings)) {
        return;
    }
    int dimension = world.provider.getDimension();
    if (!this.dimensionSettings.ccOnIn(dimension)) {
        if (!DimensionalSettingsRegistry.instance.useCCIn(dimension)) {
            return;
        }
    }// only change dimensions we're supposed to;
    onWorldLoad(event.getWorld());
    salvageSpawn(event.getWorld());
    if (event.getSettings().isBonusChestEnabled()) {
        Random rand = new Random(world.getSeed());
        WorldGeneratorBonusChest worldgeneratorbonuschest =new WorldGeneratorBonusChest();

        for (int i = 0; i < 100; ++i){
            int j = world.getWorldInfo().getSpawnX() + rand.nextInt(6+i/10) - rand.nextInt(6+i/10);
            int k = world.getWorldInfo().getSpawnZ() + rand.nextInt(6+i/10) - rand.nextInt(6+i/10);

            BlockPos topBlockSpot = new BlockPos(j,world.getActualHeight()-1,k);
            while (!world.getBlockState(topBlockSpot).getBlock().isBlockSolid(world, topBlockSpot, EnumFacing.UP)) {
                topBlockSpot = topBlockSpot.down();
            }
            BlockPos above = topBlockSpot.up();

            if (world.getBlockState(above).getBlock().isAir(world.getBlockState(above),world, above)){
                if (worldgeneratorbonuschest.generate(world, rand, above)) break;
            }
        }
    }
    event.setCanceled(true);
}
 
開發者ID:Zeno410,項目名稱:Geographicraft,代碼行數:35,代碼來源:DimensionManager.java

示例3: onCreateSpawn

import net.minecraftforge.event.world.WorldEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onCreateSpawn(WorldEvent.CreateSpawnPosition event) {
    if (dimensionManager == null) {
        MinecraftServer server = event.getWorld().getMinecraftServer();
        if (server!=null)
            dimensionManager = new DimensionManager(masterSettings,dimensionSettings,server);
    }
    if (dimensionManager != null) {
        dimensionManager.onCreateSpawn(event);
    } 

}
 
開發者ID:Zeno410,項目名稱:Geographicraft,代碼行數:13,代碼來源:ClimateControl.java


注:本文中的net.minecraftforge.event.world.WorldEvent.CreateSpawnPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。