aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/galacticraft/system
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-24 02:38:23 +0100
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-24 02:38:23 +0100
commit5856a6623641697349a112ff75b74296358361a0 (patch)
tree3474ab5f0b2d51550259b2a2cce1562a15bcb158 /src/Java/gtPlusPlus/xmod/galacticraft/system
parent53408770c7a4dd6fa4c997d4601b7aba215bc9ab (diff)
downloadGT5-Unofficial-5856a6623641697349a112ff75b74296358361a0.tar.gz
GT5-Unofficial-5856a6623641697349a112ff75b74296358361a0.tar.bz2
GT5-Unofficial-5856a6623641697349a112ff75b74296358361a0.zip
+ Added Base framework for custom GC systems.
% Tweaked Automatic doors, they will not open if mobs are within 2m or if open, they will close.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/galacticraft/system')
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/BaseGalacticDimension.java304
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/BaseSolarSystem.java95
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BaseWorldProviderGalactic.java123
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BasicChunkProviderGalactic.java18
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalactic.java111
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalaxyLakes.java529
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticBiomeGenBase.java39
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticMapGenCavesBase.java191
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/biome/BiomeGenGalaxy.java20
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/SystemHD10180.java40
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/b/dim/WorldProviderHD10180B.java13
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/objects/BiomeSettings.java29
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/objects/DimensionSettings.java77
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/objects/IPlanetBlockRegister.java29
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/objects/PlanetGenerator.java50
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/system/objects/WorldProviderSettings.java30
16 files changed, 1698 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/BaseGalacticDimension.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/BaseGalacticDimension.java
new file mode 100644
index 0000000000..cb02fa0e31
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/galacticraft/system/BaseGalacticDimension.java
@@ -0,0 +1,304 @@
+package gtPlusPlus.xmod.galacticraft.system;
+
+import java.util.Random;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.xmod.galacticraft.system.objects.DimensionSettings;
+import gtPlusPlus.xmod.galacticraft.system.objects.PlanetGenerator;
+import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldChunkManagerSpace;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace;
+import micdoodle8.mods.galacticraft.api.vector.Vector3;
+import micdoodle8.mods.galacticraft.api.world.IExitHeight;
+import micdoodle8.mods.galacticraft.api.world.ISolarLevel;
+import micdoodle8.mods.galacticraft.api.world.ITeleportType;
+import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats;
+import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore;
+import micdoodle8.mods.galacticraft.planets.mars.entities.EntityLandingBalloons;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.IChunkProvider;
+
+public class BaseGalacticDimension {
+
+ private final WorldChunkManagerGalactic mGlobalChunkManager;
+ private final WorldProviderGalactic mWorldProvider;
+ private final Class<? extends IChunkProvider> mChunkProvider;
+ private final PlanetGenerator mPlanet;
+
+ public BaseGalacticDimension(PlanetGenerator aPlanet, BiomeGenBase aBiomeForDim, Class<? extends IChunkProvider> aChunkProvider, DimensionSettings aSettings) {
+ mPlanet = aPlanet;
+ mGlobalChunkManager = new WorldChunkManagerGalactic(aBiomeForDim);
+ mChunkProvider = aChunkProvider;
+ mWorldProvider = new WorldProviderGalactic(aSettings);
+ }
+
+ public class WorldChunkManagerGalactic extends WorldChunkManagerSpace {
+ private final BiomeGenBase mBiome;
+
+ public WorldChunkManagerGalactic(BiomeGenBase aDimBiome) {
+ mBiome = aDimBiome;
+ }
+
+ public BiomeGenBase getBiome() {
+ return mBiome;
+ }
+ }
+
+ public class WorldProviderGalactic extends WorldProviderSpace implements IExitHeight, ISolarLevel, ITeleportType {
+
+ private final int mTierRequirement;
+ private final PlanetGenerator mPlanet;
+ private final boolean mAtmosphere;
+ private final int mPressure;
+ private final boolean mSolarRadiation;
+ private final float mCloudHeight;
+ private final float mGravity;
+ private final float mMeteorFreq;
+ private final boolean mCanRainOrSnow;
+ private final long mDayLength;
+ private final Class<? extends IChunkProvider> mChunkProvider;
+
+ public WorldProviderGalactic(DimensionSettings aSettings) {
+ mPlanet = aSettings.getPlanet();
+ mTierRequirement = aSettings.getTierRequirement();
+ mAtmosphere = aSettings.hasAtmosphere();
+ mPressure = aSettings.getPressure();
+ mSolarRadiation = aSettings.hasSolarRadiation();
+ mCloudHeight = aSettings.getCloudHeight();
+ mGravity = aSettings.getGravity();
+ mMeteorFreq = aSettings.getMeteorFreq();
+ mCanRainOrSnow = aSettings.hasRainOrSnow();
+ mDayLength = aSettings.getDayLength();
+ mChunkProvider = aSettings.getChunkProvider();
+ }
+
+ public WorldProviderGalactic(PlanetGenerator aPlanet, Class<? extends IChunkProvider> aChunkProvider, int aTierRequirement, boolean aHasBreathableAtmo,
+ int aPressure, boolean aSolarRadiation, float aCloudHeight, float aGravity, float aMeteorFreq, boolean aCanRainOrSnow, long aDayLength) {
+ mPlanet = aPlanet;
+ mTierRequirement = aTierRequirement;
+ mAtmosphere = aHasBreathableAtmo;
+ mPressure = aPressure;
+ mSolarRadiation = aSolarRadiation;
+ mCloudHeight = aCloudHeight;
+ mGravity = aGravity;
+ mMeteorFreq = aMeteorFreq;
+ mCanRainOrSnow = aCanRainOrSnow;
+ mDayLength = aDayLength;
+ mChunkProvider = aChunkProvider;
+ }
+
+ public boolean canSpaceshipTierPass(int tier) {
+ return tier >= mTierRequirement;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getCloudHeight() {
+ return mCloudHeight;
+ }
+
+ public double getHorizon() {
+ return 44.0D;
+ }
+
+ public float getFallDamageModifier() {
+ return 0.16F;
+ }
+
+ public double getFuelUsageMultiplier() {
+ return 0.8D;
+ }
+
+ public float getGravity() {
+ return mGravity;
+ }
+
+ public double getMeteorFrequency() {
+ return mMeteorFreq;
+ }
+
+ public float getSoundVolReductionAmount() {
+ return Float.MAX_VALUE;
+ }
+
+ public float getThermalLevelModifier() {
+ return 0.0F;
+ }
+
+ public float getWindLevel() {
+ return 0.6F;
+ }
+
+ public boolean canRainOrSnow() {
+ return mCanRainOrSnow;
+ }
+
+ public boolean canBlockFreeze(int x, int y, int z, boolean byWater) {
+ return false;
+ }
+
+ public CelestialBody getCelestialBody() {
+ return mPlanet.getPlanet();
+ }
+
+ public Class<? extends IChunkProvider> getChunkProviderClass() {
+ return mChunkProvider;
+ }
+
+ public long getDayLength() {
+ return mDayLength;
+ }
+
+ public boolean hasBreathableAtmosphere() {
+ return mAtmosphere;
+ }
+
+ public Vector3 getFogColor() {
+ float f = 1.0F - this.getStarBrightness(1.0F);
+ return new Vector3((double) (0.65882355F * f), (double) (0.84705883F * f), (double) (1.0F * f));
+ }
+
+ public Vector3 getSkyColor() {
+ float f = 1.0F - this.getStarBrightness(1.0F);
+ return new Vector3((double) (0.25882354F * f), (double) (0.6666667F * f), (double) (1.0F * f));
+ }
+
+ public boolean isSkyColored() {
+ return true;
+ }
+
+ public Class<? extends WorldChunkManagerGalactic> getWorldChunkManagerClass() {
+ return WorldChunkManagerGalactic.class;
+ }
+
+ public boolean hasSunset() {
+ return false;
+ }
+
+ public boolean shouldForceRespawn() {
+ return !ConfigManagerCore.forceOverworldRespawn;
+ }
+
+ public double getSolarEnergyMultiplier() {
+ return 0.8D;
+ }
+
+ public double getYCoordinateToTeleport() {
+ return 800.0D;
+ }
+
+ public Vector3 getEntitySpawnLocation(WorldServer arg0, Entity arg1) {
+ return new Vector3(arg1.posX, ConfigManagerCore.disableLander ? 250.0D : 900.0D, arg1.posZ);
+ }
+
+ public Vector3 getParaChestSpawnLocation(WorldServer arg0, EntityPlayerMP arg1, Random arg2) {
+ if (ConfigManagerCore.disableLander) {
+ double x = (arg2.nextDouble() * 2.0D - 1.0D) * 5.0D;
+ double z = (arg2.nextDouble() * 2.0D - 1.0D) * 5.0D;
+ return new Vector3(x, 220.0D, z);
+ } else {
+ return null;
+ }
+ }
+
+ public Vector3 getPlayerSpawnLocation(WorldServer arg0, EntityPlayerMP arg1) {
+ if (arg1 != null) {
+ GCPlayerStats stats = GCPlayerStats.get(arg1);
+ return new Vector3(stats.coordsTeleportedFromX, ConfigManagerCore.disableLander ? 250.0D : 900.0D,
+ stats.coordsTeleportedFromZ);
+ } else {
+ return null;
+ }
+ }
+
+ public void onSpaceDimensionChanged(World arg0, EntityPlayerMP player, boolean arg2) {
+ if (player != null && GCPlayerStats.get(player).teleportCooldown <= 0) {
+ if (player.capabilities.isFlying) {
+ player.capabilities.isFlying = false;
+ }
+
+ EntityLandingBalloons lander = new EntityLandingBalloons(player);
+ if (!arg0.isRemote) {
+ arg0.spawnEntityInWorld(lander);
+ }
+
+ GCPlayerStats.get(player).teleportCooldown = 10;
+ }
+
+ }
+
+ public boolean useParachute() {
+ return ConfigManagerCore.disableLander;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getStarBrightness(float par1) {
+ float var2 = this.worldObj.getCelestialAngle(par1);
+ float var3 = 1.0F - (MathHelper.cos(var2 * 3.1415927F * 2.0F) * 2.0F + 0.25F);
+ if (var3 < 0.0F) {
+ var3 = 0.0F;
+ }
+
+ if (var3 > 1.0F) {
+ var3 = 1.0F;
+ }
+
+ return var3 * var3 * 0.5F + 0.3F;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getSunBrightness(float par1) {
+ float f1 = this.worldObj.getCelestialAngle(1.0F);
+ float f2 = 1.25F - (MathHelper.cos(f1 * 3.1415927F * 2.0F) * 2.0F + 0.2F);
+ if (f2 < 0.0F) {
+ f2 = 0.0F;
+ }
+
+ if (f2 > 1.0F) {
+ f2 = 1.0F;
+ }
+
+ f2 = 1.2F - f2;
+ return f2 * 0.2F;
+ }
+
+ public void setupAdventureSpawn(EntityPlayerMP player) {
+ }
+
+ public int AtmosphericPressure() {
+ return mPressure;
+ }
+
+ public boolean SolarRadiation() {
+ return mSolarRadiation;
+ }
+ }
+
+ public synchronized final WorldChunkManagerGalactic getGlobalChunkManager() {
+ return mGlobalChunkManager;
+ }
+
+ public synchronized final WorldProviderGalactic getWorldProvider() {
+ return mWorldProvider;
+ }
+
+ public synchronized final Class<? extends WorldProviderSpace> getWorldProviderClass() {
+ return mWorldProvider.getClass();
+ }
+
+ public synchronized final Class<? extends IChunkProvider> getChunkProvider() {
+ return mChunkProvider;
+ }
+
+ public synchronized final PlanetGenerator getPlanet() {
+ return mPlanet;
+ }
+
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/BaseSolarSystem.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/BaseSolarSystem.java
new file mode 100644
index 0000000000..96148c0cdb
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/galacticraft/system/BaseSolarSystem.java
@@ -0,0 +1,95 @@
+package gtPlusPlus.xmod.galacticraft.system;
+
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.galacticraft.system.objects.IPlanetBlockRegister;
+import gtPlusPlus.xmod.galacticraft.system.objects.PlanetGenerator;
+import micdoodle8.mods.galacticraft.api.GalacticraftRegistry;
+import micdoodle8.mods.galacticraft.api.galaxies.GalaxyRegistry;
+import micdoodle8.mods.galacticraft.api.galaxies.Planet;
+import micdoodle8.mods.galacticraft.api.galaxies.SolarSystem;
+import micdoodle8.mods.galacticraft.api.galaxies.Star;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace;
+import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance;
+import micdoodle8.mods.galacticraft.api.vector.Vector3;
+import micdoodle8.mods.galacticraft.api.world.ITeleportType;
+import net.minecraft.util.ResourceLocation;
+
+public abstract class BaseSolarSystem {
+ private SolarSystem mSolarSystem;
+ private Star mStar;
+ private AutoMap<Planet> mPlanetMap = new AutoMap<Planet>();
+
+ public SolarSystem getSystem() {
+ return mSolarSystem;
+ }
+
+ public Star getStar() {
+ return mStar;
+ }
+
+ public AutoMap<Planet> getPlanets(){
+ return mPlanetMap;
+ }
+
+ public abstract void preInit();
+
+ public final void init() {
+ initSolarSystem();
+ }
+
+ public abstract void initSolarSystem();
+
+ public static void registryteleport(Class<? extends WorldProviderSpace> aWorldProvider, ITeleportType aWorldProviderInstance) {
+ GalacticraftRegistry.registerTeleportType(aWorldProvider, aWorldProviderInstance);
+ }
+
+ public boolean registerSolarSystem(SolarSystem aSystem) {
+ this.mSolarSystem = aSystem;
+ return GalaxyRegistry.registerSolarSystem(aSystem);
+ }
+
+ public boolean registerPlanet(BaseGalacticDimension aDimension) {
+ return registerPlanet(aDimension.getPlanet().getPlanet(), aDimension.getWorldProviderClass(), aDimension.getWorldProvider());
+ }
+ public boolean registerPlanet(Planet aPlanet, Class<? extends WorldProviderSpace> aWorldProvider, ITeleportType aWorldProviderInstance) {
+ try {
+ mPlanetMap.put(aPlanet);
+ GalaxyRegistry.registerPlanet(aPlanet);
+ registryteleport(aWorldProvider, aWorldProviderInstance);
+ return true;
+ }
+ catch(Throwable t) {
+ return false;
+ }
+ }
+
+ public SolarSystem createSolarSystem(String aSystemName, String aParentGalaxyName, Vector3 aMapPosition) {
+ SolarSystem aSolarSystem = (new SolarSystem(aSystemName, aParentGalaxyName)).setMapPosition(aMapPosition);
+ return aSolarSystem;
+ }
+
+ public Star createStar(String aStarName, int aTierRequired) {
+ Star aStar = (Star) (new Star(aStarName)).setParentSolarSystem(getSystem()).setTierRequired(aTierRequired);
+ aStar.setBodyIcon(new ResourceLocation(CORE.MODID, "textures/space/planets/"+aStarName.toLowerCase()+"/"+aStarName+".png"));
+ return aStar;
+ }
+
+ public PlanetGenerator createPlanet(String aPlanetName, float[] aRingRGB, float aPhaseShift, float aRelativeDistanceFromCentMin, float aRelativeDistanceFromCentMax, float aRelativeOrbitTime, IPlanetBlockRegister aPlanetBlocks) {
+ Planet aNewPlanet = (new Planet(aPlanetName)).setParentSolarSystem(getSystem());
+ aNewPlanet.setRingColorRGB(aRingRGB[0], aRingRGB[1], aRingRGB[2]);
+ aNewPlanet.setPhaseShift(aPhaseShift);
+ aNewPlanet.setBodyIcon(new ResourceLocation(CORE.MODID, "textures/space/planets/"+aPlanetName.toLowerCase()+"/"+aPlanetName+".png"));
+ aNewPlanet.setRelativeDistanceFromCenter(new ScalableDistance(aRelativeDistanceFromCentMin, aRelativeDistanceFromCentMax));
+ aNewPlanet.setRelativeOrbitTime(aRelativeOrbitTime);
+ PlanetGenerator aPlanet = new PlanetGenerator(aNewPlanet, aPlanetBlocks);
+ return aPlanet;
+ }
+
+ public void setMainStarForSolarSystem(Star aStar) {
+ this.mStar = aStar;
+ getSystem().setMainStar(aStar);
+ }
+
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BaseWorldProviderGalactic.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BaseWorldProviderGalactic.java
new file mode 100644
index 0000000000..01180f913c
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BaseWorldProviderGalactic.java
@@ -0,0 +1,123 @@
+package gtPlusPlus.xmod.galacticraft.system.core.dim;
+
+import java.util.Random;
+
+import gtPlusPlus.api.objects.random.XSTR;
+import gtPlusPlus.xmod.galacticraft.system.BaseGalacticDimension;
+import gtPlusPlus.xmod.galacticraft.system.core.world.gen.GalacticBiomeGenBase;
+import gtPlusPlus.xmod.galacticraft.system.objects.BiomeSettings;
+import gtPlusPlus.xmod.galacticraft.system.objects.DimensionSettings;
+import gtPlusPlus.xmod.galacticraft.system.objects.PlanetGenerator;
+import gtPlusPlus.xmod.galacticraft.system.objects.WorldProviderSettings;
+import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeDecorator;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraftforge.common.BiomeDictionary;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.BiomeDictionary.Type;
+import net.minecraftforge.event.terraingen.TerrainGen;
+import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post;
+import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre;
+import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
+
+public class BaseWorldProviderGalactic {
+
+ private final PlanetGenerator mThisPlanet;
+ private final BaseGalacticDimension mDim;
+ public final BiomeGenBase mBiome;
+
+ //new DimensionSettings(b, aCP, 5, true, 1, false, 240f, 0.1f, 0.2f, false, 48000L)
+
+ public BaseWorldProviderGalactic(WorldProviderSettings b) {
+ this(b.getPlanet(), b.getDimSettings(), b.getBiomeSettings());
+ }
+
+ private BaseWorldProviderGalactic(PlanetGenerator b, DimensionSettings aDimSettings, BiomeSettings aBiomeSettings) {
+ mThisPlanet = b;
+ Class<? extends IChunkProvider> aCP = aDimSettings.getChunkProvider();
+ mBiome = tryCreateBiome(aBiomeSettings);
+ mDim = new BaseGalacticDimension(b, mBiome, aCP, aDimSettings);
+ }
+
+ public synchronized final BaseGalacticDimension getDim() {
+ return mDim;
+ }
+
+ public BiomeGenBase tryCreateBiome(BiomeSettings aSettings) {
+ BiomeGenBase x = (new BiomeGenMain(aSettings.getID())).setBiomeName(aSettings.getName()).setHeight(aSettings.getHeight());
+ return x;
+ }
+
+ public class BiomeGenBasePlanetSurface extends GalacticBiomeGenBase {
+ public BiomeGenBase aBiome;
+
+ public BiomeGenBasePlanetSurface(int id) {
+ super(id);
+ this.enableRain = true;
+ this.enableSnow = true;
+ this.topBlock = Blocks.stone;
+ this.fillerBlock = Blocks.stone;
+ }
+
+ public BiomeDecorator createBiomeDecorator() {
+ return new BiomeDecoratorGalactic();
+ }
+
+ protected BiomeDecoratorGalactic getBiomeDecorator() {
+ return (BiomeDecoratorGalactic) this.theBiomeDecorator;
+ }
+
+ }
+
+ public class BiomeGenMain extends BiomeGenBasePlanetSurface {
+ public BiomeGenMain(int aID) {
+ super(aID);
+ this.enableRain = false;
+ this.enableSnow = false;
+ this.topBlock = mThisPlanet.getTask().getTopLayer();
+ this.topMeta = 0;
+ this.fillerBlock = mThisPlanet.getTask().getSoil();
+ this.fillerMeta = 0;
+ this.stoneBlock = mThisPlanet.getTask().getStone();
+ this.stoneMeta = 0;
+ this.spawnableCaveCreatureList.clear();
+ this.spawnableCreatureList.clear();
+ this.spawnableMonsterList.clear();
+ this.spawnableWaterCreatureList.clear();
+ if (!ConfigManagerCore.disableBiomeTypeRegistrations) {
+ BiomeDictionary.registerBiomeType(this, new Type[]{Type.COLD, Type.DRY, Type.DEAD, Type.SPOOKY});
+ }
+
+ }
+ }
+
+ public class BiomeDecoratorGalactic extends BiomeDecorator {
+
+ public void decorateChunk(World world, Random rand, BiomeGenBase biome, int x, int z) {
+ if (this.currentWorld != null) {
+ throw new RuntimeException("Already decorating!!");
+ } else {
+ this.currentWorld = world;
+ this.randomGenerator = new XSTR(rand.nextLong());
+ this.chunk_X = x;
+ this.chunk_Z = z;
+ this.genDecorations(biome);
+ this.currentWorld = null;
+ this.randomGenerator = null;
+ }
+ }
+
+ protected void genDecorations(BiomeGenBase biome) {
+ MinecraftForge.EVENT_BUS.post(new Pre(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z));
+ MinecraftForge.EVENT_BUS.post(new Post(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z));
+ }
+
+ protected boolean getGen(EventType event) {
+ return TerrainGen.decorate(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z, event);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BasicChunkProviderGalactic.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BasicChunkProviderGalactic.java
new file mode 100644
index 0000000000..9a912fdfc0
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BasicChunkProviderGalactic.java
@@ -0,0 +1,18 @@
+package gtPlusPlus.xmod.galacticraft.system.core.dim;
+
+import gtPlusPlus.xmod.galacticraft.system.core.world.gen.ChunkProviderGalactic;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeDecoratorSpace;
+import net.minecraft.world.World;
+
+public class BasicChunkProviderGalactic extends ChunkProviderGalactic {
+
+ public BasicChunkProviderGalactic(World par1World, long seed, boolean mapFeaturesEnabled) {
+ super(par1World, seed, mapFeaturesEnabled);
+ }
+
+ @Override
+ public BiomeDecoratorSpace getBiomeGenerator() {
+ return null;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalactic.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalactic.java
new file mode 100644
index 0000000000..3b9633b21d
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalactic.java
@@ -0,0 +1,111 @@
+package gtPlusPlus.xmod.galacticraft.system.core.world.gen;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeDecoratorSpace;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta;
+import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedCreeper;
+import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton;
+import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
+import net.minecraft.world.chunk.IChunkProvider;
+
+public abstract class ChunkProviderGalactic extends ChunkProviderGalaxyLakes {
+
+ private List<MapGenBaseMeta> worldGenerators;
+ private BiomeGenBase[] biomesForGeneration = this.getBiomesForGeneration();
+ private final GalacticMapGenCavesBase caveGenerator = new GalacticMapGenCavesBase();
+
+ protected List<MapGenBaseMeta> getWorldGenerators() {
+ List<MapGenBaseMeta> generators = Lists.newArrayList();
+ return generators;
+ }
+
+ public ChunkProviderGalactic(World par1World, long seed, boolean mapFeaturesEnabled) {
+ super(par1World, seed, mapFeaturesEnabled);
+ }
+
+ public abstract BiomeDecoratorSpace getBiomeGenerator();
+
+ protected BiomeGenBase[] getBiomesForGeneration() {
+ return new BiomeGenBase[] { GalacticBiomeGenBase.mGalaxy };
+ }
+
+ protected SpawnListEntry[] getCreatures() {
+ return new SpawnListEntry[0];
+ }
+
+ public double getHeightModifier() {
+ return 24.0D;
+ }
+
+ protected SpawnListEntry[] getMonsters() {
+ SpawnListEntry skele = new SpawnListEntry(EntityEvolvedSkeleton.class, 100, 4, 4);
+ SpawnListEntry creeper = new SpawnListEntry(EntityEvolvedCreeper.class, 100, 4, 4);
+ SpawnListEntry spider = new SpawnListEntry(EntityEvolvedSpider.class, 100, 4, 4);
+
+ Class<?> aEnderman;
+ try {
+ aEnderman = Class.forName("galaxyspace.SolarSystem.planets.pluto.entities.EntityEvolvedEnderman");
+ if (aEnderman != null) {
+ SpawnListEntry enderman = new SpawnListEntry(aEnderman, 100, 4, 4);
+ return new SpawnListEntry[] { skele, creeper, spider, enderman };
+ }
+ } catch (ClassNotFoundException e) {}
+
+ return new SpawnListEntry[] { skele, creeper, spider };
+ }
+
+ public void onPopulate(IChunkProvider arg0, int arg1, int arg2) {
+ }
+
+ public boolean chunkExists(int x, int y) {
+ return false;
+ }
+
+ protected SpawnListEntry[] getWaterCreatures() {
+ return new SpawnListEntry[0];
+ }
+
+ public BlockMetaPair getGrassBlock() {
+ return new BlockMetaPair(null, (byte) 0);
+ }
+
+ public BlockMetaPair getDirtBlock() {
+ return new BlockMetaPair(null, (byte) 0);
+ }
+
+ public BlockMetaPair getStoneBlock() {
+ return new BlockMetaPair(null, (byte) 0);
+ }
+
+ protected boolean enableBiomeGenBaseBlock() {
+ return false;
+ }
+
+ public void onChunkProvider(int cX, int cZ, Block[] blocks, byte[] metadata) {
+ }
+
+ public int getWaterLevel() {
+ return 110;
+ }
+
+ public boolean canGenerateWaterBlock() {
+ return true;
+ }
+
+ protected BlockMetaPair getWaterBlock() {
+ return new BlockMetaPair(null, (byte) 0);
+ }
+
+ public boolean canGenerateIceBlock() {
+ return false;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalaxyLakes.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalaxyLakes.java
new file mode 100644
index 0000000000..a3d696d7c5
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalaxyLakes.java
@@ -0,0 +1,529 @@
+package gtPlusPlus.xmod.galacticraft.system.core.world.gen;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+import gtPlusPlus.api.objects.random.XSTR;
+import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeDecoratorSpace;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta;
+import micdoodle8.mods.galacticraft.core.perlin.generator.Gradient;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFalling;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.IProgressUpdate;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.SpawnerAnimals;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.gen.NoiseGeneratorOctaves;
+import net.minecraft.world.gen.NoiseGeneratorPerlin;
+
+public abstract class ChunkProviderGalaxyLakes extends ChunkProviderGenerate {
+ protected Random rand;
+ private NoiseGeneratorOctaves noiseGen4;
+ public NoiseGeneratorOctaves noiseGen5;
+ public NoiseGeneratorOctaves noiseGen6;
+ public NoiseGeneratorOctaves mobSpawnerNoise;
+ protected World worldObj;
+ private BiomeGenBase[] biomesForGeneration = this.getBiomesForGeneration();
+ double[] noise3;
+ double[] noise1;
+ double[] noise2;
+ double[] noise5;
+ double[] noise6;
+ float[] squareTable;
+ private NoiseGeneratorOctaves field_147431_j;
+ private NoiseGeneratorOctaves field_147432_k;
+ private NoiseGeneratorOctaves field_147429_l;
+ private NoiseGeneratorPerlin field_147430_m;
+ private double[] terrainCalcs;
+ private float[] parabolicField;
+ double[] field_147427_d;
+ double[] field_147428_e;
+ double[] field_147425_f;
+ double[] field_147426_g;
+ int[][] field_73219_j = new int[32][32];
+ private final Gradient noiseGen8;
+ private List<MapGenBaseMeta> worldGenerators;
+
+ public ChunkProviderGalaxyLakes(World world, long seed, boolean flag) {
+ super(world, seed, flag);
+ this.worldObj = world;
+ this.rand = new XSTR(seed);
+ this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4);
+ this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
+ this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
+ this.noiseGen8 = new Gradient(this.rand.nextLong(), 2, 0.25F);
+ this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
+ this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
+ this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
+ this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);
+ this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
+ this.terrainCalcs = new double[825];
+ this.parabolicField = new float[25];
+
+ for (int j = -2; j <= 2; ++j) {
+ for (int k = -2; k <= 2; ++k) {
+ float f = 10.0F / MathHelper.sqrt_float((float) (j * j + k * k) + 0.2F);
+ this.parabolicField[j + 2 + (k + 2) * 5] = f;
+ }
+ }
+
+ }
+
+ public Chunk provideChunk(int x, int z) {
+ this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
+ Block[] blockStorage = new Block[65536];
+ byte[] metaStorage = new byte[65536];
+ this.generateTerrain(x, z, blockStorage, metaStorage);
+ this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration,
+ x * 16, z * 16, 16, 16);
+ this.replaceBlocksForBiome(x, z, blockStorage, metaStorage, this.biomesForGeneration);
+ this.onChunkProvider(x, z, blockStorage, metaStorage);
+ Chunk chunk = new Chunk(this.worldObj, blockStorage, metaStorage, x, z);
+ byte[] chunkBiomes = chunk.getBiomeArray();
+ if (this.worldGenerators == null) {
+ this.worldGenerators = this.getWorldGenerators();
+ }
+
+ Iterator<MapGenBaseMeta> i$ = this.worldGenerators.iterator();
+
+ while (i$.hasNext()) {
+ MapGenBaseMeta generator = (MapGenBaseMeta) i$.next();
+ generator.generate(this, this.worldObj, x, z, blockStorage, metaStorage);
+ }
+
+ for (int i = 0; i < chunkBiomes.length; ++i) {
+ chunkBiomes[i] = (byte) this.biomesForGeneration[i].biomeID;
+ }
+
+ chunk.generateSkylightMap();
+ return chunk;
+ }
+
+ public void generateTerrain(int chunkX, int chunkZ, Block[] blockStorage, byte[] metaStorage) {
+ int seaLevel = this.getWaterLevel();
+ metaStorage = new byte[65536];
+ this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration,
+ chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10);
+ this.makeLandPerBiome2(chunkX * 4, 0, chunkZ * 4);
+
+ for (int k = 0; k < 4; ++k) {
+ int l = k * 5;
+ int i1 = (k + 1) * 5;
+
+ for (int j1 = 0; j1 < 4; ++j1) {
+ int k1 = (l + j1) * 33;
+ int l1 = (l + j1 + 1) * 33;
+ int i2 = (i1 + j1) * 33;
+ int j2 = (i1 + j1 + 1) * 33;
+
+ for (int k2 = 0; k2 < 32; ++k2) {
+ double d0 = 0.125D;
+ double d1 = this.terrainCalcs[k1 + k2];
+ double d2 = this.terrainCalcs[l1 + k2];
+ double d3 = this.terrainCalcs[i2 + k2];
+ double d4 = this.terrainCalcs[j2 + k2];
+ double d5 = (this.terrainCalcs[k1 + k2 + 1] - d1) * d0;
+ double d6 = (this.terrainCalcs[l1 + k2 + 1] - d2) * d0;
+ double d7 = (this.terrainCalcs[i2 + k2 + 1] - d3) * d0;
+ double d8 = (this.terrainCalcs[j2 + k2 + 1] - d4) * d0;
+
+ for (int l2 = 0; l2 < 8; ++l2) {
+ double d9 = 0.25D;
+ double d10 = d1;
+ double d11 = d2;
+ double d12 = (d3 - d1) * d9;
+ double d13 = (d4 - d2) * d9;
+
+ for (int i3 = 0; i3 < 4; ++i3) {
+ int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2;
+ short short1 = 256;
+ j3 -= short1;
+ double d14 = 0.25D;
+ double d16 = (d11 - d10) * d14;
+ double d15 = d10 - d16;
+
+ for (int k3 = 0; k3 < 4; ++k3) {
+ if ((d15 += d16) > 0.0D) {
+ blockStorage[j3 += short1] = this.getStoneBlock().getBlock();
+ } else if (k2 * 8 + l2 < seaLevel && this.ca