Skip to content
This repository has been archived by the owner on Jan 4, 2018. It is now read-only.

Commit

Permalink
Fixed beach biome
Browse files Browse the repository at this point in the history
  • Loading branch information
rmichela committed Apr 10, 2014
1 parent a61ea7e commit 63d633b
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>com.ryanmichela</groupId>
<artifactId>Subterranea</artifactId>
<name>Subterranea</name>
<version>1.7.2-R02</version>
<version>1.7.2-R03</version>
<url>http://dev.bukkit.org/server-mods/subterranea/</url>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
87 changes: 87 additions & 0 deletions src/main/java/com/ryanmichela/subterranea/biome/SBiomeBeach.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 63d633b

Please sign in to comment.