Revert Caves.

They won't work yet.
This commit is contained in:
Ellpeck 2015-12-20 23:38:24 +01:00
parent 7176dcbb2c
commit 9f7c7468a2
9 changed files with 31 additions and 231 deletions

View file

@ -45,7 +45,6 @@ import ellpeck.actuallyadditions.update.UpdateChecker;
import ellpeck.actuallyadditions.util.FakePlayerUtil; import ellpeck.actuallyadditions.util.FakePlayerUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.world.WorldTypeActAddCaves;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -73,9 +72,6 @@ public class ActuallyAdditions{
InitItems.init(); InitItems.init();
FuelHandler.init(); FuelHandler.init();
UpdateChecker.init(); UpdateChecker.init();
if(isCaveMode){
new WorldTypeActAddCaves();
}
proxy.preInit(event); proxy.preInit(event);
ModUtil.LOGGER.info("PreInitialization Finished."); ModUtil.LOGGER.info("PreInitialization Finished.");

View file

@ -11,13 +11,11 @@
package ellpeck.actuallyadditions.event; package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.nei.NEIScreenEvents; import ellpeck.actuallyadditions.nei.NEIScreenEvents;
import ellpeck.actuallyadditions.update.UpdateCheckerClientNotificationEvent; import ellpeck.actuallyadditions.update.UpdateCheckerClientNotificationEvent;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.world.ActAddCavesEvents;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
public class InitEvents{ public class InitEvents{
@ -33,9 +31,6 @@ public class InitEvents{
Util.registerEvent(new WorldLoadingEvents()); Util.registerEvent(new WorldLoadingEvents());
MinecraftForge.TERRAIN_GEN_BUS.register(new WorldDecorationEvent()); MinecraftForge.TERRAIN_GEN_BUS.register(new WorldDecorationEvent());
if(ActuallyAdditions.isCaveMode){
Util.registerEvent(new ActAddCavesEvents());
}
} }
public static void initClient(){ public static void initClient(){

View file

@ -18,7 +18,6 @@ import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.world.WorldTypeActAddCaves;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@ -41,40 +40,33 @@ public class OreGen implements IWorldGenerator{
@Override @Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
boolean caves = WorldTypeActAddCaves.isActAddCave(world); if(world.provider.terrainType != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.dimensionId) < 0){
if(caves || (world.provider.terrainType != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.dimensionId) < 0)){
switch(world.provider.dimensionId){ switch(world.provider.dimensionId){
case -1: case -1:
generateNether(world, random, chunkX*16, chunkZ*16, caves); generateNether(world, random, chunkX*16, chunkZ*16);
//case 0: //case 0:
// generateSurface(world, random, chunkX*16, chunkZ*16); // generateSurface(world, random, chunkX*16, chunkZ*16);
case 1: case 1:
generateEnd(world, random, chunkX*16, chunkZ*16, caves); generateEnd(world, random, chunkX*16, chunkZ*16);
default: default:
generateSurface(world, random, chunkX*16, chunkZ*16, caves); generateSurface(world, random, chunkX*16, chunkZ*16);
} }
} }
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
private void generateNether(World world, Random random, int x, int z, boolean caves){ private void generateNether(World world, Random random, int x, int z){
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
private void generateEnd(World world, Random random, int x, int z, boolean caves){ private void generateEnd(World world, Random random, int x, int z){
} }
private void generateSurface(World world, Random random, int x, int z, boolean caves){ private void generateSurface(World world, Random random, int x, int z){
if(caves){ if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 8, 12), 12, 0, 256); this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
this.addOreSpawn(Blocks.iron_ore, 0, Blocks.stone, world, random, x, z, 8, 20, 0, 256);
}
else{
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

@ -10,6 +10,7 @@
package ellpeck.actuallyadditions.items; package ellpeck.actuallyadditions.items;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.items.base.*; import ellpeck.actuallyadditions.items.base.*;
import ellpeck.actuallyadditions.items.lens.ItemLens; import ellpeck.actuallyadditions.items.lens.ItemLens;
@ -20,6 +21,7 @@ import ellpeck.actuallyadditions.material.InitArmorMaterials;
import ellpeck.actuallyadditions.material.InitToolMaterials; import ellpeck.actuallyadditions.material.InitToolMaterials;
import ellpeck.actuallyadditions.util.CompatUtil; import ellpeck.actuallyadditions.util.CompatUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -135,9 +137,17 @@ public class InitItems{
public static Item itemExplosionLens; public static Item itemExplosionLens;
public static Item itemDamageLens; public static Item itemDamageLens;
public static Item itemPotatoSeeds;
public static Item itemCarrotSeeds;
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Initializing Items..."); ModUtil.LOGGER.info("Initializing Items...");
if(ActuallyAdditions.isCaveMode){
itemPotatoSeeds = new ItemSeed("itemPotatoSeeds", "seedPotato", Blocks.potatoes, null, 0);
itemCarrotSeeds = new ItemSeed("itemCarrotSeeds", "seedCarrot", Blocks.carrots, null, 0);
}
itemCrateKeeper = new ItemGeneric("itemCrateKeeper"); itemCrateKeeper = new ItemGeneric("itemCrateKeeper");
itemColorLens = new ItemLens("itemColorLens", Lenses.LENS_COLOR); itemColorLens = new ItemLens("itemColorLens", Lenses.LENS_COLOR);
itemExplosionLens = new ItemLens("itemExplosionLens", Lenses.LENS_DETONATION); itemExplosionLens = new ItemLens("itemExplosionLens", Lenses.LENS_DETONATION);

View file

@ -37,9 +37,12 @@ public class ItemSeed extends ItemSeeds{
this.name = name; this.name = name;
this.oredictName = oredictName; this.oredictName = oredictName;
this.plant = plant; this.plant = plant;
((BlockPlant)this.plant).seedItem = this;
((BlockPlant)this.plant).returnItem = returnItem; if(plant instanceof BlockPlant){
((BlockPlant)this.plant).returnMeta = returnMeta; ((BlockPlant)this.plant).seedItem = this;
((BlockPlant)this.plant).returnItem = returnItem;
((BlockPlant)this.plant).returnMeta = returnMeta;
}
this.register(); this.register();
} }

View file

@ -10,6 +10,7 @@
package ellpeck.actuallyadditions.items.lens; package ellpeck.actuallyadditions.items.lens;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
@ -100,6 +101,11 @@ public class LensNoneRecipeHandler{
addRecipe(new ItemStack(Items.glowstone_dust), new ItemStack(Items.redstone), 4000); addRecipe(new ItemStack(Items.glowstone_dust), new ItemStack(Items.redstone), 4000);
recipesGlowstoneRedstone[1] = Util.GetRecipes.lastReconstructorRecipe(); recipesGlowstoneRedstone[1] = Util.GetRecipes.lastReconstructorRecipe();
} }
if(ActuallyAdditions.isCaveMode){
addRecipe(new ItemStack(Blocks.dirt), new ItemStack(Blocks.grass), 50000);
addRecipe(new ItemStack(Blocks.grass), new ItemStack(Blocks.tallgrass), 50000);
}
} }
public static void addRecipe(ItemStack input, ItemStack output, int energyUse){ public static void addRecipe(ItemStack input, ItemStack output, int energyUse){

View file

@ -12,7 +12,6 @@ package ellpeck.actuallyadditions.misc;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.playerdata.PersistentServerData; import ellpeck.actuallyadditions.util.playerdata.PersistentServerData;
import ellpeck.actuallyadditions.world.ActAddCavesEvents;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -68,10 +67,6 @@ public class WorldData extends WorldSavedData{
ModUtil.LOGGER.info("Clearing leftover Persistent Server Data from other worlds!"); ModUtil.LOGGER.info("Clearing leftover Persistent Server Data from other worlds!");
PersistentServerData.playerSaveData.clear(); PersistentServerData.playerSaveData.clear();
} }
if(!ActAddCavesEvents.cavesData.hasNoTags()){
ModUtil.LOGGER.info("Clearing leftover Cave World Data from other worlds!");
ActAddCavesEvents.cavesData = new NBTTagCompound();
}
} }
@Override @Override
@ -89,9 +84,6 @@ public class WorldData extends WorldSavedData{
PersistentServerData.PlayerSave aSave = PersistentServerData.PlayerSave.fromNBT(playerList.getCompoundTagAt(i)); PersistentServerData.PlayerSave aSave = PersistentServerData.PlayerSave.fromNBT(playerList.getCompoundTagAt(i));
PersistentServerData.playerSaveData.add(aSave); PersistentServerData.playerSaveData.add(aSave);
} }
//Cave Data
ActAddCavesEvents.cavesData = compound.getCompoundTag("CaveData");
} }
@Override @Override
@ -110,8 +102,5 @@ public class WorldData extends WorldSavedData{
playerList.appendTag(theSave.toNBT()); playerList.appendTag(theSave.toNBT());
} }
compound.setTag("PlayerData", playerList); compound.setTag("PlayerData", playerList);
//Cave Data
compound.setTag("CaveData", ActAddCavesEvents.cavesData);
} }
} }

View file

@ -1,129 +0,0 @@
/*
* This file ("ActAddCavesEvents.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.world;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingEvent;
public class ActAddCavesEvents{
public static NBTTagCompound cavesData = new NBTTagCompound();
@SubscribeEvent
public void onUpdate(LivingEvent.LivingUpdateEvent event){
World world = event.entity.worldObj;
if(!world.isRemote && WorldTypeActAddCaves.isActAddCave(world) && event.entity instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)event.entity;
//Create the caves
if(!cavesData.getBoolean("CavesCreated")){
generateCaves(world);
cavesData.setBoolean("CavesCreated", true);
}
int x = cavesData.getInteger("StartX");
int y = cavesData.getInteger("StartY");
int z = cavesData.getInteger("StartZ");
//Fix the player's location upon respawn
if(player.posY >= 255){
player.setPositionAndUpdate(x+0.5, y+1, z+0.5);
}
}
}
private static void generateCaves(World world){
ChunkCoordinates spawn = world.getSpawnPoint();
int cavesStartX = spawn.posX;
int cavesStartY = 80;
int cavesStartZ = spawn.posZ;
cavesData.setInteger("StartX", cavesStartX);
cavesData.setInteger("StartY", cavesStartY);
cavesData.setInteger("StartZ", cavesStartZ);
//Generate initial box
for(int x = -7; x <= 7; x++){
for(int z = -7; z <= 7; z++){
for(int y = -5; y <= 9; y++){
double distance = Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(0, 0, 0));
if(distance <= MathHelper.getRandomIntegerInRange(Util.RANDOM, 6, 7)){
world.setBlockToAir(cavesStartX+x, cavesStartY+y, cavesStartZ+z);
}
}
}
}
//Generate start tower
for(int y = -5; y < 0; y++){
world.setBlock(cavesStartX-1, cavesStartY+y, cavesStartZ-1, Blocks.fence, 0, 2);
world.setBlock(cavesStartX+1, cavesStartY+y, cavesStartZ-1, Blocks.fence, 0, 2);
world.setBlock(cavesStartX+1, cavesStartY+y, cavesStartZ+1, Blocks.fence, 0, 2);
world.setBlock(cavesStartX-1, cavesStartY+y, cavesStartZ+1, Blocks.planks, 1, 2);
world.setBlock(cavesStartX-1, cavesStartY+y, cavesStartZ+2, Blocks.ladder, 3, 2);
}
world.setBlock(cavesStartX-1, cavesStartY, cavesStartZ+2, Blocks.ladder, 3, 2);
for(int x = -1; x <= 1; x++){
for(int z = -1; z <= 1; z++){
world.setBlock(cavesStartX+x, cavesStartY, cavesStartZ+z, Blocks.planks, 1, 2);
}
}
world.setBlock(cavesStartX, cavesStartY, cavesStartZ, Blocks.glowstone, 0, 2);
//Generate Mineshaft
for(int x = 4; x <= 12; x++){
for(int z = -1; z <= 1; z++){
for(int y = -5; y <= -3; y++){
if(x%4 == 0 && z != 0){
world.setBlock(cavesStartX+x, cavesStartY+y, cavesStartZ+z, Blocks.log, 0, 2);
}
else if(x%8 == 0 && y == -4){
world.setBlock(cavesStartX+x, cavesStartY+y, cavesStartZ+z, Blocks.torch, 3, 2);
}
else if(y == -3){
world.setBlock(cavesStartX+x, cavesStartY+y, cavesStartZ+z, Blocks.wooden_slab, 9, 2);
}
else{
world.setBlockToAir(cavesStartX+x, cavesStartY+y, cavesStartZ+z);
}
}
}
}
//Generate water
world.setBlock(cavesStartX-7, cavesStartY-3, cavesStartZ-1, Blocks.flowing_water, 0, 2);
world.setBlockToAir(cavesStartX-6, cavesStartY-3, cavesStartZ-1);
world.setBlockToAir(cavesStartX-5, cavesStartY-3, cavesStartZ-1);
world.setBlockToAir(cavesStartX-5, cavesStartY-4, cavesStartZ-1);
world.setBlockToAir(cavesStartX-5, cavesStartY-5, cavesStartZ-1);
world.setBlockToAir(cavesStartX-4, cavesStartY-5, cavesStartZ-1);
world.setBlock(cavesStartX-5, cavesStartY-6, cavesStartZ-1, Blocks.water, 0, 2);
world.setBlock(cavesStartX-4, cavesStartY-6, cavesStartZ-1, Blocks.water, 0, 2);
//Generate dirt
for(int x = -3; x <= 3; x++){
for(int z = -3; z <= 3; z++){
if(Util.RANDOM.nextFloat() >= 0.5){
world.setBlock(cavesStartX+x, cavesStartY-6, cavesStartZ+z, Blocks.dirt, 0, 2);
}
}
}
}
}

View file

@ -1,62 +0,0 @@
/*
* This file ("WorldTypeActAddCaves.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.world;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderFlat;
public class WorldTypeActAddCaves extends WorldType{
public WorldTypeActAddCaves(){
super("ActAddCaves");
}
public static boolean isActAddCave(World world){
return world.provider.terrainType instanceof WorldTypeActAddCaves;
}
@Override
@SideOnly(Side.CLIENT)
public String getTranslateName(){
return ModUtil.MOD_ID_LOWER+".generator.caves";
}
@Override
@SideOnly(Side.CLIENT)
public boolean showWorldInfoNotice(){
return true;
}
@Override
public float getCloudHeight(){
return 256F;
}
@Override
public int getSpawnFuzz(){
return 1;
}
@Override
public int getMinimumSpawnHeight(World world){
return 20;
}
@Override
public IChunkProvider getChunkGenerator(World world, String generatorOptions){
return new ChunkProviderFlat(world, world.getSeed(), false, "7,253x1,7");
}
}