mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
parent
d4d305a666
commit
89a31452f5
2 changed files with 33 additions and 32 deletions
|
@ -23,7 +23,7 @@ if(hasProperty('buildnumber')){
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.11.2-13.20.0.2227"
|
version = "1.11.2-13.20.0.2259"
|
||||||
runDir = "idea"
|
runDir = "idea"
|
||||||
|
|
||||||
mappings = "snapshot_20161126"
|
mappings = "snapshot_20161126"
|
||||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||||
|
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
|
||||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
@ -71,23 +72,19 @@ public class OreGen implements IWorldGenerator{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ConfigBoolValues.GEN_LUSH_CAVES.isEnabled()){
|
if(ConfigBoolValues.GEN_LUSH_CAVES.isEnabled()){
|
||||||
StructureBoundingBox box = new StructureBoundingBox(x*16+8, 0, z*16+8, x*16+8+15, 255, z*16+8+15);
|
|
||||||
int chunkRadius = 1;
|
|
||||||
for(int dx = -chunkRadius; dx <= chunkRadius; dx++){
|
|
||||||
for(int dz = -chunkRadius; dz <= chunkRadius; dz++){
|
|
||||||
int chunkX = x+dx;
|
|
||||||
int chunkZ = z+dz;
|
|
||||||
int randConst = 0x969ce69d;//so that it won't generate the same numbers as other mod that does the same thing
|
int randConst = 0x969ce69d;//so that it won't generate the same numbers as other mod that does the same thing
|
||||||
Random chunkRand = new Random(randConst ^ world.getSeed() ^ (chunkX*29+chunkZ*31));
|
Random chunkRand = new Random(randConst ^ world.getSeed() ^ (x*29+z*31));
|
||||||
|
|
||||||
|
StructureBoundingBox box = new StructureBoundingBox(x*16+8, 0, z*16+8, x*16+8+15, 255, z*16+8+15);
|
||||||
if(chunkRand.nextInt(ConfigIntValues.LUSH_CAVE_CHANCE.getValue()) <= 0){
|
if(chunkRand.nextInt(ConfigIntValues.LUSH_CAVE_CHANCE.getValue()) <= 0){
|
||||||
BlockPos randPos = world.getTopSolidOrLiquidBlock(new BlockPos(chunkX*16+chunkRand.nextInt(16)+8, 0, chunkZ*16+chunkRand.nextInt(16)+8));
|
BlockPos randPos = world.getTopSolidOrLiquidBlock(new BlockPos(x*16+chunkRand.nextInt(16)+8, 0, z*16+chunkRand.nextInt(16)+8));
|
||||||
BlockPos pos = randPos.down(MathHelper.getInt(chunkRand, 15, randPos.getY()-15));
|
BlockPos pos = randPos.down(MathHelper.getInt(chunkRand, 15, randPos.getY()-15));
|
||||||
|
|
||||||
this.caveGen.generate(world, chunkRand, pos, box);
|
this.caveGen.generate(world, chunkRand, pos, box);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addOreSpawn(Block block, int meta, Block blockIn, World world, Random random, int blockXPos, int blockZPos, int maxVeinSize, int chancesToSpawn, int minY, int maxY){
|
public void addOreSpawn(Block block, int meta, Block blockIn, World world, Random random, int blockXPos, int blockZPos, int maxVeinSize, int chancesToSpawn, int minY, int maxY){
|
||||||
for(int i = 0; i < chancesToSpawn; i++){
|
for(int i = 0; i < chancesToSpawn; i++){
|
||||||
|
@ -101,6 +98,7 @@ public class OreGen implements IWorldGenerator{
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
|
public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
|
||||||
if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
|
if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
|
||||||
|
if(event.getType() == EventType.FLOWERS){
|
||||||
if(!ArrayUtils.contains(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue(), event.getWorld().provider.getDimension())){
|
if(!ArrayUtils.contains(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue(), event.getWorld().provider.getDimension())){
|
||||||
this.generateRice(event);
|
this.generateRice(event);
|
||||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
|
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
|
||||||
|
@ -108,7 +106,9 @@ public class OreGen implements IWorldGenerator{
|
||||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.COFFEE.ordinal(), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.GRASS, event);
|
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.COFFEE.ordinal(), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.GRASS, event);
|
||||||
this.genPlantNormally(InitBlocks.blockBlackLotus, 0, ConfigIntValues.BLACK_LOTUS_AMOUNT.getValue(), ConfigBoolValues.DO_LOTUS_GEN.isEnabled(), Material.GRASS, event);
|
this.genPlantNormally(InitBlocks.blockBlackLotus, 0, ConfigIntValues.BLACK_LOTUS_AMOUNT.getValue(), ConfigBoolValues.DO_LOTUS_GEN.isEnabled(), Material.GRASS, event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event.getType() == EventType.LILYPAD){
|
||||||
//Generate Treasure Chests
|
//Generate Treasure Chests
|
||||||
if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){
|
if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){
|
||||||
if(event.getRand().nextInt(300) == 0){
|
if(event.getRand().nextInt(300) == 0){
|
||||||
|
@ -128,11 +128,12 @@ public class OreGen implements IWorldGenerator{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void generateRice(DecorateBiomeEvent event){
|
private void generateRice(DecorateBiomeEvent event){
|
||||||
if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
|
if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
|
||||||
for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
|
for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
|
||||||
if(event.getRand().nextInt(50) == 0){
|
if(event.getRand().nextInt(10) == 0){
|
||||||
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
||||||
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
||||||
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
|
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
|
||||||
|
@ -153,7 +154,7 @@ public class OreGen implements IWorldGenerator{
|
||||||
private void genPlantNormally(Block plant, int meta, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){
|
private void genPlantNormally(Block plant, int meta, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){
|
||||||
if(doIt){
|
if(doIt){
|
||||||
for(int i = 0; i < amount; i++){
|
for(int i = 0; i < amount; i++){
|
||||||
if(event.getRand().nextInt(400) == 0){
|
if(event.getRand().nextInt(100) == 0){
|
||||||
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
|
||||||
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue