revert caves ~

This commit is contained in:
Ellpeck 2017-03-08 20:06:55 +01:00
parent 18c04a07c0
commit 1de393b5c7
13 changed files with 27 additions and 460 deletions

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements; import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet; import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
import de.ellpeck.actuallyadditions.mod.cave.WorldTypeCave;
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler; import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting; import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting; import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting;
@ -71,8 +70,6 @@ public class ActuallyAdditions{
public static boolean teslaLoaded; public static boolean teslaLoaded;
public static boolean commonCapsLoaded; public static boolean commonCapsLoaded;
public static boolean isCaveMode = true;
static{ static{
//For some reason, this has to be done here //For some reason, this has to be done here
FluidRegistry.enableUniversalBucket(); FluidRegistry.enableUniversalBucket();
@ -103,10 +100,6 @@ public class ActuallyAdditions{
new UpdateChecker(); new UpdateChecker();
proxy.preInit(event); proxy.preInit(event);
if(isCaveMode){
new WorldTypeCave();
}
ModUtil.LOGGER.info("PreInitialization Finished."); ModUtil.LOGGER.info("PreInitialization Finished.");
} }

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe; import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -38,12 +37,12 @@ public class RenderCompost extends TileEntitySpecialRenderer{
Block display = null; Block display = null;
int maxAmount = 0; int maxAmount = 0;
for(CompostRecipe aRecipe : ActuallyAdditionsAPI.COMPOST_RECIPES){ for(CompostRecipe aRecipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
if(ItemUtil.areItemsEqual(slot, aRecipe.input, true)){ if(slot.isItemEqual(aRecipe.input)){
display = aRecipe.inputDisplay; display = aRecipe.inputDisplay;
maxAmount = aRecipe.input.getMaxStackSize(); maxAmount = aRecipe.input.getMaxStackSize();
break; break;
} }
else if(ItemUtil.areItemsEqual(slot, aRecipe.output, true)){ else if(slot.isItemEqual(aRecipe.output)){
display = aRecipe.outputDisplay; display = aRecipe.outputDisplay;
maxAmount = aRecipe.output.getMaxStackSize(); maxAmount = aRecipe.output.getMaxStackSize();
break; break;

View file

@ -1,174 +0,0 @@
/*
* This file ("CaveEvents.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-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.cave;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.PlayerList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
public class CaveEvents{
private static final int TRIES_BEFORE_FAILURE = 100;
private static final int DISTANCE_INBETWEEN = 1000;
private static final int CAVE_SPAWN_SPREAD = 10000;
@SubscribeEvent
public void onPlayerUpdate(PlayerTickEvent event){
if(event.phase == Phase.END){
EntityPlayer player = event.player;
if(!player.world.isRemote){
if(WorldTypeCave.is(player.world)){
WorldData worldData = WorldData.get(player.world);
if(worldData != null){
BlockPos spawn = worldData.generatedCaves.get(player.getUniqueID());
if(spawn == null){
generateCave(player, worldData.generatedCaves, worldData);
}
else{
if(player.posY >= player.world.getHeight()){
putPlayerInCave(player, spawn, worldData);
}
}
PlayerSave playerData = PlayerData.getDataFromPlayer(player);
if(playerData != null){
if(player.ticksExisted >= 100){
if(playerData.receivedCaveMessages < 11){
if(player.world.getTotalWorldTime()%50 == 0){
TextComponentTranslation text = new TextComponentTranslation("info."+ModUtil.MOD_ID+".cave.whisper."+(playerData.receivedCaveMessages+1));
text.getStyle().setColor(TextFormatting.GRAY).setItalic(true);
player.sendMessage(text);
playerData.receivedCaveMessages++;
worldData.markDirty();
}
}
}
}
}
}
}
}
}
private static BlockPos generateCave(EntityPlayer player, Map<UUID, BlockPos> generatedCaves, WorldData data){
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
PlayerList list = server.getPlayerList();
BlockPos worldSpawn = player.world.getSpawnPoint();
Random rand = new Random(player.world.getSeed());
TextComponentString prefix = new TextComponentString("["+TextFormatting.GREEN+ModUtil.NAME+TextFormatting.RESET+"] ");
list.sendChatMsg(prefix.createCopy().appendSibling(new TextComponentTranslation("info."+ModUtil.MOD_ID+".cave.generating", player.getName())));
BlockPos spawn = null;
tries:
for(int i = 0; i < TRIES_BEFORE_FAILURE; i++){
int randX = MathHelper.getInt(rand, -CAVE_SPAWN_SPREAD, CAVE_SPAWN_SPREAD);
int randY = MathHelper.getInt(rand, 56, 200);
int randZ = MathHelper.getInt(rand, -CAVE_SPAWN_SPREAD, CAVE_SPAWN_SPREAD);
spawn = new BlockPos(worldSpawn.getX()+randX, randY, worldSpawn.getZ()+randZ);
for(BlockPos pos : generatedCaves.values()){
if(pos.distanceSq(spawn) <= DISTANCE_INBETWEEN*DISTANCE_INBETWEEN){
continue tries;
}
}
break;
}
data.generatedCaves.put(player.getUniqueID(), spawn);
data.markDirty();
int chunkX = spawn.getX() >> 4;
int chunkZ = spawn.getZ() >> 4;
for(int x = -12; x <= 12; x++){
for(int z = -12; z <= 12; z++){
player.world.getChunkProvider().provideChunk(chunkX+x, chunkZ+z);
}
}
StructureBoundingBox box = new StructureBoundingBox(spawn.getX()-7, 0, spawn.getZ()-7, spawn.getX()+7, player.world.getHeight(), spawn.getZ()+7);
new WorldGenLushCaves(){
private int crystalCounter;
@Override
protected Block getClusterToPlace(Random rand){
this.crystalCounter++;
if(this.crystalCounter >= CRYSTAL_CLUSTERS.length){
this.crystalCounter = 0;
}
return CRYSTAL_CLUSTERS[this.crystalCounter];
}
@Override
protected boolean shouldTryGenCluster(Random rand){
return rand.nextInt(3) == 0;
}
}.generate(player.world, rand, spawn, box);
putPlayerInCave(player, spawn, data);
server.saveAllWorlds(false);
list.sendChatMsg(prefix.appendSibling(new TextComponentTranslation("info."+ModUtil.MOD_ID+".cave.generated", player.getName())));
return spawn;
}
private static void putPlayerInCave(EntityPlayer player, BlockPos spawn, WorldData data){
if(!player.isSpectator() && player instanceof EntityPlayerMP){
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 400, 4));
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 400));
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 400));
PlayerSave save = PlayerData.getDataFromPlayer(player);
if(save != null && !save.bookGottenAlready){
player.inventory.addItemStackToInventory(new ItemStack(InitItems.itemBooklet));
player.inventory.addItemStackToInventory(new ItemStack(InitBlocks.blockTinyTorch, 2));
save.bookGottenAlready = true;
data.markDirty();
}
((EntityPlayerMP)player).connection.setPlayerLocation(spawn.getX()+0.5, spawn.getY()+1, spawn.getZ()+0.5, 0F, 0F);
}
}
}

View file

@ -1,125 +0,0 @@
/*
* This file ("ChunkProviderCaves.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-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.cave;
import net.minecraft.block.BlockStone;
import net.minecraft.block.BlockStone.EnumType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Biomes;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
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 java.util.Arrays;
import java.util.List;
import java.util.Random;
public class ChunkProviderCave implements IChunkGenerator{
private final World world;
private final Random rand;
public ChunkProviderCave(World world){
this.world = world;
this.rand = new Random(world.getSeed());
}
@Override
public Chunk provideChunk(int chunkX, int chunkZ){
ChunkPrimer primer = new ChunkPrimer();
int height = this.world.getHeight();
for(int y = 0; y < height; y++){
boolean isTopOrBottom = y == 0 || y == height-1;
for(int x = 0; x < 16; ++x){
for(int z = 0; z < 16; ++z){
if(isTopOrBottom){
primer.setBlockState(x, y, z, Blocks.BEDROCK.getDefaultState());
}
else{
IBlockState state;
int rand = this.rand.nextInt(485);
if(rand <= 250){
state = Blocks.STONE.getDefaultState();
}
else if(rand <= 350){
state = Blocks.COBBLESTONE.getDefaultState();
}
else if(rand <= 360){
state = Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.ANDESITE);
}
else if(rand <= 370){
state = Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.DIORITE);
}
else if(rand <= 380){
state = Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.GRANITE);
}
else if(rand <= 430){
state = Blocks.DIRT.getDefaultState();
}
else if(rand <= 450){
state = Blocks.CLAY.getDefaultState();
}
else if(rand <= 480){
state = Blocks.GRAVEL.getDefaultState();
}
else{
state = Blocks.MOSSY_COBBLESTONE.getDefaultState();
}
primer.setBlockState(x, y, z, state);
}
}
}
}
Chunk chunk = new Chunk(this.world, primer, chunkX, chunkZ);
byte[] biomes = chunk.getBiomeArray();
Arrays.fill(biomes, (byte)Biome.getIdForBiome(Biomes.FOREST));
chunk.generateSkylightMap();
return chunk;
}
@Override
public void populate(int x, int z){
}
@Override
public boolean generateStructures(Chunk chunkIn, int x, int z){
return false;
}
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos){
Biome biome = this.world.getBiome(pos);
return biome.getSpawnableList(creatureType);
}
@Override
public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position, boolean bool){
return null;
}
@Override
public void recreateStructures(Chunk chunkIn, int x, int z){
}
}

View file

@ -1,56 +0,0 @@
/*
* This file ("WorldTypeCave.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-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.cave;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkGenerator;
import java.util.Random;
public class WorldTypeCave extends WorldType{
public WorldTypeCave(){
super("actaddcaves");
}
@Override
public float getCloudHeight(){
return 1024F;
}
@Override
public boolean showWorldInfoNotice(){
return true;
}
@Override
public boolean handleSlimeSpawnReduction(Random random, World world){
return true;
}
@Override
public int getSpawnFuzz(WorldServer world, MinecraftServer server){
return 1;
}
@Override
public IChunkGenerator getChunkGenerator(World world, String generatorOptions){
return new ChunkProviderCave(world);
}
public static boolean is(World world){
return ActuallyAdditions.isCaveMode && world.getWorldType() instanceof WorldTypeCave;
}
}

View file

@ -104,6 +104,7 @@ public final class BlockCrafting{
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockFluidPlacer), new ItemStack(InitBlocks.blockFluidPlacer))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockFluidPlacer), new ItemStack(InitBlocks.blockFluidPlacer)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockFluidCollector), new ItemStack(InitBlocks.blockFluidCollector))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockFluidCollector), new ItemStack(InitBlocks.blockFluidCollector)));
//Battery Box //Battery Box
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockBatteryBox), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockBatteryBox),
new ItemStack(InitBlocks.blockEnergizer), new ItemStack(InitBlocks.blockEnergizer),
@ -233,11 +234,11 @@ public final class BlockCrafting{
'X', new ItemStack(InitBlocks.blockTestifiBucksGreenWall))); 'X', new ItemStack(InitBlocks.blockTestifiBucksGreenWall)));
//Atomic Reconstructor //Atomic Reconstructor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockAtomicReconstructor), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockAtomicReconstructor),
"IRI", "RCR", "IRI", "IRI", "RCR", "IRI",
'R', "dustRedstone", 'R', "dustRedstone",
'I', "ingotIron", 'I', "ingotIron",
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()))); 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal())));
recipeAtomicReconstructor = RecipeUtil.lastIRecipe(); recipeAtomicReconstructor = RecipeUtil.lastIRecipe();
//Laser Relay //Laser Relay

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.data; package de.ellpeck.actuallyadditions.mod.data;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -24,15 +23,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
public final class PlayerData{ public final class PlayerData{
public static PlayerSave getDataFromPlayer(EntityPlayer player){ public static PlayerSave getDataFromPlayer(EntityPlayer player){
WorldData data = WorldData.get(player.getEntityWorld()); WorldData worldData = WorldData.get(player.getEntityWorld());
ConcurrentHashMap<UUID, PlayerSave> data = worldData.playerSaveData;
UUID id = player.getUniqueID(); UUID id = player.getUniqueID();
if(data.playerSaveData.containsKey(id)){ if(data.containsKey(id)){
PlayerSave save = data.playerSaveData.get(id); PlayerSave save = data.get(id);
if(save != null && save.id != null && save.id.equals(id)){ if(save != null && save.id != null && save.id.equals(id)){
return save; return save;
} }
@ -40,8 +41,8 @@ public final class PlayerData{
//Add Data if none is existant //Add Data if none is existant
PlayerSave save = new PlayerSave(id); PlayerSave save = new PlayerSave(id);
data.playerSaveData.put(id, save); data.put(id, save);
data.markDirty(); worldData.markDirty();
return save; return save;
} }
@ -55,8 +56,6 @@ public final class PlayerData{
public boolean shouldDisableBatWings; public boolean shouldDisableBatWings;
public int batWingsFlyTime; public int batWingsFlyTime;
public int receivedCaveMessages;
public IBookletPage[] bookmarks = new IBookletPage[12]; public IBookletPage[] bookmarks = new IBookletPage[12];
public List<String> completedTrials = new ArrayList<String>(); public List<String> completedTrials = new ArrayList<String>();
@ -83,10 +82,6 @@ public final class PlayerData{
if(!savingToFile){ if(!savingToFile){
this.shouldDisableBatWings = compound.getBoolean("ShouldDisableWings"); this.shouldDisableBatWings = compound.getBoolean("ShouldDisableWings");
} }
if(ActuallyAdditions.isCaveMode){
this.receivedCaveMessages = compound.getInteger("ReceivedCaveMessages");
}
} }
public void writeToNBT(NBTTagCompound compound, boolean savingToFile){ public void writeToNBT(NBTTagCompound compound, boolean savingToFile){
@ -102,10 +97,6 @@ public final class PlayerData{
if(!savingToFile){ if(!savingToFile){
compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings); compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings);
} }
if(ActuallyAdditions.isCaveMode){
compound.setInteger("ReceivedCaveMessages", this.receivedCaveMessages);
}
} }
public NBTTagList saveBookmarks(){ public NBTTagList saveBookmarks(){

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.data; package de.ellpeck.actuallyadditions.mod.data;
import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.api.laser.Network;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
@ -19,7 +18,6 @@ import io.netty.util.internal.ConcurrentSet;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldSavedData; import net.minecraft.world.WorldSavedData;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
@ -28,7 +26,9 @@ import net.minecraftforge.common.WorldSpecificSaveHandler;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class WorldData extends WorldSavedData{ public class WorldData extends WorldSavedData{
@ -37,9 +37,8 @@ public class WorldData extends WorldSavedData{
//TODO Remove this as well //TODO Remove this as well
public static List<File> legacyLoadWorlds = new ArrayList<File>(); public static List<File> legacyLoadWorlds = new ArrayList<File>();
private static WorldData data; private static WorldData data;
public final Set<Network> laserRelayNetworks = new ConcurrentSet<Network>(); public final ConcurrentSet<Network> laserRelayNetworks = new ConcurrentSet<Network>();
public final Map<UUID, PlayerSave> playerSaveData = new ConcurrentHashMap<UUID, PlayerSave>(); public final ConcurrentHashMap<UUID, PlayerSave> playerSaveData = new ConcurrentHashMap<UUID, PlayerSave>();
public final Map<UUID, BlockPos> generatedCaves = new ConcurrentHashMap<UUID, BlockPos>();
public WorldData(String name){ public WorldData(String name){
super(name); super(name);
@ -150,20 +149,6 @@ public class WorldData extends WorldSavedData{
save.readFromNBT(data, true); save.readFromNBT(data, true);
this.playerSaveData.put(id, save); this.playerSaveData.put(id, save);
} }
this.generatedCaves.clear();
if(ActuallyAdditions.isCaveMode){
NBTTagList caveList = compound.getTagList("GeneratedCaves", 10);
for(int i = 0; i < caveList.tagCount(); i++){
NBTTagCompound cave = caveList.getCompoundTagAt(i);
UUID id = cave.getUniqueId("UUID");
BlockPos pos = new BlockPos(cave.getInteger("X"), cave.getInteger("Y"), cave.getInteger("Z"));
this.generatedCaves.put(id, pos);
}
}
} }
@Override @Override
@ -194,22 +179,6 @@ public class WorldData extends WorldSavedData{
} }
compound.setTag("PlayerData", playerList); compound.setTag("PlayerData", playerList);
if(ActuallyAdditions.isCaveMode){
NBTTagList caveList = new NBTTagList();
for(Map.Entry<UUID, BlockPos> entry : this.generatedCaves.entrySet()){
NBTTagCompound cave = new NBTTagCompound();
cave.setUniqueId("UUID", entry.getKey());
BlockPos pos = entry.getValue();
cave.setInteger("X", pos.getX());
cave.setInteger("Y", pos.getY());
cave.setInteger("Z", pos.getZ());
caveList.appendTag(cave);
}
compound.setTag("GeneratedCaves", caveList);
}
return compound; return compound;
} }
} }

View file

@ -10,10 +10,8 @@
package de.ellpeck.actuallyadditions.mod.event; package de.ellpeck.actuallyadditions.mod.event;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements; import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements; import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.cave.CaveEvents;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.data.WorldData;
@ -43,10 +41,6 @@ public class CommonEvents{
public CommonEvents(){ public CommonEvents(){
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new DungeonLoot()); MinecraftForge.EVENT_BUS.register(new DungeonLoot());
if(ActuallyAdditions.isCaveMode){
MinecraftForge.EVENT_BUS.register(new CaveEvents());
}
} }
public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){ public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
import de.ellpeck.actuallyadditions.mod.cave.WorldTypeCave;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
@ -58,9 +57,9 @@ public class OreGen implements IWorldGenerator{
@Override @Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
if(world.getWorldType() != WorldType.FLAT && !WorldTypeCave.is(world)){ int dimension = world.provider.getDimension();
int dimension = world.provider.getDimension(); if(dimension != -1 && dimension != 1){
if(dimension != -1 && dimension != 1 && !ArrayUtils.contains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), dimension)){ if(world.getWorldType() != WorldType.FLAT && !ArrayUtils.contains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), world.provider.getDimension())){
this.generateDefault(world, random, chunkX, chunkZ); this.generateDefault(world, random, chunkX, chunkZ);
} }
} }

View file

@ -79,7 +79,7 @@ public class WorldGenLushCaves{
possiblePoses.add(pos); possiblePoses.add(pos);
} }
} }
else if(this.shouldTryGenCluster(rand)){ else if(rand.nextInt(20) == 0){
EnumFacing[] values = EnumFacing.values(); EnumFacing[] values = EnumFacing.values();
EnumFacing side = values[rand.nextInt(values.length)]; EnumFacing side = values[rand.nextInt(values.length)];
BlockPos posSide = pos.offset(side); BlockPos posSide = pos.offset(side);
@ -89,7 +89,7 @@ public class WorldGenLushCaves{
IBlockState stateSide = world.getBlockState(posSide); IBlockState stateSide = world.getBlockState(posSide);
if(state.getBlock().isAir(state, world, pos) && stateSide.getBlock().isSideSolid(stateSide, world, posSide, side.getOpposite())){ if(state.getBlock().isAir(state, world, pos) && stateSide.getBlock().isSideSolid(stateSide, world, posSide, side.getOpposite())){
Block block = this.getClusterToPlace(rand); Block block = CRYSTAL_CLUSTERS[rand.nextInt(CRYSTAL_CLUSTERS.length)];
world.setBlockState(pos, block.getDefaultState().withProperty(BlockDirectional.FACING, side.getOpposite()), 2); world.setBlockState(pos, block.getDefaultState().withProperty(BlockDirectional.FACING, side.getOpposite()), 2);
} }
} }
@ -112,10 +112,10 @@ public class WorldGenLushCaves{
if(rand.nextBoolean()){ if(rand.nextBoolean()){
if(rand.nextBoolean()){ if(rand.nextBoolean()){
trees = new WorldGenBigTree(false); trees = new WorldGenBigTree(false);
genCrate = true;
} }
else{ else{
trees = new WorldGenShrub(Blocks.LOG.getDefaultState(), Blocks.LEAVES.getDefaultState()); trees = new WorldGenShrub(Blocks.LOG.getDefaultState(), Blocks.LEAVES.getDefaultState());
genCrate = true;
} }
} }
else{ else{
@ -146,14 +146,6 @@ public class WorldGenLushCaves{
} }
} }
protected Block getClusterToPlace(Random rand){
return CRYSTAL_CLUSTERS[rand.nextInt(CRYSTAL_CLUSTERS.length)];
}
protected boolean shouldTryGenCluster(Random rand){
return rand.nextInt(20) == 0;
}
private void makeSphereWithGrassFloor(World world, BlockPos center, int radius, StructureBoundingBox boundingBox, Random rand){ private void makeSphereWithGrassFloor(World world, BlockPos center, int radius, StructureBoundingBox boundingBox, Random rand){
for(double x = -radius; x < radius; x++){ for(double x = -radius; x < radius; x++){
for(double y = -radius; y < radius; y++){ for(double y = -radius; y < radius; y++){

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe; import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -28,7 +27,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{
public static CompostRecipe getRecipeForInput(ItemStack input){ public static CompostRecipe getRecipeForInput(ItemStack input){
if(StackUtil.isValid(input)){ if(StackUtil.isValid(input)){
for(CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES){ for(CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
if(ItemUtil.areItemsEqual(input, recipe.input, true)){ if(input.isItemEqual(recipe.input)){
return recipe; return recipe;
} }
} }

View file

@ -1,8 +1,6 @@
#General #General
itemGroup.actuallyadditions=Actually Additions itemGroup.actuallyadditions=Actually Additions
achievement.page.actuallyadditions=Actually Additions achievement.page.actuallyadditions=Actually Additions
generator.actaddcaves=AA Cave Mode
generator.actaddcaves.info=Actually Additions Cave Mode (like Skyblock but in a cave and with Actually Additions)
actuallyadditions.lolWutHowUDoDis.name=This is bugged. Throw it away. Please. actuallyadditions.lolWutHowUDoDis.name=This is bugged. Throw it away. Please.
#Fluids #Fluids
@ -665,19 +663,6 @@ info.actuallyadditions.laserRelay.mode.both=Both Directions
info.actuallyadditions.laserRelay.mode.outputOnly=Only into adjacent Blocks info.actuallyadditions.laserRelay.mode.outputOnly=Only into adjacent Blocks
info.actuallyadditions.laserRelay.mode.inputOnly=Only out of adjacent Blocks info.actuallyadditions.laserRelay.mode.inputOnly=Only out of adjacent Blocks
info.actuallyadditions.laserRelay.mode.noCompasss=Hold a %s to modify! info.actuallyadditions.laserRelay.mode.noCompasss=Hold a %s to modify!
info.actuallyadditions.cave.generating=Generating cave for player %s, server might lag for a bit...
info.actuallyadditions.cave.generated=Finished generating cave for player %s.
info.actuallyadditions.cave.whisper.1=
info.actuallyadditions.cave.whisper.2=As darkness surrounds you,
info.actuallyadditions.cave.whisper.3=you stumble through this cave.
info.actuallyadditions.cave.whisper.4=There's trees, and bushes,
info.actuallyadditions.cave.whisper.5=grass, and crystals, rocks.
info.actuallyadditions.cave.whisper.6=But there is no one else,
info.actuallyadditions.cave.whisper.7=and no way out.
info.actuallyadditions.cave.whisper.8="What do I do?", you think.
info.actuallyadditions.cave.whisper.9=
info.actuallyadditions.cave.whisper.10=Maybe checking the booklet might prove beneficial.
info.actuallyadditions.cave.whisper.11=
#Container Names #Container Names
container.actuallyadditions.inputter.name=ESD container.actuallyadditions.inputter.name=ESD