use of net.minecraft.world.gen.feature.WorldGenPumpkin in project SpongeCommon by SpongePowered.
the class PumpkinBuilder method build.
@Override
public Pumpkin build() throws IllegalStateException {
Pumpkin pop = (Pumpkin) new WorldGenPumpkin();
pop.setPumpkinChance(this.chance);
pop.setPumpkinsPerChunk(this.count);
return pop;
}
use of net.minecraft.world.gen.feature.WorldGenPumpkin in project Realistic-Terrain-Generation by Team-RTG.
the class DecoPumpkin method generate.
@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
if (this.allowed) {
if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), PUMPKIN)) {
// Let's figure out what the rand.nextInt() argument should be.
switch(this.randomType) {
case ALWAYS_GENERATE:
this.setChance(1);
break;
case USE_CHANCE_VALUE:
break;
case X_DIVIDED_BY_STRENGTH:
this.setChance((int) (this.randomFloat / strength));
break;
default:
break;
}
WorldGenerator worldGenerator = new WorldGenPumpkin();
this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
for (int i = 0; i < this.loops; i++) {
if (rand.nextInt(this.chance) == 0) {
int intX = worldX + rand.nextInt(16) + 8;
int intY = rand.nextInt(this.maxY);
int intZ = worldZ + rand.nextInt(16) + 8;
if (intY <= this.maxY) {
worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
}
}
}
}
}
}
use of net.minecraft.world.gen.feature.WorldGenPumpkin in project Realistic-Terrain-Generation by Team-RTG.
the class DecoPumpkin method generate.
@Override
public void generate(final IRealisticBiome biome, final RTGWorld rtgWorld, final Random rand, final ChunkPos chunkPos, final float river, final boolean hasVillage) {
if (TerrainGen.decorate(rtgWorld.world(), rand, chunkPos, Decorate.EventType.PUMPKIN)) {
// Let's figure out what the rand.nextInt() argument should be.
switch(this.randomType) {
case ALWAYS_GENERATE:
this.setChance(1);
break;
case USE_CHANCE_VALUE:
break;
default:
break;
}
final int loopCount = (this.strengthFactor > 0f) ? (int) this.strengthFactor : this.loops;
for (int i = 0; i < loopCount; i++) {
if (rand.nextInt(this.chance) == 0) {
final BlockPos pos = getOffsetPos(chunkPos).add(rand.nextInt(16), rand.nextInt(this.maxY), rand.nextInt(16));
new WorldGenPumpkin().generate(rtgWorld.world(), rand, pos);
}
}
}
}
Aggregations