Skip to content

Commit

Permalink
Merge pull request #1228 from Team-RTG/1.7.10-dev
Browse files Browse the repository at this point in the history
1.7.10-1.1.1.7 update
  • Loading branch information
srs-bsns authored Jan 18, 2018
2 parents b2394cc + 76a552a commit 2fa307d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 88 deletions.
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
mod_id=RTG
mod_name=Realistic Terrain Generation
mod_desc=Adds a new world type which generates realistic terrain for Overworld biomes.
mod_version=1.1.1.6
mod_version=1.1.1.7
mc_version=1.7.10
mod_url=https://github.com/Team-RTG/Realistic-Terrain-Generation
mod_author="Team RTG"
mod_creds=Forked from RWG by ted80. OpenSimplex Noise by KdotJPG.
mod_logo=assets/rtg/logo.png
mcf_version=10.13.4.1558
mcf_version=10.13.4.1614
run_dir=run
package_base=org.teamrtg
mod_deps=after:abyssalcraft@[1.9.1.2,);\
Expand Down
120 changes: 34 additions & 86 deletions src/main/java/rtg/world/gen/ChunkProviderRTG.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@

public class ChunkProviderRTG implements IChunkProvider
{
/**
* Declare variables.
*/

private final MapGenBase caveGenerator;
private final MapGenBase ravineGenerator;
private final MapGenStronghold strongholdGenerator;
Expand Down Expand Up @@ -112,15 +108,14 @@ public void accept(ChunkEvent.Load accepted) {

};

Accessor<ChunkProviderServer,Set<Long>> forServerLoadingChunks =
new Accessor<ChunkProviderServer,Set<Long>>("loadingChunks");
Accessor<ChunkProviderServer,Set<Long>> forServerLoadingChunks = new Accessor<ChunkProviderServer,Set<Long>>("loadingChunks");

private Compass compass = new Compass();
ArrayList<Direction> directions = compass.directions();
private PlaneLocation.Probe probe = new PlaneLocation.Probe(0, 0);

public ChunkProviderRTG(World world, long l)
{
public ChunkProviderRTG(World world, long l) {

worldObj = world;
cmr = (WorldChunkManagerRTG) worldObj.getWorldChunkManager();
worldHeight = worldObj.provider.getActualHeight();
Expand All @@ -134,7 +129,7 @@ public ChunkProviderRTG(World world, long l)
mapRand = new Random(l);
worldSeed = l;

Map m = new HashMap();
Map<String, String> m = new HashMap<>();
m.put("size", "0");
m.put("distance", "24");

Expand Down Expand Up @@ -208,19 +203,16 @@ private void setWeightings() {
}
}
}

public void isFakeGenerator() {
this.mapFeaturesEnabled = false;
}

/**
* @see IChunkProvider
*
* Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
* specified chunk from the map seed and chunk seed
*/
//private HashSet<PlaneLocation> everGenerated = new HashSet<PlaneLocation>();
private TimedHashSet<PlaneLocation> chunkMade = new TimedHashSet<PlaneLocation>(5*1000);
private final LimitedMap<PlaneLocation,Chunk> availableChunks;

@Override
public Chunk provideChunk(final int cx, final int cy)
{
final PlaneLocation chunkLocation = new PlaneLocation.Invariant(cx,cy);
Expand Down Expand Up @@ -411,8 +403,8 @@ public void decorateIfOtherwiseSurrounded(IChunkProvider world, PlaneLocation so
//this.doPopulate(world, cx, cy);
}

public void generateTerrain(RTGBiomeProvider cmr, int cx, int cy, Block[] blocks, byte[] metadata, RealisticBiomeBase biomes[], float[] noise)
{
public void generateTerrain(RTGBiomeProvider cmr, int cx, int cy, Block[] blocks, byte[] metadata, RealisticBiomeBase biomes[], float[] noise) {

int p, h;
for(int i = 0; i < 16; i++)
{
Expand Down Expand Up @@ -471,8 +463,8 @@ public String description(float [] biomeArray) {
public static String firstBlock;
public static String biomeLayoutActivity = "Biome Layout";

public void replaceBlocksForBiome(int cx, int cy, Block[] blocks, byte[] metadata, RealisticBiomeBase[] biomes, BiomeGenBase[] base, float[] n)
{
public void replaceBlocksForBiome(int cx, int cy, Block[] blocks, byte[] metadata, RealisticBiomeBase[] biomes, BiomeGenBase[] base, float[] n) {

ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, cx, cy, blocks, metadata, base, worldObj);
MinecraftForge.EVENT_BUS.post(event);
if (event.getResult() == Result.DENY) return;
Expand Down Expand Up @@ -526,15 +518,9 @@ public void replaceBlocksForBiome(int cx, int cy, Block[] blocks, byte[] metadat
}
}

/**
* @see IChunkProvider
*
* Loads or generates the chunk at the chunk location specified.
*/
@SuppressWarnings("unused")
public Chunk loadChunk(int par1, int par2)
{
if (1>0) throw new RuntimeException();
@Override
public Chunk loadChunk(int par1, int par2) {
//if (1>0) throw new RuntimeException();
return provideChunk(par1, par2);
}

Expand All @@ -555,18 +541,16 @@ private boolean chunkExists(IChunkProvider world, int par1, int par2) {
return false;
}

@Override
public boolean chunkExists(int par1, int par2) {
PlaneLocation location = new PlaneLocation.Invariant(par1, par2);
return inGeneration.containsKey(location)
|| toCheck.contains(location)
|| this.chunkMade.contains(location)
|| chunkLoader().chunkExists(worldObj, par1, par2);
}
/**
* @see IChunkProvider
*
* Populates chunk with ores etc etc
*/

@Override
public void populate(IChunkProvider ichunkprovider, int chunkX, int chunkZ){
// check if this is the master provider
if (WorldTypeRTG.chunkProvider != this) return;
Expand Down Expand Up @@ -664,8 +648,8 @@ private final void removeFromDecorationList(PlaneLocation toAdd) {
}
}

private void doPopulate(IChunkProvider ichunkprovider, int chunkX, int chunkZ)
{
private void doPopulate(IChunkProvider ichunkprovider, int chunkX, int chunkZ) {

// don't populate if already done

PlaneLocation location = new PlaneLocation.Invariant(chunkX, chunkZ);
Expand Down Expand Up @@ -941,8 +925,6 @@ private void doPopulate(IChunkProvider ichunkprovider, int chunkX, int chunkZ)
}
}
}
} else {
throw new RuntimeException();
}
TimeTracker.manager.stop("Ice");

Expand All @@ -954,8 +936,6 @@ private void doPopulate(IChunkProvider ichunkprovider, int chunkX, int chunkZ)
populatingProvider = null;
}



public boolean neighborsDone(IChunkProvider world, int cx, int cz) {
if (!chunkExists(world,cx - 1, cz - 1)) return false;
if (!chunkExists(world,cx - 1, cz)) return false;
Expand All @@ -967,22 +947,14 @@ public boolean neighborsDone(IChunkProvider world, int cx, int cz) {
if (!chunkExists(world,cx + 1, cz + 1)) return false;
return true;
}
/**
* @see IChunkProvider
*
* Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
* Return true if all chunks have been saved.
*/

@Override
public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
{
return true;
}

/**
* @see IChunkProvider
*
* Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
*/
@Override
public boolean unloadQueuedChunks()
{
return false;
Expand All @@ -993,62 +965,43 @@ public boolean unload100OldestChunks()
return false;
}

/**
* @see IChunkProvider
*
* Returns if the IChunkProvider supports saving.
*/
@Override
public boolean canSave()
{
return true;
}

/**
* IChunkProvider
*
* Converts the instance data to a readable string.
*/
@Override
public String makeString()
{
return "ChunkProviderRTG";
}

/**
* @see IChunkProvider
*
* Returns a list of creatures of the specified type that can spawn at the given location.
*/
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
@Override
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) {

BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4);
return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType);
}

/**
* @see IChunkProvider
*/
public ChunkPosition func_147416_a(World par1World, String par2Str, int par3, int par4, int par5)
{
@Override
public ChunkPosition func_147416_a(World par1World, String par2Str, int par3, int par4, int par5) {

if (!ConfigRTG.generateStrongholds) {
return null;
}

return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.func_151545_a(par1World, par3, par4, par5) : null;
}

/**
* @see IChunkProvider
*/
@Override
public int getLoadedChunkCount()
{
return 0;
}

/**
* @see IChunkProvider
*/
public void recreateStructures(int par1, int par2)
{
@Override
public void recreateStructures(int par1, int par2) {

if (mapFeaturesEnabled) {

Expand Down Expand Up @@ -1110,12 +1063,7 @@ public void recreateStructures(int par1, int par2)
}
}

/**
* @see IChunkProvider
*
* Save extra data not associated with any Chunk. Not saved during autosave, only during world unload.
* Currently unimplemented.
*/
@Override
public void saveExtraData() {}


Expand Down

0 comments on commit 2fa307d

Please sign in to comment.