Scrap this project.

It doesn't fit the theme, it doesn't work like it should, it's broken to no end.
Yea, I'll probably do it some other time. Maybe.
This commit is contained in:
Ellpeck 2016-05-21 12:21:36 +02:00
parent 2ff5f2758e
commit 9b9f7b8ff3
14 changed files with 1 additions and 783 deletions

View file

@ -21,7 +21,6 @@ import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.ItemCrafting;
import de.ellpeck.actuallyadditions.mod.event.InitEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.cave.CaveWorldType;
import de.ellpeck.actuallyadditions.mod.gen.InitVillager;
import de.ellpeck.actuallyadditions.mod.gen.OreGen;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
@ -104,10 +103,6 @@ public class ActuallyAdditions{
InitCrafting.init();
DungeonLoot.init();
if(ConfigValues.caveWorld){
new CaveWorldType();
}
proxy.init(event);
ModUtil.LOGGER.info("Initialization Finished.");

View file

@ -1,95 +0,0 @@
/*
* This file ("BlockImpureIron.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.gen.cave.CaveWorldType;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.WorldServer;
import javax.annotation.Nonnull;
public class BlockImpureIron extends BlockGeneric{
public BlockImpureIron(String name){
super(name, Material.ROCK, SoundType.STONE, 3.5F, 12.5F, "pickaxe", 1);
}
@Override
protected ItemBlockBase getItemBlock(){
return new TheItemBlock(this);
}
public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Nonnull
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int damage){
return damage;
}
@Override
public boolean onEntityItemUpdate(EntityItem item){
if(item != null && CaveWorldType.isCave(item.getEntityWorld())){
if(item.isInWater()){
if(!item.getEntityWorld().isRemote){
ItemStack stack = item.getEntityItem();
if(stack != null){
if(!stack.hasTagCompound()){
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound compound = stack.getTagCompound();
int conversionTimer = compound.getInteger("ConversionTimer");
if(conversionTimer >= 2000){
item.setEntityItemStack(new ItemStack(InitItems.itemDust, 1, TheDusts.IRON.ordinal()));
if(item.getEntityWorld() instanceof WorldServer){
((WorldServer)item.getEntityWorld()).spawnParticle(EnumParticleTypes.SMOKE_NORMAL, item.posX, item.posY, item.posZ, 30, 0D, 0D, 0D, 0.05D);
}
}
else{
compound.setInteger("ConversionTimer", conversionTimer+1);
}
}
}
else{
if(item.getEntityWorld().getTotalWorldTime()%20 == 0){
item.getEntityWorld().spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, MathHelper.floor_double(item.posX)+Util.RANDOM.nextDouble(), MathHelper.floor_double(item.posY)+Util.RANDOM.nextDouble(), MathHelper.floor_double(item.posZ)+Util.RANDOM.nextDouble(), 0D, 0D, 0D);
}
}
}
}
return false;
}
}
}

View file

@ -115,15 +115,9 @@ public class InitBlocks{
public static Block blockPillarQuartzStair;
public static Block blockPillarQuartzSlab;
public static Block blockImpureIron;
public static void init(){
ModUtil.LOGGER.info("Initializing Blocks...");
if(ConfigValues.caveWorld){
blockImpureIron = new BlockImpureIron("blockImpureIron");
}
blockItemViewer = new BlockItemViewer("blockItemViewer");
blockFireworkBox = new BlockFireworkBox("blockFireworkBox");
blockMiner = new BlockMiner("blockMiner");

View file

@ -41,8 +41,6 @@ public class ConfigValues{
public static boolean lessParticles;
public static boolean lessBlockBreakingEffects;
public static boolean caveWorld = true; //TODO Make this proper
public static void defineConfigValues(Configuration config){
for(ConfigCrafting currConf : CRAFTING_CONFIG){

View file

@ -37,10 +37,6 @@ public class CrusherCrafting{
public static void init(){
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
if(ConfigValues.caveWorld){
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitBlocks.blockImpureIron), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()));
}
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15));
miscRecipes.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3));

View file

@ -306,10 +306,6 @@ public class CreativeTab extends CreativeTabs{
this.add(InitItems.itemChestCrystalWhite);
this.add(InitItems.itemPantsCrystalWhite);
this.add(InitItems.itemBootsCrystalWhite);
if(ConfigValues.caveWorld){
this.add(InitBlocks.blockImpureIron);
}
}
public void add(Item item){

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.gen.cave.CaveWorldType;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
@ -46,19 +45,12 @@ public class OreGen implements IWorldGenerator{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
int dimension = world.provider.getDimension();
if(dimension != -1 && dimension != 1){
if(CaveWorldType.isCave(world)){
this.generateCave(world, random, chunkX*16, chunkZ*16);
}
else if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimension()) < 0){
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimension()) < 0){
this.generateDefault(world, random, chunkX*16, chunkZ*16);
}
}
}
private void generateCave(World world, Random random, int x, int z){
this.addOreSpawn(InitBlocks.blockImpureIron, 0, Blocks.STONE, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 10), 60, 0, world.getHeight());
}
private void generateDefault(World world, Random random, int x, int z){
if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.STONE, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);

View file

@ -1,79 +0,0 @@
/*
* This file ("CaveWorldType.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen.cave;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentServerData;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import javax.annotation.Nonnull;
public class CaveWorldType extends WorldType{
public CaveWorldType(){
//Name can't be longer than 16 :'(
super("actaddcaveworld");
Util.registerEvent(this);
ModUtil.LOGGER.info("Cave World config enabled! Registering cave world type...");
}
public static boolean isCave(World world){
return ConfigValues.caveWorld && world.getWorldType() instanceof CaveWorldType;
}
@Nonnull
@Override
public IChunkGenerator getChunkGenerator(@Nonnull World world, String generatorOptions){
return new ChunkProviderCave(world);
}
@Override
public int getSpawnFuzz(@Nonnull WorldServer world, MinecraftServer server){
return 1;
}
@SubscribeEvent
public void onUpdate(LivingEvent.LivingUpdateEvent event){
if(event.getEntity() instanceof EntityPlayerMP){
EntityPlayerMP player = (EntityPlayerMP)event.getEntity();
if(isCave(player.worldObj) && !player.worldObj.isRemote){
if(player.posY >= player.worldObj.getHeight() && !player.isSpectator()){
BlockPos spawn = player.worldObj.getSpawnPoint();
player.connection.setPlayerLocation(spawn.getX()+0.5, spawn.getY()+1, spawn.getZ()+0.5, player.rotationYaw, player.rotationPitch);
}
NBTTagCompound playerData = PersistentServerData.getDataFromPlayer(player);
if(!playerData.getBoolean("SpawnedFirst")){
player.inventory.addItemStackToInventory(new ItemStack(InitItems.itemBooklet));
playerData.setBoolean("SpawnedFirst", true);
WorldData.makeDirty();
}
}
}
}
}

View file

@ -1,119 +0,0 @@
/*
* This file ("ChunkProviderCave.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen.cave;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.feature.WorldGenerator;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class ChunkProviderCave implements IChunkGenerator{
private final World world;
private final Random rand;
private final WorldGenerator spawnGenerator;
private final WorldGenerator lushCaveGenerator;
private final MapGenBase caveGenerator = new MapGenCustomCaves();
public ChunkProviderCave(World world){
this.world = world;
this.rand = new Random(world.getSeed());
this.lushCaveGenerator = new WorldGenLushCaves(this.rand);
this.spawnGenerator = new WorldGenCaveSpawn(this.rand);
}
@Nonnull
@Override
public Chunk provideChunk(int chunkX, int chunkZ){
ChunkPrimer primer = new ChunkPrimer();
for(int x = 0; x < 16; x++){
for(int z = 0; z < 16; z++){
for(int y = 0; y < this.world.getHeight(); y++){
if(y == this.world.getHeight()-1 || y == 0){
primer.setBlockState(x, y, z, Blocks.BEDROCK.getDefaultState());
}
else{
if(this.rand.nextInt(5) <= 0){
if(this.rand.nextFloat() <= 0.95F){
primer.setBlockState(x, y, z, (this.rand.nextFloat() >= 0.85F ? Blocks.MOSSY_COBBLESTONE : Blocks.COBBLESTONE).getDefaultState());
}
else{
primer.setBlockState(x, y, z, Blocks.GLOWSTONE.getDefaultState());
}
}
else{
primer.setBlockState(x, y, z, Blocks.STONE.getDefaultState());
}
}
}
}
}
this.caveGenerator.generate(this.world, chunkX, chunkZ, primer);
Chunk chunk = new Chunk(this.world, primer, chunkX, chunkZ);
chunk.generateSkylightMap();
return chunk;
}
@Override
public void populate(int x, int z){
BlockPos spawn = this.world.getSpawnPoint();
Chunk chunk = this.world.getChunkFromBlockCoords(spawn);
if(chunk.xPosition == x && chunk.zPosition == z){
this.spawnGenerator.generate(this.world, this.rand, spawn);
ModUtil.LOGGER.info("Generating spawn cave...");
}
else{
if(this.rand.nextInt(3) <= 0){
BlockPos pos = new BlockPos(x*16+this.rand.nextInt(16)+8, MathHelper.getRandomIntegerInRange(this.rand, 12, 244), z*16+this.rand.nextInt(16)+8);
this.lushCaveGenerator.generate(this.world, this.rand, pos);
}
}
}
@Override
public boolean generateStructures(@Nonnull Chunk chunkIn, int x, int z){
return false;
}
@Nonnull
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos){
return Collections.emptyList();
}
@Override
public BlockPos getStrongholdGen(@Nonnull World worldIn, @Nonnull String structureName, @Nonnull BlockPos position){
return null;
}
@Override
public void recreateStructures(@Nonnull Chunk chunkIn, int x, int z){
}
}

View file

@ -1,218 +0,0 @@
/*
* This file ("MapGenRiverCaves.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen.cave;
import com.google.common.base.Objects;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.gen.MapGenCaves;
import javax.annotation.Nonnull;
import java.util.Random;
//This is hideous. It's mostly copied from MapGenCaves and changed slightly.
public class MapGenCustomCaves extends MapGenCaves{
@Override
protected void addRoom(long probablySeed, int chunkX, int chunkZ, @Nonnull ChunkPrimer primer, double x, double y, double z){
this.addTunnel(probablySeed, chunkX, chunkZ, primer, x, y, z, 1.0F+this.rand.nextFloat()*15.0F, 0.0F, 0.0F, -1, -1, this.rand.nextDouble()*1.2F+0.25F);
}
@Override
protected void addTunnel(long probablySeed, int chunkX, int chunkZ, @Nonnull ChunkPrimer primer, double x, double y, double z, float float1, float float2, float float3, int int1, int int2, double double4){
double d0 = (double)(chunkX*16+8);
double d1 = (double)(chunkZ*16+8);
float f = 0.0F;
float f1 = 0.0F;
Random random = new Random(probablySeed);
if(int2 <= 0){
int i = this.range*16-16;
int2 = i-random.nextInt(i/4);
}
boolean flag2 = false;
if(int1 == -1){
int1 = int2/2;
flag2 = true;
}
int j = random.nextInt(int2/2)+int2/4;
for(boolean flag = random.nextInt(6) == 0; int1 < int2; ++int1){
double d2 = 1.5D+(double)(MathHelper.sin((float)int1*(float)Math.PI/(float)int2)*float1);
double d3 = d2*double4;
float f2 = MathHelper.cos(float3);
float f3 = MathHelper.sin(float3);
x += (double)(MathHelper.cos(float2)*f2);
y += (double)f3;
z += (double)(MathHelper.sin(float2)*f2);
if(flag){
float3 = float3*0.92F;
}
else{
float3 = float3*0.7F;
}
float3 = float3+f1*0.1F;
float2 += f*0.1F;
f1 = f1*0.9F;
f = f*0.75F;
f1 = f1+(random.nextFloat()-random.nextFloat())*random.nextFloat()*2.0F;
f = f+(random.nextFloat()-random.nextFloat())*random.nextFloat()*4.0F;
if(!flag2 && int1 == j && float1 > 1.0F && int2 > 0){
this.addTunnel(random.nextLong(), chunkX, chunkZ, primer, x, y, z, random.nextFloat()*0.5F+0.5F, float2-((float)Math.PI/2F), float3/3.0F, int1, int2, 1.0D);
this.addTunnel(random.nextLong(), chunkX, chunkZ, primer, x, y, z, random.nextFloat()*0.5F+0.5F, float2+((float)Math.PI/2F), float3/3.0F, int1, int2, 1.0D);
return;
}
if(flag2 || random.nextInt(4) != 0){
double d4 = x-d0;
double d5 = z-d1;
double d6 = (double)(int2-int1);
double d7 = (double)(float1+2.0F+16.0F);
if(d4*d4+d5*d5-d6*d6 > d7*d7){
return;
}
if(x >= d0-16.0D-d2*2.0D && z >= d1-16.0D-d2*2.0D && x <= d0+16.0D+d2*2.0D && z <= d1+16.0D+d2*2.0D){
int k2 = MathHelper.floor_double(x-d2)-chunkX*16-1;
int k = MathHelper.floor_double(x+d2)-chunkX*16+1;
int l2 = MathHelper.floor_double(y-d3)-1;
int l = MathHelper.floor_double(y+d3)+1;
int i3 = MathHelper.floor_double(z-d2)-chunkZ*16-1;
int i1 = MathHelper.floor_double(z+d2)-chunkZ*16+1;
if(k2 < 0){
k2 = 0;
}
if(k > 16){
k = 16;
}
if(l2 < 1){
l2 = 1;
}
if(l > 248){
l = 248;
}
if(i3 < 0){
i3 = 0;
}
if(i1 > 16){
i1 = 16;
}
for(int j1 = k2; j1 < k; ++j1){
for(int k1 = i3; k1 < i1; ++k1){
for(int l1 = l+1; l1 >= l2-1; --l1){
if(l1 >= 0 && l1 < 256){
if(l1 != l2-1 && j1 != k2 && j1 != k-1 && k1 != i3 && k1 != i1-1){
l1 = l2;
}
}
}
}
}
for(int j3 = k2; j3 < k; ++j3){
double d10 = ((double)(j3+chunkX*16)+0.5D-x)/d2;
for(int i2 = i3; i2 < i1; ++i2){
double d8 = ((double)(i2+chunkZ*16)+0.5D-z)/d2;
boolean flag1 = false;
if(d10*d10+d8*d8 < 1.0D){
for(int j2 = l; j2 > l2; --j2){
double d9 = ((double)(j2-1)+0.5D-y)/d3;
if(d9 > -0.7D && d10*d10+d9*d9+d8*d8 < 1.0D){
IBlockState iblockstate1 = primer.getBlockState(j3, j2, i2);
IBlockState iblockstate2 = Objects.firstNonNull(primer.getBlockState(j3, j2+1, i2), BLK_AIR);
this.digBlock(primer, j3, j2, i2, chunkX, chunkZ, flag1, iblockstate1, iblockstate2);
}
}
}
}
}
if(flag2){
break;
}
}
}
}
}
@Override
protected boolean canReplaceBlock(IBlockState first, @Nonnull IBlockState second){
return true;
}
@Override
protected void digBlock(@Nonnull ChunkPrimer primer, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, @Nonnull IBlockState state, @Nonnull IBlockState up){
net.minecraft.world.biome.Biome biome = this.worldObj.getBiomeGenForCoords(new BlockPos(x+chunkX*16, 0, z+chunkZ*16));
IBlockState top = biome.topBlock;
IBlockState filler = biome.fillerBlock;
if(this.canReplaceBlock(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()){
primer.setBlockState(x, y, z, BLK_AIR);
}
}
@Override
protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int int1, int int2, @Nonnull ChunkPrimer primer){
int i = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(20)+1)+1);
if(this.rand.nextInt(10) != 0){
i = 0;
}
for(int j = 0; j < i; ++j){
double d0 = (double)(chunkX*16+this.rand.nextInt(16));
double d1 = (double)this.rand.nextInt(this.rand.nextInt(236)+16);
double d2 = (double)(chunkZ*16+this.rand.nextInt(16));
int k = 1;
if(this.rand.nextInt(4) == 0){
this.addRoom(this.rand.nextLong(), int1, int2, primer, d0, d1, d2);
k += this.rand.nextInt(4);
}
for(int l = 0; l < k; ++l){
float f = this.rand.nextFloat()*((float)Math.PI*2F);
float f1 = (this.rand.nextFloat()-0.5F)*2.0F/8.0F;
float f2 = this.rand.nextFloat()*2.0F+this.rand.nextFloat();
if(this.rand.nextInt(10) == 0){
f2 *= this.rand.nextFloat()*this.rand.nextFloat()*3.0F+1.0F;
}
this.addTunnel(this.rand.nextLong(), int1, int2, primer, d0, d1, d2, f2, f, f1, 0, 0, this.rand.nextDouble()*2F+1F);
}
}
}
}

View file

@ -1,122 +0,0 @@
/*
* This file ("WorldGeneratorCaveSpawn.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen.cave;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import net.minecraft.block.BlockLadder;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
import javax.annotation.Nonnull;
import java.util.Random;
public class WorldGenCaveSpawn extends WorldGenerator{
private final Random rand;
public WorldGenCaveSpawn(Random rand){
this.rand = rand;
}
@Override
public boolean generate(@Nonnull World world, @Nonnull Random rand, @Nonnull BlockPos position){
this.generateCave(world, position);
return true;
}
@SuppressWarnings("deprecation")
private void generateCave(World world, BlockPos center){
this.makeSphere(world, center, 8);
this.makeSphere(world, center.add(-3, 4, 3), 4);
this.makeSphere(world, center.add(4, 6, 1), 4);
this.makeSphere(world, center.add(3, 4, -3), 6);
this.makeSphere(world, center.add(4, -2, -3), 2);
this.makeSphere(world, center.add(5, 0, -3), 4);
this.makeSphere(world, center.add(1, 4, 3), 6);
this.makeSphere(world, center.add(-5, 1, 1), 4);
this.makeSphere(world, center.add(-1, 1, -7), 6);
this.makeSphere(world, center.add(-2, -1, 8), 3);
world.setBlockState(center.add(-1, -5, -8), Blocks.DIRT.getStateFromMeta(1));
WorldGenTrees trees = new WorldGenTrees(false);
trees.generate(world, this.rand, center.add(-1, -4, -8));
int length = this.rand.nextInt(20)+20;
for(int z = 0; z <= length; z++){
for(int x = 0; x < 5; x++){
for(int y = 0; y < 4; y++){
BlockPos pos = center.add(x-3, y-4, 11+z);
if(z%4 == 0 && (x == 0 || x == 4)){
world.setBlockState(pos, Blocks.LOG2.getStateFromMeta(1));
}
else if((z%4 == 0 || x == 0 || x == 4) && y == 3){
world.setBlockState(pos, Blocks.PLANKS.getStateFromMeta(1));
}
else if(!((y == 0 || y == 3) && this.rand.nextInt(5) <= 0)){
world.setBlockToAir(pos);
}
}
}
}
BlockPos chestPos = center.add(-1, -4, 11+length);
world.setBlockState(chestPos, Blocks.CHEST.getDefaultState());
TileEntity tile = world.getTileEntity(chestPos);
if(tile instanceof TileEntityChest){
TileEntityChest chest = (TileEntityChest)tile;
chest.setInventorySlotContents(12, new ItemStack(InitItems.itemFoods, MathHelper.getRandomIntegerInRange(this.rand, 5, 15), this.rand.nextInt(TheFoods.values().length)));
chest.setInventorySlotContents(14, new ItemStack(InitItems.itemAxeCrystalBlack));
}
for(int x = -2; x <= 2; x++){
for(int z = -2; z <= 2; z++){
for(int y = -7; y <= 0; y++){
if(x%2 == 0 && z%2 == 0 && x != 0 && z != 0){
world.setBlockState(center.add(x, y, z), Blocks.LOG.getDefaultState());
}
else if(y == 0 && (x == -2 || x == 2 || z == -2 || z == 2)){
world.setBlockState(center.add(x, y, z), Blocks.OAK_FENCE.getDefaultState());
}
else if(y == -1){
world.setBlockState(center.add(x, y, z), Blocks.PLANKS.getStateFromMeta(1));
}
}
}
}
for(int y = 3; y <= 12; y++){
world.setBlockState(center.add(0, y, 0), Blocks.LADDER.getDefaultState().withProperty(BlockLadder.FACING, EnumFacing.WEST));
world.setBlockState(center.add(1, y, 0), Blocks.PLANKS.getDefaultState());
}
world.setBlockState(center.add(0, 13, 0), Blocks.COBBLESTONE.getDefaultState());
}
private void makeSphere(World world, BlockPos center, int radius){
for(double x = -radius; x < radius; x++){
for(double y = -radius; y < radius; y++){
for(double z = -radius; z < radius; z++){
if(Math.sqrt((x*x)+(y*y)+(z*z)) < radius){
world.setBlockToAir(center.add(x, y, z));
}
}
}
}
}
}

View file

@ -1,106 +0,0 @@
/*
* This file ("WorldGenLushCaves.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen.cave;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.*;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class WorldGenLushCaves extends WorldGenerator{
private final Random rand;
public WorldGenLushCaves(Random rand){
this.rand = rand;
}
@Override
public boolean generate(@Nonnull World world, @Nonnull Random rand, @Nonnull BlockPos position){
this.generateCave(world, position);
return true;
}
private void generateCave(World world, BlockPos center){
int spheres = this.rand.nextInt(5)+3;
for(int i = 0; i <= spheres; i++){
this.makeSphereWithGrassFloor(world, center.add(this.rand.nextInt(11)-5, this.rand.nextInt(7)-3, this.rand.nextInt(11)-5), this.rand.nextInt(3)+5);
}
this.genTreesAndTallGrass(world, center, 10, spheres*3);
}
private void genTreesAndTallGrass(World world, BlockPos center, int radius, int amount){
List<BlockPos> possiblePoses = new ArrayList<BlockPos>();
for(double x = -radius; x < radius; x++){
for(double y = -radius; y < radius; y++){
for(double z = -radius; z < radius; z++){
if(this.rand.nextDouble() >= 0.5D){
BlockPos pos = center.add(x, y, z);
if(world.getBlockState(pos).getBlock() == Blocks.GRASS){
possiblePoses.add(pos);
}
}
}
}
}
if(!possiblePoses.isEmpty()){
for(int i = 0; i <= amount; i++){
Collections.shuffle(possiblePoses);
if(this.rand.nextBoolean()){
WorldGenAbstractTree trees = this.rand.nextBoolean() ? (this.rand.nextBoolean() ? new WorldGenBigTree(false) : new WorldGenShrub(Blocks.LOG.getDefaultState(), Blocks.LEAVES.getDefaultState())) : new WorldGenTrees(false);
trees.generate(world, this.rand, possiblePoses.get(0).up());
}
else{
ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1, EnumDyeColor.WHITE.getDyeDamage()), world, possiblePoses.get(0));
}
}
}
}
private void makeSphereWithGrassFloor(World world, BlockPos center, int radius){
for(double x = -radius; x < radius; x++){
for(double y = -radius; y < radius; y++){
for(double z = -radius; z < radius; z++){
if(Math.sqrt((x*x)+(y*y)+(z*z)) < radius){
world.setBlockToAir(center.add(x, y, z));
}
}
}
}
for(double x = -radius; x < radius; x++){
for(double z = -radius; z < radius; z++){
for(double y = -radius; y <= -3; y++){
BlockPos pos = center.add(x, y, z);
IBlockState state = world.getBlockState(pos);
BlockPos posUp = pos.up();
IBlockState stateUp = world.getBlockState(posUp);
if(!state.getBlock().isAir(state, world, pos) && stateUp.getBlock().isAir(stateUp, world, posUp)){
world.setBlockState(pos, Blocks.GRASS.getDefaultState());
}
}
}
}
}
}

View file

@ -1,14 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "minecraft:cube_all",
"textures": {
"all": "actuallyadditions:blocks/blockImpureIron"
},
"transform": "forge:default-block"
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B