本文整理匯總了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);
}
}
示例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);
}
示例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);
}
}