diff options
| author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-24 02:38:23 +0100 |
|---|---|---|
| committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-24 02:38:23 +0100 |
| commit | 5856a6623641697349a112ff75b74296358361a0 (patch) | |
| tree | 3474ab5f0b2d51550259b2a2cce1562a15bcb158 /src/Java | |
| parent | 53408770c7a4dd6fa4c997d4601b7aba215bc9ab (diff) | |
| download | GT5-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')
17 files changed, 1769 insertions, 11 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java index 7df4bd45f3..48f05fe0fd 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java @@ -1,12 +1,19 @@ package gtPlusPlus.core.tileentities.general; +import java.util.ArrayList; +import java.util.List; + +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.util.minecraft.EntityUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; public class TileEntityPlayerDoorBase extends TileEntity { @@ -69,6 +76,8 @@ public class TileEntityPlayerDoorBase extends TileEntity { return 0; } + AutoMap<Entity> mNearbyEntityCache = new AutoMap<Entity>(); + @Override public void updateEntity() { @@ -125,43 +134,94 @@ public class TileEntityPlayerDoorBase extends TileEntity { } } - if (mTickCounter % 4 == 0) { - int aDoorState = 0; + World aWorld = this.getWorldObj(); + Block aBlock = aWorld.getBlock(xCoord, yCoord, zCoord); + BlockPos aThisPos = new BlockPos(xCoord, yCoord, zCoord, this.worldObj); + + if (mTickCounter % 20 == 0) { + int x = 0, y = 0, z = 0; + x = this.xCoord; + y = this.yCoord; + z = this.zCoord; + //List aEntityList = aWorld.loadedEntityList; + List<Entity> aEntityList = new ArrayList<Entity>(); + Chunk aThisChunk = aWorld.getChunkFromBlockCoords(x, z); + for (List l : aThisChunk.entityLists) { + aEntityList.addAll(l); + } + for (Object o : aEntityList) { + if (o != null) { + if (o instanceof Entity) { + if (o instanceof EntityPlayer) { + continue; + } + else { + Entity e = (Entity) o; + BlockPos p = EntityUtils.findBlockPosUnderEntity(e); + if (p != null) { + int newY = p.yPos+1; + if (e.getDistance(xCoord, yCoord, zCoord) <= 2){ + mNearbyEntityCache.put(e); + } + else if (aThisPos.distanceFrom(p.xPos, newY, p.zPos) <= 2) { + mNearbyEntityCache.put(e); + } + } + } + } + } + } + } + + if (mTickCounter % 4 == 0) { + for (Entity y : mNearbyEntityCache) { + if (y.getDistance(xCoord, yCoord, zCoord) > 2){ + mNearbyEntityCache.remove(y); + } + } + + boolean foundMonster = mNearbyEntityCache.size() > 0; + int aNeighbourDoorState = 0; if (mNeighbourDoor != null) { - aDoorState = getNeighbourState(); + aNeighbourDoorState = getNeighbourState(); } - World aWorld = this.getWorldObj(); - Block aBlock = aWorld.getBlock(xCoord, yCoord, zCoord); BlockDoor aDoor = (aBlock instanceof BlockDoor ? (BlockDoor) aBlock : null); boolean aPlayers = checkForPlayers(this.getWorldObj()); if (aDoor != null) { - if (aDoorState != 0 && mMeta == -1) { - if (aDoorState == 100) { - if (!mIsOpen) { + //If neighbour state != 0 and we are in slave mode + if (aNeighbourDoorState != 0 && mMeta == -1) { + if (aNeighbourDoorState == 100) { + if (!mIsOpen && !foundMonster) { //Logger.INFO("Opening Door (Slave)"); aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, true); mIsOpen = true; } - } else if (aDoorState == -100) { + } else if (aNeighbourDoorState == -100 || foundMonster) { if (mIsOpen) { //Logger.INFO("Closing Door (Slave)"); aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, false); mIsOpen = false; } } + //We are master, proceed } else { + //No redstone found, allow automatic handling if (aDoor != null && !hasRedstone()) { + //Found a nearby player if (aPlayers) { - if (!mIsOpen) { + //If we are closed and there are no monsters nearby, open + if (!mIsOpen && !foundMonster) { //Logger.INFO("Opening Door (Mstr)"); aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, true); mIsOpen = true; } else { // Logger.INFO("Doing Nothing, Door is in correct state."); } + //Did not find nearby player } else { - if (mIsOpen) { + //If we are open or there is a monster nearby, close. + if (mIsOpen || foundMonster) { //Logger.INFO("Closing Door (Mstr)"); aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, false); mIsOpen = false; 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 N |
