Preliminary fix for Forced Decorators, fixed a bug with moon phases. Closes #206

This commit is contained in:
Adubbz 2014-03-19 18:47:49 +11:00
parent 081bd5150b
commit 65d77e07e5
18 changed files with 95 additions and 52 deletions

View file

@ -1,11 +1,12 @@
package biomesoplenty.common.entities;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
@ -14,8 +15,6 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
public class EntityGlob extends EntityLiving implements IMob
{
@ -302,7 +301,7 @@ public class EntityGlob extends EntityLiving implements IMob
{
BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(MathHelper.floor_double(posX), MathHelper.floor_double(posZ));
if (biomegenbase == BiomeGenBase.swampland && posY > 50.0D && posY < 70.0D && rand.nextFloat() < 0.5F && rand.nextFloat() < this.worldObj.getMoonPhase() && worldObj.getBlockLightValue(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) <= rand.nextInt(8))
if (biomegenbase == BiomeGenBase.swampland && posY > 50.0D && posY < 70.0D && rand.nextFloat() < 0.5F && rand.nextFloat() < this.worldObj.getCurrentMoonPhaseFactor() && worldObj.getBlockLightValue(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) <= rand.nextInt(8))
return super.getCanSpawnHere();
if (rand.nextInt(10) == 0 && chunk.getRandomWithSeed(987234911L).nextInt(10) == 0 && posY < 40.0D)

View file

@ -6,7 +6,12 @@ import java.util.Random;
public class ForcedDecorator implements IBOPBiome
{
protected BOPWorldFeatures bopWorldFeatures = new BOPWorldFeatures();
protected BOPWorldFeatures bopWorldFeatures;
public ForcedDecorator(int id)
{
bopWorldFeatures = BOPDecorationManager.getBiomeFeatures(id);
}
@Override
public WorldGenBOPFlora getRandomWorldGenForBOPFlowers(Random random)

View file

@ -16,50 +16,59 @@ public class ForcedDecorators
private static void addForcedDecorators()
{
addForcedDecorator(BiomeGenBase.birchForest.biomeID, new BirchForestForcedDecorator());
addForcedDecorator(BiomeGenBase.birchForestHills.biomeID, new BirchForestForcedDecorator());
addForcedDecorator(BiomeGenBase.birchForest.biomeID, BirchForestForcedDecorator.class);
addForcedDecorator(BiomeGenBase.birchForestHills.biomeID, BirchForestForcedDecorator.class);
addForcedDecorator(BiomeGenBase.desert.biomeID, new DesertForcedDecorator());
addForcedDecorator(BiomeGenBase.desertHills.biomeID, new DesertForcedDecorator());
addForcedDecorator(BiomeGenBase.desert.biomeID, DesertForcedDecorator.class);
addForcedDecorator(BiomeGenBase.desertHills.biomeID, DesertForcedDecorator.class);
addForcedDecorator(BiomeGenBase.extremeHills.biomeID, new ExtremeHillsForcedDecorator());
addForcedDecorator(BiomeGenBase.extremeHillsEdge.biomeID, new ExtremeHillsForcedDecorator());
addForcedDecorator(BiomeGenBase.extremeHills.biomeID, ExtremeHillsForcedDecorator.class);
addForcedDecorator(BiomeGenBase.extremeHillsEdge.biomeID, ExtremeHillsForcedDecorator.class);
addForcedDecorator(BiomeGenBase.forest.biomeID, new ForestForcedDecorator());
addForcedDecorator(BiomeGenBase.forestHills.biomeID, new ForestForcedDecorator());
addForcedDecorator(BiomeGenBase.forest.biomeID, ForestForcedDecorator.class);
addForcedDecorator(BiomeGenBase.forestHills.biomeID, ForestForcedDecorator.class);
addForcedDecorator(BiomeGenBase.icePlains.biomeID, new IcePlainsForcedDecorator());
addForcedDecorator(BiomeGenBase.icePlains.biomeID, IcePlainsForcedDecorator.class);
addForcedDecorator(BiomeGenBase.jungle.biomeID, new JungleForcedDecorator());
addForcedDecorator(BiomeGenBase.jungleEdge.biomeID, new JungleForcedDecorator());
addForcedDecorator(BiomeGenBase.jungleHills.biomeID, new JungleForcedDecorator());
addForcedDecorator(BiomeGenBase.jungle.biomeID, JungleForcedDecorator.class);
addForcedDecorator(BiomeGenBase.jungleEdge.biomeID, JungleForcedDecorator.class);
addForcedDecorator(BiomeGenBase.jungleHills.biomeID, JungleForcedDecorator.class);
addForcedDecorator(BiomeGenBase.mesa.biomeID, new MesaForcedDecorator());
addForcedDecorator(BiomeGenBase.mesaPlateau.biomeID, new MesaForcedDecorator());
addForcedDecorator(BiomeGenBase.mesaPlateau_F.biomeID, new MesaForcedDecorator());
addForcedDecorator(BiomeGenBase.mesa.biomeID, MesaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.mesaPlateau.biomeID, MesaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.mesaPlateau_F.biomeID, MesaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.mushroomIsland.biomeID, new MushroomIslandForcedDecorator());
addForcedDecorator(BiomeGenBase.mushroomIslandShore.biomeID, new MushroomIslandForcedDecorator());
addForcedDecorator(BiomeGenBase.mushroomIsland.biomeID, MushroomIslandForcedDecorator.class);
addForcedDecorator(BiomeGenBase.mushroomIslandShore.biomeID, MushroomIslandForcedDecorator.class);
addForcedDecorator(BiomeGenBase.ocean.biomeID, new OceanForcedDecorator());
addForcedDecorator(BiomeGenBase.plains.biomeID, new PlainsForcedDecorator());
addForcedDecorator(BiomeGenBase.river.biomeID, new RiverForcedDecorator());
addForcedDecorator(BiomeGenBase.roofedForest.biomeID, new RoofedForestForcedDecorator());
addForcedDecorator(BiomeGenBase.ocean.biomeID, OceanForcedDecorator.class);
addForcedDecorator(BiomeGenBase.plains.biomeID, PlainsForcedDecorator.class);
addForcedDecorator(BiomeGenBase.river.biomeID, RiverForcedDecorator.class);
addForcedDecorator(BiomeGenBase.roofedForest.biomeID, RoofedForestForcedDecorator.class);
addForcedDecorator(BiomeGenBase.savanna.biomeID, new SavannaForcedDecorator());
addForcedDecorator(BiomeGenBase.savannaPlateau.biomeID, new SavannaForcedDecorator());
addForcedDecorator(BiomeGenBase.savanna.biomeID, SavannaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.savannaPlateau.biomeID, SavannaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.swampland.biomeID, new SwampForcedDecorator());
addForcedDecorator(BiomeGenBase.swampland.biomeID, SwampForcedDecorator.class);
addForcedDecorator(BiomeGenBase.taiga.biomeID, new TaigaForcedDecorator());
addForcedDecorator(BiomeGenBase.taigaHills.biomeID, new TaigaForcedDecorator());
addForcedDecorator(BiomeGenBase.coldTaiga.biomeID, new TaigaForcedDecorator());
addForcedDecorator(BiomeGenBase.coldTaigaHills.biomeID, new TaigaForcedDecorator());
addForcedDecorator(BiomeGenBase.taiga.biomeID, TaigaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.taigaHills.biomeID, TaigaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.coldTaiga.biomeID, TaigaForcedDecorator.class);
addForcedDecorator(BiomeGenBase.coldTaigaHills.biomeID, TaigaForcedDecorator.class);
}
public static void addForcedDecorator(int biomeID, ForcedDecorator decorator)
public static void addForcedDecorator(int biomeID, Class<? extends ForcedDecorator> decoratorClass)
{
forcedDecoratorMap.put(biomeID, decorator);
try
{
ForcedDecorator decorator = decoratorClass.getConstructor(int.class).newInstance(biomeID);
forcedDecoratorMap.put(biomeID, decorator);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static IBOPBiome getForcedDecorator(int biomeID)

View file

@ -8,8 +8,10 @@ import net.minecraft.init.Blocks;
public class BirchForestForcedDecorator extends ForcedDecorator
{
public BirchForestForcedDecorator()
public BirchForestForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("poisonIvyPerChunk", 3);
this.bopWorldFeatures.setFeature("cloverPatchesPerChunk", 15);
this.bopWorldFeatures.setFeature("leafPilesPerChunk", 4);

View file

@ -4,8 +4,10 @@ import biomesoplenty.common.world.decoration.ForcedDecorator;
public class DesertForcedDecorator extends ForcedDecorator
{
public DesertForcedDecorator()
public DesertForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("tinyCactiPerChunk", 10);
this.bopWorldFeatures.setFeature("generateQuicksand", true);
}

View file

@ -8,8 +8,10 @@ import net.minecraft.init.Blocks;
public class ExtremeHillsForcedDecorator extends ForcedDecorator
{
public ExtremeHillsForcedDecorator()
public ExtremeHillsForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 3);
this.bopWorldFeatures.setFeature("shrubsPerChunk", 1);
this.bopWorldFeatures.setFeature("leafPilesPerChunk", 3);

View file

@ -8,8 +8,10 @@ import net.minecraft.init.Blocks;
public class ForestForcedDecorator extends ForcedDecorator
{
public ForestForcedDecorator()
public ForestForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("leafPilesPerChunk", 15);
this.bopWorldFeatures.setFeature("deadLeafPilesPerChunk", 5);
this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 5);

View file

@ -6,8 +6,10 @@ import biomesoplenty.common.world.features.WorldGenBOPFlora;
public class IcePlainsForcedDecorator extends ForcedDecorator
{
public IcePlainsForcedDecorator()
public IcePlainsForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 1);
this.weightedFlowerGen.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 8), 8);

View file

@ -8,8 +8,10 @@ import net.minecraft.init.Blocks;
public class JungleForcedDecorator extends ForcedDecorator
{
public JungleForcedDecorator()
public JungleForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("leafPilesPerChunk", 10);
this.bopWorldFeatures.setFeature("generatePumpkins", 10);
this.bopWorldFeatures.setFeature("generatePumpkins", 15);

View file

@ -7,8 +7,10 @@ import net.minecraft.init.Blocks;
public class MesaForcedDecorator extends ForcedDecorator
{
public MesaForcedDecorator()
public MesaForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("tinyCactiPerChunk", 10);
this.bopWorldFeatures.setFeature("bromeliadsPerChunk", 10);

View file

@ -4,8 +4,10 @@ import biomesoplenty.common.world.decoration.ForcedDecorator;
public class MushroomIslandForcedDecorator extends ForcedDecorator
{
public MushroomIslandForcedDecorator()
public MushroomIslandForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("blueMilksPerChunk", 2);
this.bopWorldFeatures.setFeature("toadstoolsPerChunk", 8);
this.bopWorldFeatures.setFeature("portobellosPerChunk", 6);

View file

@ -4,8 +4,10 @@ import biomesoplenty.common.world.decoration.ForcedDecorator;
public class OceanForcedDecorator extends ForcedDecorator
{
public OceanForcedDecorator()
public OceanForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("seaweedPerChunk", 20);
}
}

View file

@ -8,8 +8,10 @@ import net.minecraft.init.Blocks;
public class PlainsForcedDecorator extends ForcedDecorator
{
public PlainsForcedDecorator()
public PlainsForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 8);
this.bopWorldFeatures.setFeature("wildCarrotsPerChunk", 1);

View file

@ -4,8 +4,10 @@ import biomesoplenty.common.world.decoration.ForcedDecorator;
public class RiverForcedDecorator extends ForcedDecorator
{
public RiverForcedDecorator()
public RiverForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("seaweedPerChunk", 5);
this.bopWorldFeatures.setFeature("riverCanePerChunk", 10);
this.bopWorldFeatures.setFeature("waterReedsPerChunk", 4);

View file

@ -7,8 +7,10 @@ import net.minecraft.init.Blocks;
public class RoofedForestForcedDecorator extends ForcedDecorator
{
public RoofedForestForcedDecorator()
public RoofedForestForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("toadstoolsPerChunk", 1);
this.bopWorldFeatures.setFeature("blueMilksPerChunk", 1);
this.bopWorldFeatures.setFeature("leafPilesPerChunk", 8);

View file

@ -8,8 +8,10 @@ import net.minecraft.init.Blocks;
public class SavannaForcedDecorator extends ForcedDecorator
{
public SavannaForcedDecorator()
public SavannaForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("leafPilesPerChunk", 10);
this.bopWorldFeatures.setFeature("deadLeafPilesPerChunk", 5);
this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 10);

View file

@ -8,8 +8,10 @@ import net.minecraft.init.Blocks;
public class SwampForcedDecorator extends ForcedDecorator
{
public SwampForcedDecorator()
public SwampForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("mudPerChunk", 3);
this.bopWorldFeatures.setFeature("seaweedPerChunk", 10);
this.bopWorldFeatures.setFeature("cattailsPerChunk", 10);

View file

@ -6,12 +6,14 @@ import biomesoplenty.common.world.features.WorldGenBOPFlora;
public class TaigaForcedDecorator extends ForcedDecorator
{
public TaigaForcedDecorator()
public TaigaForcedDecorator(int id)
{
super(id);
this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 2);
this.bopWorldFeatures.setFeature("leafPilesPerChunk", 2);
this.bopWorldFeatures.setFeature("deadLeafPilesPerChunk", 4);
weightedFlowerGen.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 8), 8);
this.weightedFlowerGen.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 8), 8);
}
}