Fixed bonemeal on saplings, holy grass, turnips, cattail and tiny cacti. The rest will be done once the blocks for them are used
This commit is contained in:
parent
7cf90c6e55
commit
d55f6d3d76
11 changed files with 213 additions and 19 deletions
|
@ -59,7 +59,7 @@ public class BiomeGenLushDesert extends BOPBiome
|
|||
public WorldGenAbstractTree func_150567_a(Random random)
|
||||
{
|
||||
return random.nextInt(4) == 0 ? new WorldGenSavannaTree(false) :
|
||||
(random.nextInt(24) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("holyGrass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) :
|
||||
(random.nextInt(24) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("grass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) :
|
||||
(random.nextInt(2) == 0 ? worldGeneratorTrees : new WorldGenShrub(0,0)));
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class BiomeGenOminousWoods extends BOPBiome
|
|||
//TODO: getRandomWorldGenForTrees()
|
||||
public WorldGenAbstractTree func_150567_a(Random random)
|
||||
{
|
||||
return random.nextInt(2) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0) : (random.nextInt(6) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("holyGrass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) : new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4));
|
||||
return random.nextInt(2) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0) : (random.nextInt(6) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("grass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) : new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,7 +49,7 @@ public class BiomeGenWasteland extends BOPBiome
|
|||
//TODO: getRandomWorldGenForTrees()
|
||||
public WorldGenAbstractTree func_150567_a(Random random)
|
||||
{
|
||||
return new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("holyGrass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock"));
|
||||
return new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("grass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -217,13 +217,13 @@ public class BlockBOPFlower extends BOPBlockWorldDecor
|
|||
switch (metadata)
|
||||
{
|
||||
case 6: // Tulip
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == BOPBlockHelper.get("holyGrass") || block == BOPBlockHelper.get("longGrass") || block == BOPBlockHelper.get("overgrownNetherrack");
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == BOPBlockHelper.get("grass") || block == BOPBlockHelper.get("longGrass") || block == BOPBlockHelper.get("overgrownNetherrack");
|
||||
|
||||
case 10: // Lily Flower
|
||||
return block == Blocks.waterlily;
|
||||
|
||||
case 11: // Rainbow Flower
|
||||
return block == BOPBlockHelper.get("holyGrass") || block == BOPBlockHelper.get("holyDirt") || block == Blocks.grass || block == Blocks.dirt;
|
||||
return block == BOPBlockHelper.get("grass") || block == BOPBlockHelper.get("holyDirt") || block == Blocks.grass || block == Blocks.dirt;
|
||||
|
||||
case 12: // Bromeliad
|
||||
return block == BOPBlockHelper.get("hardDirt") || block == BOPBlockHelper.get("redRock") || block == Blocks.sand;
|
||||
|
|
|
@ -181,7 +181,7 @@ public class BlockBOPGrass extends Block
|
|||
if (world.func_147439_a(rX, rY, rZ) == BOPBlockHelper.get("holyDirt") && world.getBlockLightValue(rX, rY + 1, rZ) >= 4 && world.getBlockLightOpacity(rX, rY + 1, rZ) <= 2)
|
||||
{
|
||||
//TODO: setBlock()
|
||||
world.func_147465_d(rX, rY, rZ, BOPBlockHelper.get("holyGrass"), 0, 2);
|
||||
world.func_147465_d(rX, rY, rZ, BOPBlockHelper.get("grass"), 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,13 +122,13 @@ public class BlockBOPMushroom extends BlockBush
|
|||
switch (metadata)
|
||||
{
|
||||
case 0: // Toadstool
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.mycelium || block == Blocks.netherrack || block == BOPBlockHelper.get("holyGrass") || block == BOPBlockHelper.get("overgrownNetherrack");
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.mycelium || block == Blocks.netherrack || block == BOPBlockHelper.get("grass") || block == BOPBlockHelper.get("overgrownNetherrack");
|
||||
|
||||
case 1: // Portobello
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.mycelium || block == BOPBlockHelper.get("holyGrass");
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.mycelium || block == BOPBlockHelper.get("grass");
|
||||
|
||||
case 2: // Blue Milk Cap
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.mycelium || block == BOPBlockHelper.get("holyGrass");
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.mycelium || block == BOPBlockHelper.get("grass");
|
||||
|
||||
case 3: // Glowshroom
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.mycelium || block == Blocks.stone || block == Blocks.netherrack || block == BOPBlockHelper.get("overgrownNetherrack");
|
||||
|
|
|
@ -148,7 +148,7 @@ public class BlockBOPPlant extends BOPBlockWorldDecor implements IShearable
|
|||
return block == Blocks.sand;
|
||||
|
||||
case 4: // Holy Tall Grass
|
||||
return block == BOPBlockHelper.get("holyGrass");
|
||||
return block == BOPBlockHelper.get("grass");
|
||||
|
||||
case 5: // Thorns
|
||||
return block == Blocks.grass|| block == Blocks.dirt || block == Blocks.soul_sand;
|
||||
|
@ -163,6 +163,9 @@ public class BlockBOPPlant extends BOPBlockWorldDecor implements IShearable
|
|||
case 8: // River Cane
|
||||
return block == this || block == Blocks.grass;
|
||||
|
||||
case 9:
|
||||
return block == this;
|
||||
|
||||
case 10: // High Cattail Bottom
|
||||
//TODO: getBlock() getMaterial() water getBlock() getMaterial() water getBlock() getMaterial() water getBlock() getMaterial() water
|
||||
return block != Blocks.grass ? false : (world.func_147439_a(x - 1, y - 1, z).func_149688_o() == Material.field_151586_h ? true : (world.func_147439_a(x + 1, y - 1, z).func_149688_o() == Material.field_151586_h ? true : (world.func_147439_a(x, y - 1, z - 1).func_149688_o() == Material.field_151586_h ? true : world.func_147439_a(x, y - 1, z + 1).func_149688_o() == Material.field_151586_h)));
|
||||
|
@ -177,7 +180,7 @@ public class BlockBOPPlant extends BOPBlockWorldDecor implements IShearable
|
|||
return block == Blocks.water;
|
||||
|
||||
case 15: // Root
|
||||
return root != Blocks.air && (root == Blocks.grass || root == Blocks.dirt || root == Blocks.farmland || root == BOPBlockHelper.get("longGrass") || root == BOPBlockHelper.get("holyGrass") || root == BOPBlockHelper.get("holyDirt"));
|
||||
return root != Blocks.air && (root == Blocks.grass || root == Blocks.dirt || root == Blocks.farmland || root == BOPBlockHelper.get("longGrass") || root == BOPBlockHelper.get("grass") || root == BOPBlockHelper.get("holyDirt"));
|
||||
|
||||
default:
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == BOPBlockHelper.get("overgrownNetherrack");
|
||||
|
@ -272,8 +275,15 @@ public class BlockBOPPlant extends BOPBlockWorldDecor implements IShearable
|
|||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (meta == 11)
|
||||
switch (meta)
|
||||
{
|
||||
case 9:
|
||||
return new ItemStack(this, 1, 7);
|
||||
|
||||
case 10:
|
||||
return new ItemStack(this, 1, 7);
|
||||
|
||||
case 11:
|
||||
return new ItemStack(BOPItemHelper.get("food"), 1, 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class BlockBOPSapling extends BlockSapling
|
|||
switch (metadata)
|
||||
{
|
||||
case 7: // Loftwood
|
||||
return block == BOPBlockHelper.get("holyGrass") || block == BOPBlockHelper.get("holyDirt");
|
||||
return block == BOPBlockHelper.get("grass") || block == BOPBlockHelper.get("holyDirt");
|
||||
|
||||
default:
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this);
|
||||
|
@ -106,7 +106,7 @@ public class BlockBOPSapling extends BlockSapling
|
|||
(soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this));
|
||||
else
|
||||
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) &&
|
||||
(soil != null && (soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this) || soil == BOPBlockHelper.get("holyGrass")));
|
||||
(soil != null && (soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this) || soil == BOPBlockHelper.get("grass")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import biomesoplenty.common.eventhandler.entity.FlippersEventHandler;
|
|||
import biomesoplenty.common.eventhandler.entity.TemptEventHandler;
|
||||
import biomesoplenty.common.eventhandler.gui.MainMenuEventHandler;
|
||||
import biomesoplenty.common.eventhandler.gui.StartupWarningEventHandler;
|
||||
import biomesoplenty.common.eventhandler.misc.BonemealEventHandler;
|
||||
import biomesoplenty.common.eventhandler.misc.CapeEventHandler;
|
||||
import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler;
|
||||
import biomesoplenty.common.eventhandler.potions.PotionPossessionEventHandler;
|
||||
|
@ -50,6 +51,7 @@ public class BOPEventHandlers
|
|||
|
||||
private static void registerMiscEventHandlers()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(new BonemealEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new CapeEventHandler());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
package biomesoplenty.common.eventhandler.misc;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenCactus;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import biomesoplenty.api.BOPBlockHelper;
|
||||
import biomesoplenty.common.blocks.BlockBOPColorizedSapling;
|
||||
import biomesoplenty.common.blocks.BlockBOPSapling;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class BonemealEventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onUseBonemeal(BonemealEvent event)
|
||||
{
|
||||
World world = event.world;
|
||||
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
|
||||
Block block = event.block;
|
||||
int meta = event.world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (block == BOPBlockHelper.get("saplings"))
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
double chance = 0D;
|
||||
|
||||
switch (meta)
|
||||
{
|
||||
case 3: // Magic Sapling
|
||||
chance = 0.1D;
|
||||
break;
|
||||
|
||||
case 7: // Holy Sapling
|
||||
chance = 0.15D;
|
||||
break;
|
||||
|
||||
case 9: // Origin Sapling
|
||||
chance = 1D;
|
||||
break;
|
||||
|
||||
default:
|
||||
chance = 0.45D;
|
||||
break;
|
||||
}
|
||||
|
||||
if (world.rand.nextFloat() < chance)
|
||||
{
|
||||
//TODO: growTree()
|
||||
((BlockBOPSapling)BOPBlockHelper.get("saplings")).func_149878_d(event.world, x, y, z, event.world.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (block == BOPBlockHelper.get("colorizedSaplings"))
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (world.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
//TODO: growTree()
|
||||
((BlockBOPColorizedSapling)BOPBlockHelper.get("colorizedSaplings")).func_149878_d(event.world, x, y, z, event.world.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (block == BOPBlockHelper.get("coral") && event.world.getBlockMetadata(x, y, z) == 3)
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
/*TODO: FEATURE if (!event.world.isRemote)
|
||||
{
|
||||
if (event.world.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
WorldGenKelp worldgenkelp = new WorldGenKelp(false);
|
||||
worldgenkelp.generate(event.world, event.world.rand, event.X, event.Y, event.Z);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else if (block == BOPBlockHelper.get("plants"))
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
if (!event.world.isRemote)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 7:
|
||||
if (event.world.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
world.func_147465_d(x, y, z, BOPBlockHelper.get("plants"), 10, 2);
|
||||
world.func_147465_d(x, y + 1, z, BOPBlockHelper.get("plants"), 9, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
if (world.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
world.func_147449_b(x, y, z, Blocks.cactus);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*TODO: FEATURE else if (event.ID == Block.plantRed.blockID)
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
if (!event.world.isRemote)
|
||||
{
|
||||
if (event.world.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
WorldGenGiantFlowerRed worldgengiantflowerred = new WorldGenGiantFlowerRed();
|
||||
worldgengiantflowerred.generate(event.world, event.world.rand, event.X, event.Y - 1, event.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.ID == Block.plantYellow.blockID)
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
if (!event.world.isRemote)
|
||||
{
|
||||
if (event.world.rand.nextFloat() < 0.45D)
|
||||
{
|
||||
WorldGenGiantFlowerYellow worldgengiantfloweryellow = new WorldGenGiantFlowerYellow();
|
||||
worldgengiantfloweryellow.generate(event.world, event.world.rand, event.X, event.Y - 1, event.Z);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
else if (block == BOPBlockHelper.get("turnip"))
|
||||
{
|
||||
if (event.world.getBlockMetadata(x, y, z) != 7)
|
||||
{
|
||||
if (!event.world.isRemote)
|
||||
{
|
||||
//TODO: fertilize
|
||||
((BlockCrops)BOPBlockHelper.get("turnip")).func_149863_m(event.world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (block == BOPBlockHelper.get("grass") && event.world.getBlockMetadata(x, y, z) == 0)
|
||||
{
|
||||
int var14 = y + 1;
|
||||
|
||||
for (int i1 = 0; i1 < 128; ++i1)
|
||||
{
|
||||
|
||||
for (int i2 = 0; i2 < i1 / 16; ++i2)
|
||||
{
|
||||
x += event.world.rand.nextInt(3) - 1;
|
||||
var14 += (event.world.rand.nextInt(3) - 1) * event.world.rand.nextInt(3) / 2;
|
||||
z += event.world.rand.nextInt(3) - 1;
|
||||
}
|
||||
|
||||
if (event.world.func_147439_a(x, var14, z).isAir(world, x, var14, z))
|
||||
{
|
||||
if (BOPBlockHelper.get("plants").func_149705_a(world, x, var14, z, 0, new ItemStack(BOPBlockHelper.get("plants"), 1, 4)))
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
if (!event.world.isRemote)
|
||||
{
|
||||
//TODO: setBlock()
|
||||
event.world.func_147465_d(x, var14, z, BOPBlockHelper.get("plants"), 4, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,7 +38,7 @@ public class WorldGenFieldAssociation
|
|||
{
|
||||
associateField("generateQuicksand", new WorldGenSplotches(BOPBlockHelper.get("mud"), 1, 24, Blocks.grass, Blocks.dirt, Blocks.sand));
|
||||
associateField("generateCanyon", new WorldGenSplotches(BOPBlockHelper.get("redRock"), 0, 48, Blocks.stone));
|
||||
associateField("generateStoneInGrass", new WorldGenSplotches(Blocks.stone, 0, 32, Blocks.grass, BOPBlockHelper.get("holyGrass")));
|
||||
associateField("generateStoneInGrass", new WorldGenSplotches(Blocks.stone, 0, 32, Blocks.grass, BOPBlockHelper.get("grass")));
|
||||
associateField("generateStoneInGrass2", new WorldGenSplotches(Blocks.stone, 0, 48, Blocks.grass, Blocks.dirt));
|
||||
associateField("generateGrass", new WorldGenSplotches(Blocks.grass, 0, 48, BOPBlockHelper.get("redRock")));
|
||||
associateField("generateSand", new WorldGenSplotches(Blocks.sand, 0, 32, BOPBlockHelper.get("redRock")));
|
||||
|
|
Loading…
Reference in a new issue