diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index 27f394932..17a332c42 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; 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.crafting.CrusherCrafting; import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting; @@ -71,8 +70,6 @@ public class ActuallyAdditions{ public static boolean teslaLoaded; public static boolean commonCapsLoaded; - public static boolean isCaveMode = true; - static{ //For some reason, this has to be done here FluidRegistry.enableUniversalBucket(); @@ -103,10 +100,6 @@ public class ActuallyAdditions{ new UpdateChecker(); proxy.preInit(event); - if(isCaveMode){ - new WorldTypeCave(); - } - ModUtil.LOGGER.info("PreInitialization Finished."); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java index aa303c2c7..f3b212706 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java @@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -38,12 +37,12 @@ public class RenderCompost extends TileEntitySpecialRenderer{ Block display = null; int maxAmount = 0; for(CompostRecipe aRecipe : ActuallyAdditionsAPI.COMPOST_RECIPES){ - if(ItemUtil.areItemsEqual(slot, aRecipe.input, true)){ + if(slot.isItemEqual(aRecipe.input)){ display = aRecipe.inputDisplay; maxAmount = aRecipe.input.getMaxStackSize(); break; } - else if(ItemUtil.areItemsEqual(slot, aRecipe.output, true)){ + else if(slot.isItemEqual(aRecipe.output)){ display = aRecipe.outputDisplay; maxAmount = aRecipe.output.getMaxStackSize(); break; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/cave/CaveEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/cave/CaveEvents.java deleted file mode 100644 index 6e3173103..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/cave/CaveEvents.java +++ /dev/null @@ -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 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); - } - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/cave/ChunkProviderCave.java b/src/main/java/de/ellpeck/actuallyadditions/mod/cave/ChunkProviderCave.java deleted file mode 100644 index 59e692e8d..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/cave/ChunkProviderCave.java +++ /dev/null @@ -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 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){ - - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/cave/WorldTypeCave.java b/src/main/java/de/ellpeck/actuallyadditions/mod/cave/WorldTypeCave.java deleted file mode 100644 index 8b904d3f7..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/cave/WorldTypeCave.java +++ /dev/null @@ -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; - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java index b8142f999..16dcefd5a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java @@ -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.blockFluidCollector), new ItemStack(InitBlocks.blockFluidCollector))); + //Battery Box GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockBatteryBox), new ItemStack(InitBlocks.blockEnergizer), @@ -233,11 +234,11 @@ public final class BlockCrafting{ 'X', new ItemStack(InitBlocks.blockTestifiBucksGreenWall))); //Atomic Reconstructor - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockAtomicReconstructor), - "IRI", "RCR", "IRI", - 'R', "dustRedstone", - 'I', "ingotIron", - 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockAtomicReconstructor), + "IRI", "RCR", "IRI", + 'R', "dustRedstone", + 'I', "ingotIron", + 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()))); recipeAtomicReconstructor = RecipeUtil.lastIRecipe(); //Laser Relay diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java index 0441dca18..b124ed2f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java @@ -11,7 +11,6 @@ package de.ellpeck.actuallyadditions.mod.data; 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.misc.BookletUtils; import net.minecraft.entity.player.EntityPlayer; @@ -24,15 +23,17 @@ import net.minecraftforge.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; public final class PlayerData{ public static PlayerSave getDataFromPlayer(EntityPlayer player){ - WorldData data = WorldData.get(player.getEntityWorld()); + WorldData worldData = WorldData.get(player.getEntityWorld()); + ConcurrentHashMap data = worldData.playerSaveData; UUID id = player.getUniqueID(); - if(data.playerSaveData.containsKey(id)){ - PlayerSave save = data.playerSaveData.get(id); + if(data.containsKey(id)){ + PlayerSave save = data.get(id); if(save != null && save.id != null && save.id.equals(id)){ return save; } @@ -40,8 +41,8 @@ public final class PlayerData{ //Add Data if none is existant PlayerSave save = new PlayerSave(id); - data.playerSaveData.put(id, save); - data.markDirty(); + data.put(id, save); + worldData.markDirty(); return save; } @@ -55,8 +56,6 @@ public final class PlayerData{ public boolean shouldDisableBatWings; public int batWingsFlyTime; - public int receivedCaveMessages; - public IBookletPage[] bookmarks = new IBookletPage[12]; public List completedTrials = new ArrayList(); @@ -83,10 +82,6 @@ public final class PlayerData{ if(!savingToFile){ this.shouldDisableBatWings = compound.getBoolean("ShouldDisableWings"); } - - if(ActuallyAdditions.isCaveMode){ - this.receivedCaveMessages = compound.getInteger("ReceivedCaveMessages"); - } } public void writeToNBT(NBTTagCompound compound, boolean savingToFile){ @@ -102,10 +97,6 @@ public final class PlayerData{ if(!savingToFile){ compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings); } - - if(ActuallyAdditions.isCaveMode){ - compound.setInteger("ReceivedCaveMessages", this.receivedCaveMessages); - } } public NBTTagList saveBookmarks(){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java index d36cf07ba..8eada7218 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java @@ -11,7 +11,6 @@ package de.ellpeck.actuallyadditions.mod.data; 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.misc.apiimpl.LaserRelayConnectionHandler; 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.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldSavedData; import net.minecraft.world.WorldServer; @@ -28,7 +26,9 @@ import net.minecraftforge.common.WorldSpecificSaveHandler; import java.io.File; import java.io.FileInputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; public class WorldData extends WorldSavedData{ @@ -37,9 +37,8 @@ public class WorldData extends WorldSavedData{ //TODO Remove this as well public static List legacyLoadWorlds = new ArrayList(); private static WorldData data; - public final Set laserRelayNetworks = new ConcurrentSet(); - public final Map playerSaveData = new ConcurrentHashMap(); - public final Map generatedCaves = new ConcurrentHashMap(); + public final ConcurrentSet laserRelayNetworks = new ConcurrentSet(); + public final ConcurrentHashMap playerSaveData = new ConcurrentHashMap(); public WorldData(String name){ super(name); @@ -150,20 +149,6 @@ public class WorldData extends WorldSavedData{ save.readFromNBT(data, true); 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 @@ -194,22 +179,6 @@ public class WorldData extends WorldSavedData{ } compound.setTag("PlayerData", playerList); - if(ActuallyAdditions.isCaveMode){ - NBTTagList caveList = new NBTTagList(); - for(Map.Entry 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; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java index ab4f6ec6e..55e4c7893 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java @@ -10,10 +10,8 @@ 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.TheAchievements; -import de.ellpeck.actuallyadditions.mod.cave.CaveEvents; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.WorldData; @@ -43,10 +41,6 @@ public class CommonEvents{ public CommonEvents(){ MinecraftForge.EVENT_BUS.register(this); 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){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java index d4feb5742..64d54305c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java @@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.gen; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; 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.ConfigIntListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; @@ -58,9 +57,9 @@ public class OreGen implements IWorldGenerator{ @Override 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(); - if(dimension != -1 && dimension != 1 && !ArrayUtils.contains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), dimension)){ + int dimension = world.provider.getDimension(); + if(dimension != -1 && dimension != 1){ + if(world.getWorldType() != WorldType.FLAT && !ArrayUtils.contains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), world.provider.getDimension())){ this.generateDefault(world, random, chunkX, chunkZ); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java index fd05f991d..ce8ff6c7b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java @@ -79,7 +79,7 @@ public class WorldGenLushCaves{ possiblePoses.add(pos); } } - else if(this.shouldTryGenCluster(rand)){ + else if(rand.nextInt(20) == 0){ EnumFacing[] values = EnumFacing.values(); EnumFacing side = values[rand.nextInt(values.length)]; BlockPos posSide = pos.offset(side); @@ -89,7 +89,7 @@ public class WorldGenLushCaves{ IBlockState stateSide = world.getBlockState(posSide); 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); } } @@ -112,10 +112,10 @@ public class WorldGenLushCaves{ if(rand.nextBoolean()){ if(rand.nextBoolean()){ trees = new WorldGenBigTree(false); - genCrate = true; } else{ trees = new WorldGenShrub(Blocks.LOG.getDefaultState(), Blocks.LEAVES.getDefaultState()); + genCrate = true; } } 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){ for(double x = -radius; x < radius; x++){ for(double y = -radius; y < radius; y++){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java index b51d3964e..ca6f0e759 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java @@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe; -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -28,7 +27,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{ public static CompostRecipe getRecipeForInput(ItemStack input){ if(StackUtil.isValid(input)){ for(CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES){ - if(ItemUtil.areItemsEqual(input, recipe.input, true)){ + if(input.isItemEqual(recipe.input)){ return recipe; } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index e8dee1c0e..619c7f281 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -1,8 +1,6 @@ #General itemGroup.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. #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.inputOnly=Only out of adjacent Blocks 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.actuallyadditions.inputter.name=ESD