diff --git a/src/main/java/forestry/farming/blocks/BlockMushroom.java b/src/main/java/forestry/farming/blocks/BlockMushroom.java index ff0b35d7a..c9ac110cd 100644 --- a/src/main/java/forestry/farming/blocks/BlockMushroom.java +++ b/src/main/java/forestry/farming/blocks/BlockMushroom.java @@ -23,6 +23,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenBigMushroom; import net.minecraft.world.gen.feature.WorldGenerator; import cpw.mods.fml.relauncher.Side; @@ -30,7 +31,6 @@ import cpw.mods.fml.relauncher.SideOnly; import forestry.core.blocks.IItemTyped; import forestry.core.config.Constants; -import forestry.farming.worldgen.WorldGenBigMushroom; public class BlockMushroom extends BlockSapling implements IItemTyped { @@ -44,7 +44,7 @@ public class BlockMushroom extends BlockSapling implements IItemTyped { public BlockMushroom() { super(); setHardness(0.0f); - this.generators = new WorldGenerator[]{new WorldGenBigMushroom(Blocks.brown_mushroom_block), new WorldGenBigMushroom(Blocks.red_mushroom_block)}; + this.generators = new WorldGenerator[]{new WorldGenBigMushroom(MushroomType.BROWN.ordinal()), new WorldGenBigMushroom(MushroomType.RED.ordinal())}; this.drops = new ItemStack[]{new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom)}; setCreativeTab(null); setTickRandomly(true); diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java b/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java old mode 100755 new mode 100644 similarity index 92% rename from src/main/java/forestry/farming/logic/FarmableVanillaShroom.java rename to src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java index ccea3357a..622b95fd2 --- a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java @@ -22,9 +22,9 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.ItemStackUtil; import forestry.core.utils.vect.Vect; -public class FarmableVanillaShroom extends FarmableGenericSapling { +public class FarmableVanillaMushroom extends FarmableGenericSapling { - public FarmableVanillaShroom(Block sapling, int saplingMeta) { + public FarmableVanillaMushroom(Block sapling, int saplingMeta) { super(sapling, saplingMeta); } diff --git a/src/main/java/forestry/farming/worldgen/WorldGenBigMushroom.java b/src/main/java/forestry/farming/worldgen/WorldGenBigMushroom.java deleted file mode 100755 index eb8fd4a4c..000000000 --- a/src/main/java/forestry/farming/worldgen/WorldGenBigMushroom.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode fieldsfirst - -package forestry.farming.worldgen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; - -import forestry.core.config.Constants; - -// Referenced classes of package net.minecraft.src: -// WorldGenerator, World, Block, BlockLeaves, -// BlockGrass, BlockMycelium, BlockFlower - -public class WorldGenBigMushroom extends WorldGenerator { - private final Block mushroom; - - public WorldGenBigMushroom(Block block) { - mushroom = block; - } - - public WorldGenBigMushroom() { - mushroom = null; - } - - @Override - public boolean generate(World world, Random random, int x, int y, int z) { - Block type = mushroom; - - if (type == null) { - type = random.nextBoolean() ? Blocks.brown_mushroom_block : Blocks.red_mushroom_block; - } - - int height = random.nextInt(1) + 2; - boolean flag = true; - if (y < 1 || y + height + 1 > Constants.WORLD_HEIGHT) { - return false; - } - - for (int i = y; i <= y + 1 + height; i++) { - byte offset = 3; - if (i == y) { - offset = 0; - } - - for (int j = x - offset; j <= x + offset && flag; j++) { - for (int k = z - offset; k <= z + offset && flag; k++) { - if (i >= 0 && i < Constants.WORLD_HEIGHT) { - Block block = world.getBlock(j, i, k); - if (!block.isAir(world, j, i, k) && block != Blocks.leaves) { - flag = false; - } - } else { - flag = false; - } - } - } - } - - if (!flag) { - return false; - } - - Block ground = world.getBlock(x, y - 1, z); - if (ground != Blocks.mycelium) { - return false; - } - - if (!Blocks.brown_mushroom.canPlaceBlockAt(world, x, y, z)) { - return false; - } - - func_150515_a(world, x, y - 1, z, Blocks.dirt); - - int capStartY = y + height; - if (type == Blocks.red_mushroom_block) { - capStartY = (y + height) - 1; - } - - for (int i = capStartY; i <= y + height; i++) { - - int capRad = 1; - - if (type == Blocks.brown_mushroom_block) { - capRad = 1; - } - - for (int j = x - capRad; j <= x + capRad; j++) { - for (int k = z - capRad; k <= z + capRad; k++) { - int remain = 5; - if (j == x - capRad) { - remain--; - } - - if (j == x + capRad) { - remain++; - } - - if (k == z - capRad) { - remain -= 3; - } - - if (k == z + capRad) { - remain += 3; - } - - if (type == Blocks.brown_mushroom_block || i < y + height) { - - if (j == x - (capRad - 1) && k == z - capRad) { - remain = 1; - } - - if (j == x - capRad && k == z - (capRad - 1)) { - remain = 1; - } - - if (j == x + (capRad - 1) && k == z - capRad) { - remain = 3; - } - - if (j == x + capRad && k == z - (capRad - 1)) { - remain = 3; - } - - if (j == x - (capRad - 1) && k == z + capRad) { - remain = 7; - } - - if (j == x - capRad && k == z + (capRad - 1)) { - remain = 7; - } - - if (j == x + (capRad - 1) && k == z + capRad) { - remain = 9; - } - - if (j == x + capRad && k == z + (capRad - 1)) { - remain = 9; - } - - } - if (remain == 5 && i < y + height) { - remain = 0; - } - - if ((remain != 0 || y >= (y + height) - 1) && !world.getBlock(j, i, k).isOpaqueCube()) { - setBlockAndNotifyAdequately(world, j, i, k, type, remain); - } - - } - } - - } - - for (int i = 0; i < height; i++) { - Block block = world.getBlock(x, y + i, z); - if (!block.isOpaqueCube()) { - setBlockAndNotifyAdequately(world, x, y + i, z, type, 10); - } - } - - return true; - } -} diff --git a/src/main/java/forestry/plugins/PluginFarming.java b/src/main/java/forestry/plugins/PluginFarming.java index cc519ee17..a36924952 100644 --- a/src/main/java/forestry/plugins/PluginFarming.java +++ b/src/main/java/forestry/plugins/PluginFarming.java @@ -68,7 +68,7 @@ import forestry.farming.logic.FarmableGenericSapling; import forestry.farming.logic.FarmableGourd; import forestry.farming.logic.FarmableStacked; import forestry.farming.logic.FarmableVanillaSapling; -import forestry.farming.logic.FarmableVanillaShroom; +import forestry.farming.logic.FarmableVanillaMushroom; import forestry.farming.proxy.ProxyFarming; import forestry.farming.render.EnumFarmBlockTexture; import forestry.farming.tiles.TileControl; @@ -112,8 +112,8 @@ public class PluginFarming extends ForestryPlugin { Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.carrots, 7)); Farmables.farmables.put("farmShroom", new ArrayList()); - Farmables.farmables.get("farmShroom").add(new FarmableVanillaShroom(Blocks.brown_mushroom, 0)); - Farmables.farmables.get("farmShroom").add(new FarmableVanillaShroom(Blocks.red_mushroom, 0)); + Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.brown_mushroom, 0)); + Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.red_mushroom, 0)); Farmables.farmables.put("farmWheat", new ArrayList()); Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.wheat_seeds), Blocks.wheat, 7));