Skip to content

Commit

Permalink
1.15.2, added Oceans + Swamps
Browse files Browse the repository at this point in the history
  • Loading branch information
mrburger authored and BuildTools committed Mar 9, 2020
1 parent 0590197 commit 5b3a255
Show file tree
Hide file tree
Showing 14 changed files with 252 additions and 52 deletions.
3 changes: 1 addition & 2 deletions .idea/BetaPlus-Bukkit.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/libraries/server.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions .idea/libraries/spigot_1_14_4.xml

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/libraries/spigot_1_15_2.xml

This file was deleted.

82 changes: 82 additions & 0 deletions .idea/module_betaplus-bukkit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions .idea/module_betaplus-bukkit_Thu_Feb_20_17-15-00_EST_2020.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/com/mrburgerus/betaplus/BetaPlusPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ public void getForWorld(World world)
//if(worldGenerators.get(world.getUID()).equals(KEYWORD))
if (worldGenerators.get(world.getName()) != null && worldGenerators.get(world.getName()).equals(KEYWORD))
{
//LOGGER.log(Level.INFO, "Attempting to create");
WorldServer serverWorld = ((CraftWorld) world).getHandle();
this.replaceChunkGenerator(serverWorld);
//LOGGER.log(Level.INFO, "Finished Replacement");
}
else
{
LOGGER.log(Level.INFO, "Not a Beta+ World");
LOGGER.log(Level.INFO, "Not a Beta+ World :(");
}
}

Expand Down Expand Up @@ -106,6 +108,7 @@ private void replaceChunkGenerator(WorldServer worldServer)

this.injected = injected;
// Why this?
// Removed
worldServer.generator = null;
}
catch (ReflectiveOperationException var8)
Expand Down
29 changes: 21 additions & 8 deletions src/com/mrburgerus/betaplus/world/beta/ChunkGeneratorBetaPlus.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.mrburgerus.betaplus.world.beta;

import com.mrburgerus.betaplus.BetaPlusPlugin;
import com.mrburgerus.betaplus.util.BiomeReplaceUtil;
import com.mrburgerus.betaplus.util.DeepenOceanUtil;
import com.mrburgerus.betaplus.world.noise.NoiseGeneratorOctavesBeta;
import net.minecraft.server.v1_15_R1.*;
Expand Down Expand Up @@ -60,7 +59,7 @@ public ChunkGeneratorBetaPlus(WorldServer world, WorldChunkManagerBeta wcm)
scaleNoise = new NoiseGeneratorOctavesBeta(rand, 10);
octaves7 = new NoiseGeneratorOctavesBeta(rand, 16);
biomeProviderS = wcm;
//BetaPlusPlugin.LOGGER.log(Level.INFO, "YES HERE");
//BetaPlusPlugin.LOGGER.log(Level.INFO, "YES HERE IN THE CHUNK GEN");
}

// Added to fix passive mobs
Expand Down Expand Up @@ -132,7 +131,19 @@ public void buildBase(RegionLimitedWorldAccess regionlimitedworldaccess, IChunkA

// Fill biomes
BiomeStorage storedPoints = new BiomeStorage(biomesForGeneration);
regionlimitedworldaccess.bio
for (int i = 0; i < CHUNK_SIZE; i++)
{
for (int j = 0; j < CHUNK_SIZE; j++)
{
for (int y = 0; y < 256; y++)
{
// Bit shift MAGIC from forge
chunkIn.getBiomeIndex().setBiome(i, y, j, biomesForGeneration[(i & 15) << 4 | i >> 4 & 15]);
}
}
}


}

public void buildBase(IChunkAccess chunkIn)
Expand All @@ -153,7 +164,8 @@ public void buildBase(IChunkAccess chunkIn)
// Replace Blocks (DIRT & SAND & STUFF) SEE ABOVE
replaceBlocksForBiome(x, z, chunkIn, biomesForGeneration);
// Rotate 270
chunkIn.a(BiomeReplaceUtil.convertBiomeArray(BiomeReplaceUtil.convertBiomeArray(BiomeReplaceUtil.convertBiomeArray(biomesForGeneration))));
//chunkIn.a(BiomeReplaceUtil.convertBiomeArray(BiomeReplaceUtil.convertBiomeArray(BiomeReplaceUtil.convertBiomeArray(biomesForGeneration))));
//((Chunk) chunkIn).

}

Expand Down Expand Up @@ -375,8 +387,9 @@ private void replaceBlocksForBiome(int chunkX, int chunkZ, IChunkAccess chunkpri
int stoneN = (int) (this.stoneNoise[z + x * 16] / 3.0 + 3.0 + this.rand.nextDouble() * 0.25);
int checkVal = -1;
// Changed to use the actual Biome Config.
IBlockData topBlock = biome.q().a();
IBlockData fillerBlock = biome.q().b();
// Testing
IBlockData topBlock = biome.r().a().a();
IBlockData fillerBlock = biome.r().a().b();

// GO from Top to bottom of world
for (int y = 127; y >= 0; --y)
Expand Down Expand Up @@ -407,8 +420,8 @@ private void replaceBlocksForBiome(int chunkX, int chunkZ, IChunkAccess chunkpri
}
else if (y >= BetaPlusPlugin.seaLevel - 4 && y <= BetaPlusPlugin.seaLevel + 1)
{
topBlock = biome.q().a();
fillerBlock = biome.q().b();
topBlock = biome.r().a().a();
fillerBlock = biome.r().a().b();
if (gravelN)
{
topBlock = Blocks.AIR.getBlockData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.logging.Level;

import static com.mrburgerus.betaplus.world.beta.ChunkGeneratorBetaPlus.CHUNK_SIZE;

Expand Down Expand Up @@ -44,6 +45,7 @@ public class WorldChunkManagerBeta extends WorldChunkManager
public WorldChunkManagerBeta(World world)
{
super(biomeList);
//BetaPlusPlugin.LOGGER.log(Level.INFO, "Calling Provider");
long seed = world.getSeed();
scaleVal = (1.0D / 39.999999404);
mult = 2;
Expand Down Expand Up @@ -72,7 +74,8 @@ public BiomeBase[] a(int x, int z, int xSize, int zSize, boolean b)
return this.generateBiomes(x, z, xSize, zSize, false);
}

public Set<BiomeBase> a(int centerX, int centerZ, int sideLength)
// Add centerY
public Set<BiomeBase> a(int centerX, int centerY, int centerZ, int sideLength)
{
int startX = centerX - sideLength >> 2;
int startZ = centerZ - sideLength >> 2;
Expand Down Expand Up @@ -278,9 +281,11 @@ public Pair<BlockPosition, TerrainType>[][] getInitialTerrain(int startX, int st
return terrainPairs;
}

// 1.15 makes this kinda nasty with 3D Biomes
@Override
public BiomeBase getBiome(int i, int i1, int i2) {
return null;
public BiomeBase getBiome(int x, int y, int z)
{
return this.getBiome(x, z);
}

static
Expand Down

1 comment on commit 5b3a255

@ProfanedBane
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

godspeed

Please sign in to comment.