本文整理汇总了Java中net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate方法的典型用法代码示例。如果您正苦于以下问题:Java DecorateBiomeEvent.Decorate方法的具体用法?Java DecorateBiomeEvent.Decorate怎么用?Java DecorateBiomeEvent.Decorate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.terraingen.DecorateBiomeEvent
的用法示例。
在下文中一共展示了DecorateBiomeEvent.Decorate方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void decorate(DecorateBiomeEvent.Decorate event) {
World world = event.getWorld();
Biome biome = world.getBiomeGenForCoords(event.getPos());
Random rand = event.getRand();
if ((biome == Biomes.PLAINS || biome == Biomes.ICE_PLAINS || biome == Biomes.MUTATED_PLAINS || biome == Biomes.EXTREME_HILLS_WITH_TREES || biome == Biomes.MUTATED_EXTREME_HILLS_WITH_TREES) && event.getType() == DecorateBiomeEvent.Decorate.EventType.TREE) {
if (rand.nextDouble() > 0.1) return;
int x = rand.nextInt(16) + 8;
int y = rand.nextInt(16) + 8;
TintedTreeGenerator gen = new TintedTreeGenerator();
gen.generateTree(rand, world, world.getHeight(event.getPos().add(x, 0, y)));
event.setResult(Event.Result.DENY);
}
}
示例2: onWorldDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event)
{
if ((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS)
{
for(int i = 0; i < 2; i++)
{
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
if(event.world.isAirBlock(x, y, z) && Blocks.flower_pot.canBlockStay(event.world, x, y, z) && ConfigPrimitiveCraft.genrocks)
{
event.world.setBlock(x, y, z, ModBlocks.rock);
}
else if(event.world.getBlock(x, y, z) == Blocks.water && ConfigPrimitiveCraft.genshale)
{
event.world.setBlock(x, y-1, z, ModBlocks.shale);
}
}
}
}
示例3: decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public boolean decorate(DecorateBiomeEvent.Decorate evt) {
if (evt.type == DecorateBiomeEvent.Decorate.EventType.TREE) {
int chunkX = evt.chunkX;
int chunkZ = evt.chunkZ;
BiomeGenBase biome = evt.world.getBiomeGenForCoords(chunkX, chunkZ);
int dimensionId = evt.world.provider.dimensionId;
if (!KTreeCfg.isValidDimension(dimensionId)) {
return true;
}
return KTreeDecorate.decorate(evt.world, evt.rand, chunkX, chunkZ,
biome);
}
return false;
}
示例4: onBiomeDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onBiomeDecoration(DecorateBiomeEvent.Decorate event)
{
if(ConfigValues.SPAWN_WORLD_CRATER)
{
if(event.getWorld().provider.getDimension() == 0)
{
int x = event.getPos().getX();
int z = event.getPos().getZ();
if(Math.sqrt((x*x) + (z*z)) < 378)
{
event.setResult(Event.Result.DENY);
}
}
}
}
示例5: onBiomeDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onBiomeDecoration(DecorateBiomeEvent.Decorate event)
{
if (event.type == DecorateBiomeEvent.Decorate.EventType.FLOWERS && (event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT))
{
for (int i = 0; i < Settings.FLOWER_QUANTITY; i++)
{
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
Block randomPlant = ModBlocks.plants[event.rand.nextInt(ModBlocks.plants.length)];
if (event.world.isAirBlock(x, y, z) && (!event.world.provider.hasNoSky || y < 255) && randomPlant.canBlockStay(event.world, x, y, z))
{
event.world.setBlock(x, y, z, randomPlant, 0, 2);
}
}
}
}
示例6: onWorldDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event) {
BiomeGenBase biome = event.world.getBiomeGenForCoords(event.chunkX, event.chunkZ);
if (biome != null && isValidBiomeType(biome)) {
if ((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT) && event.type == DecorateBiomeEvent.Decorate.EventType.FLOWERS) {
for (int i = 0; i < ModLibs.manaFlowerQuantity; i++) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
for (int j = 0; j < ModLibs.manaFlowerDensity; j++) {
int x1 = x + event.rand.nextInt(8) - event.rand.nextInt(8);
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
int z1 = z + event.rand.nextInt(8) - event.rand.nextInt(8);
if (event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.manaFlower.canBlockStay(event.world, x1, y1, z1))
event.world.setBlock(x1, y1, z1, ModBlocks.manaFlower, event.rand.nextInt(3), 2);
}
}
}
}
}
示例7: generateFruitTree
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void generateFruitTree(DecorateBiomeEvent.Decorate event) {
if (event.getType() == DecorateBiomeEvent.Decorate.EventType.TREE) {
BaseTreeGenerator[] generatorBasicTrees = generatorTreeMap.values().toArray(new BaseTreeGenerator[0]);
BaseTreeGenerator generator = generatorBasicTrees[MathHelper.getInt(event.getRand(),0, generatorBasicTrees.length - 1)];
if (generator.generate(event.getWorld(), event.getRand(), event.getPos())) {
FoodCraftReloaded.getLogger().info("Generated fruit tree at " + event.getPos());
event.setResult(Event.Result.DENY);
}
}
}
示例8: decorateBiome
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
/** Alters vanilla chunk decorating. */
@SubscribeEvent
public void decorateBiome(DecorateBiomeEvent.Decorate event) {
// Cancel vanilla pumpkin and melon generation
if (event.getType() == DecorateBiomeEvent.Decorate.EventType.PUMPKIN) {
event.setResult(Result.DENY);
}
}
示例9: onDecorateBiome
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDecorateBiome(DecorateBiomeEvent.Decorate event)
{
if (Configs.get(event.getWorld()).decorationIsDisabled(event.getType()))
{
event.setResult(Event.Result.DENY);
}
}
示例10: onWorldDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onWorldDecoration(final DecorateBiomeEvent.Decorate event) {
if (isGenerationAllowed(event)) {
// Calculate the range and scaling based on
// the world sea level. Normal sea level is assumed
// to be 64, which is the Overworld sea level.
final int groundLevel = event.world.provider.getAverageGroundLevel();
final int attempts = (int) (ModOptions.getRubblePileDensity() * ((float) groundLevel / 64F));
final int maxY = groundLevel - 4;
final int spread = maxY - MIN_Y;
// In case someone does something real funky with a
// dimension.
if (spread < 1 || attempts < 1)
return;
// Use our random routine, but seed with the provided
// Random. The provided Random seed is deterministic
// where map gen is concerned.
final XorShiftRandom random = new XorShiftRandom(event.rand);
for (int i = 0; i < attempts; i++) {
final int x = event.chunkX + random.nextInt(16) + 8;
final int z = event.chunkZ + random.nextInt(16) + 8;
int y = random.nextInt(spread) + MIN_Y;
for (int j = 0; j < PLACE_ATTEMPTS; j++) {
if (event.world.isAirBlock(x, y, z)
&& BlockManager.pileOfRubble.canBlockStay(event.world, x, y, z)) {
event.world.setBlock(x, y, z, BlockManager.pileOfRubble);
break;
}
y--;
}
}
}
}
示例11: preventDoubleDecor
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void preventDoubleDecor(final DecorateBiomeEvent.Decorate decor) {
}
示例12: onDecorateBiome_Decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.TOP)
public static void onDecorateBiome_Decorate(DecorateBiomeEvent.Decorate event) {
if (event.getWorld().getBiome(event.getPos()) instanceof AlchemyBiome)
AlchemyEventSystem.markEventIgnore(event, Result.DENY);
}
示例13: isGenerationAllowed
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
private static boolean isGenerationAllowed(final DecorateBiomeEvent.Decorate event) {
return (event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT)
&& event.type == EventType.FLOWERS && isGenAllowedInDimension(event.world.provider.dimensionId);
}
示例14: onDecorateBiome
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDecorateBiome(DecorateBiomeEvent.Decorate ev)
{
if (ev.getType() == DecorateBiomeEvent.Decorate.EventType.TREE)
{
BiomeGenBase gen = ev.getWorld().getBiomeGenForCoords(ev.getPos());
BiomeDecorator decorator = gen.theBiomeDecorator;
int i = decorator.treesPerChunk;
if (ev.getRand().nextInt(10) == 0)
{
++i;
}
TreeGeneratorBase treeGen = null;
if (gen instanceof BiomeGenForest)
{
if (gen.getBiomeName().equals("Roofed Forest"))
treeGen = generatorDarkOak;
else
treeGen = generatorOak.combineWith(generatorBirch, 0.1f);
}
else if (gen instanceof BiomeGenJungle)
{
treeGen = generatorJungle;
}
else if (gen instanceof BiomeGenPlains)
{
treeGen = generatorOak;
}
else if (gen instanceof BiomeGenSavanna)
{
treeGen = generatorAcacia;
}
else if (gen instanceof BiomeGenSnow)
{
treeGen = generatorOak;
}
else if (gen instanceof BiomeGenSwamp)
{
treeGen = generatorOak;
}
else if (gen instanceof BiomeGenTaiga)
{
treeGen = generatorSpruce;
}
if (treeGen != null)
{
ev.setResult(Event.Result.DENY);
for (int j = 0; j < i; ++j)
{
int k = ev.getRand().nextInt(16) + 8;
int l = ev.getRand().nextInt(16) + 8;
BlockPos blockpos = ev.getWorld().getHeight(ev.getPos().add(k, 0, l));
treeGen.generateTreeAt(ev.getWorld(), blockpos, ev.getRand());
}
}
}
}