diff --git a/pom.xml b/pom.xml index 3611485..cd309ba 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.ryanmichela Subterranea Subterranea - 1.7.2-R02 + 1.7.2-R03 http://dev.bukkit.org/server-mods/subterranea/ diff --git a/src/main/java/com/ryanmichela/subterranea/SChunkGenerator.java b/src/main/java/com/ryanmichela/subterranea/SChunkGenerator.java index eefc9af..7a1ebc4 100644 --- a/src/main/java/com/ryanmichela/subterranea/SChunkGenerator.java +++ b/src/main/java/com/ryanmichela/subterranea/SChunkGenerator.java @@ -57,6 +57,8 @@ public SChunkProviderGenerate lazyGetProvider(org.bukkit.World bukkitWorld) ReflectionUtil.setProtectedValue(BiomeBase.class, "DESERT", new SBiomeDesert()); ReflectionUtil.setProtectedValue(BiomeBase.class, "DESERT_HILLS", new SBiomeDesertHills()); + ReflectionUtil.setProtectedValue(BiomeBase.class, "BEACH", new SBiomeBeach()); + // Patch common aspects of all biomes BiomeBase[] biomes = ReflectionUtil.getProtectedValue(BiomeBase.class, "biomes"); for(BiomeBase b : biomes) { diff --git a/src/main/java/com/ryanmichela/subterranea/biome/SBiomeBeach.java b/src/main/java/com/ryanmichela/subterranea/biome/SBiomeBeach.java new file mode 100644 index 0000000..e0c3d7c --- /dev/null +++ b/src/main/java/com/ryanmichela/subterranea/biome/SBiomeBeach.java @@ -0,0 +1,87 @@ +package com.ryanmichela.subterranea.biome; + +import net.minecraft.server.v1_7_R1.*; + +import java.util.Random; + +/** + * Copyright 2014 Ryan Michela + */ +public class SBiomeBeach extends BiomeBeach { + public SBiomeBeach() { + super(16); + this.b(16440917); + this.a("Beach"); + this.a(0.8F, 0.4F); + this.a(j); + } + + public void a(World world, Random random, Block[] ablock, byte[] abyte, int i, int j, double d0) { + boolean flag = true; + Block block = this.ai; + byte b0 = (byte) (this.aj & 255); + Block block1 = this.ak; + int k = -1; + int l = (int) (d0 / 3.0D + 3.0D + random.nextDouble() * 0.25D); + int i1 = i & 15; + int j1 = j & 15; + int k1 = ablock.length / 256; + + for (int l1 = 255; l1 >= 0; --l1) { + int i2 = (j1 * 16 + i1) * k1 + l1; + + if (l1 <= 0 + random.nextInt(5)) { + ablock[i2] = Blocks.BEDROCK; + } else { + Block block2 = ablock[i2]; + + if (block2 != null && block2.getMaterial() != Material.AIR) { + if (block2 == Blocks.STONE) { + if (k == -1) { + if (l <= 0) { + block = null; + b0 = 0; + block1 = Blocks.STONE; + } else if (l1 >= 59 + 128 && l1 <= 64 + 128) { // +128 + block = this.ai; + b0 = (byte) (this.aj & 255); + block1 = this.ak; + } + + if (l1 < 63 + 128 && (block == null || block.getMaterial() == Material.AIR)) { // +128 + if (this.a(i, l1, j) < 0.15F) { + block = Blocks.ICE; + b0 = 0; + } else { + block = Blocks.STATIONARY_WATER; + b0 = 0; + } + } + + k = l; + if (l1 >= 62 + 128) { // +128 + ablock[i2] = block; + abyte[i2] = b0; + } else if (l1 < 56 - l + 128) { // +128 + block = null; + block1 = Blocks.STONE; + ablock[i2] = Blocks.GRAVEL; + } else { + ablock[i2] = block1; + } + } else if (k > 0) { + --k; + ablock[i2] = block1; + if (k == 0 && block1 == Blocks.SAND) { + k = random.nextInt(4) + Math.max(0, l1 - 63 - 128); // -128 + block1 = Blocks.SANDSTONE; + } + } + } + } else { + k = -1; + } + } + } + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e463800..87b2590 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: Subterranea -version: "1.7.2-R02" +version: "1.7.2-R03" author: Ryan Michela main: com.ryanmichela.subterranea.SPlugin prefix: "Subterranea"