aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/everglades/biome/Biome_Everglades.java
blob: 918393bb8f75e7eccb6bb2146032fc8ac7fa2b8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package gtPlusPlus.everglades.biome;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.entity.monster.EntitySickBlaze;
import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import java.lang.reflect.Field;
import java.util.Random;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeManager;

public class Biome_Everglades {

    public static BiomeGenEverglades biome = new BiomeGenEverglades();

    public Object instance;

    public Biome_Everglades() {}

    public void load() {
        BiomeDictionary.registerBiomeType(biome, BiomeDictionary.Type.DEAD);
        BiomeManager.addSpawnBiome(biome);
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {}

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {}

    public void registerRenderers() {}

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {}

    public void preInit(FMLPreInitializationEvent event) {}

    static class BiomeGenEverglades extends BiomeGenBase {
        @SuppressWarnings("unchecked")
        public BiomeGenEverglades() {
            super(CORE.EVERGLADESBIOME_ID);
            // this.setBiomeID();
            this.theBiomeDecorator = new BiomeGenerator_Custom();
            this.theBiomeDecorator.treesPerChunk = 10;
            // Logger.INFO("Dark World Temperature Category: "+getTempCategory());
            this.setBiomeName("Toxic Everglades");
            this.topBlock = Dimension_Everglades.blockTopLayer;
            this.fillerBlock = Dimension_Everglades.blockSecondLayer;
            this.enableRain = true;
            this.enableSnow = false;
            this.rainfall = 0.7F;
            this.setHeight(new BiomeGenBase.Height(0.3F, 0.5F));
            this.heightVariation = 0.4F;
            this.waterColorMultiplier = 0x17290A;
            this.rootHeight = -0.25f; // Ground level

            this.spawnableMonsterList.clear();
            this.spawnableCreatureList.clear();
            this.spawnableWaterCreatureList.clear();
            this.spawnableCaveCreatureList.clear();

            // Enemies
            this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySickBlaze.class, 100, 2, 6));
            this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 75, 4, 16));
            this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityStaballoyConstruct.class, 20, 1, 2));

            // Animals
            this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 1, 1, 6));
            this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8));
        }

        private synchronized boolean setBiomeID() {
            try {
                Field mInternalBiomeList = ReflectionUtils.getField(BiomeGenBase.class, "biomeList");
                BiomeGenBase[] mOriginalList = (BiomeGenBase[]) mInternalBiomeList.get(null);
                BiomeGenBase[] mTempList = new BiomeGenBase[mOriginalList.length];
                for (int index = 0; index < mTempList.length; index++) {
                    mTempList[index] = mOriginalList[index];
                }
                return false;
            } catch (Exception e) {
                Logger.REFLECTION(
                        "Could not access 'biomeList' field in " + BiomeGenBase.class.getCanonicalName() + ".");
                e.printStackTrace();
                return false;
            }
        }

        @SideOnly(Side.CLIENT)
        public int getBiomeGrassColor() {
            return 0x111f11;
        }

        @SideOnly(Side.CLIENT)
        public int getBiomeFoliageColor() {
            return 0x111f11;
        }

        @Override
        @SideOnly(Side.CLIENT)
        public int getSkyColorByTemp(float par1) {
            return 0xF67A14;
        }

        @SuppressWarnings({"unchecked", "unused"})
        private boolean addToMonsterSpawnLists(Class<?> EntityClass, int a, int b, int c) {
            // this.spawnableMonsterList.add(new SpawnListEntry(EntityClass, a, b, c));
            this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityClass, a, b, c));
            return true;
        }
    }
}